[Neues Modul] LaMetric

Begonnen von Eragos, 13 Juli 2017, 21:21:09

Vorheriges Thema - Nächstes Thema

Thyraz

Ok, funktioniert einwandfrei.

@Eragos vielen Dank für die Umsetzung mit der Local App. :)
Gefällt mir weit besser als die Nachrichten mit einer Notification Queue durchrotieren zu müssen.
Ohne dein Beispiel-DOIF wäre mir das so gar nicht klar geworden.

Würdest du evtl. deine LaMetricPushWeather() Funktion teilen?

@ares danke auch für deine Tips, Umsetzung hat einwandfrei geklappt inkl. reagieren auf den Tastendruck in FHEM.
Fhem und MariaDB auf NUC6i5SYH in Proxmox Container (Ubuntu)
Zwave, Conbee II, Hue, Harmony, Solo4k, LaMetric, Echo, Sonos, Roborock S5, Nuki, Prusa Mini, Doorbird, ...

ares

#16
Ich bin mir immer noch nicht sicher, ob eine App mit einem Frame ohne Standard-Apps wie die Uhr die sinnvollste Variante ist. Vielleicht sollte ich der Idee aber auch mal eine Chance geben.
Edit sagt: Unterschiedlich lange Texte sollte auch unterschiedlich lange angezeigt werden. Die Zeit regelt die Notification App bei mehreren Frames selbständig.

Eragos

Zitat von: Thyraz am 26 Juli 2017, 09:26:51
Ok, funktioniert einwandfrei.

@Eragos vielen Dank für die Umsetzung mit der Local App. :)
Gefällt mir weit besser als die Nachrichten mit einer Notification Queue durchrotieren zu müssen.
Ohne dein Beispiel-DOIF wäre mir das so gar nicht klar geworden.

Würdest du evtl. deine LaMetricPushWeather() Funktion teilen?

@ares danke auch für deine Tips, Umsetzung hat einwandfrei geklappt inkl. reagieren auf den Tastendruck in FHEM.

Freut mich, dass es bei dir funktioniert.

Das Wetter holt er sich vom Weather Modul und ersetzt nur die Icons ins LaMetric Format der wichtigsten Werte hier bei mir. Hat also keinen Anspruch auf Vollständigkeit.


use Switch;
sub LaMetricPushWeather {
switch ($_[0]) {
case '3' { return "i820"; }
case '4' { return "i820"; }
case '5' { return "a160"; }
case '6' { return "a160"; }
case '7' { return "a160"; }
case '8' { return "a72"; }
case '9' { return "a72"; }
case '10' { return "a72"; }
case '11' { return "a72"; }
case '12' { return "a72"; }
case '13' { return "a1673"; }
case '14' { return "a1673"; }
case '15' { return "a1673"; }
case '16' { return "a1673"; }
case '18' { return "a2009"; }
case '19' { return "i2158"; }
case '20' { return "i2158"; }
case '22' { return "i2158"; }
case '26' { return "i91"; }
case '27' { return "i2152"; }
case '28' { return "i876"; }
case '29' { return "i2152"; }
case '30' { return "i876"; }
case '31' { return "i1465"; }
case '32' { return "i1532"; }
case '36' { return "i1532"; }
case '37' { return "i2157"; }
case '38' { return "i2157"; }
case '39' { return "i2157"; }
case '40' { return "a72"; }
case '41' { return "a1673"; }
case '42' { return "a160"; }
case '43' { return "a1673"; }
case '44' { return "i91"; }
case '45' { return "i2157"; }
case '46' { return "a160"; }
case '47' { return "i2157"; }
else { return "i2056"; }
}
}

mando667

Hallo zusammen,

im KNX-User-Forum gibt es einen umfangreichen Logikbaustein für die LaMetric Uhr. (https://service.knx-user-forum.de/?comm=download&id=19000801)

Evtl. lässt sich das Modul um die dort verwendeten Funktionen erweitern? Vor allem E25 (Radio: Steuerung) und E26 (Uhr: Wecker stellen) wären super ;)


Beste Grüße
Julian


E1: Starts (1) or Stops (0) the LBS
E2: Enable Logging (0-none|1-emerg|2-alert|3-crit|4-err|5-warning|6-notice|7-info|8-debug)
E3: IP adress of the lametric clock
E4: API Key - Can be downloaded at https://developer.lametric.com/user/devices, after you registered an account and logged in
E5: Icon + Notification Text - This triggers the LBS and the icon + notification will be shown on the clocks display.
Syntax: Icon:Text. If ':' is missing, entire String will be interpreted as text and no icon will be shown
E6: Shows a progress bar on the display. Syntax: start:current:end:unit, e.g. 1:60:100:% to show a progress bar 0-100% with progress of 60%
E7: Shows a chart with a certain number of vertical bars. Syntax: val1:val2:val3:...:valn, e.g. 10:30:20:40 to show 4 bars
E8: Notification type can be 'none', 'info' or 'alert'
E9: Sets the icon to be shown with the next notification text. Icons can be found here: https://developer.lametric.com/icons
sytax: i###, e.g. 'i95' is a lightning
E10: ID of sound to be played with the next notification. Possible sounds:
bicycle,car,cash,cat,dog,dog2,energy,knock-knock,letter_email,lose1,lose2,negative1,negative2,negative3,negative4,negative5,
notification,notification2,notification3,notification4,open_door,positive1,positive2,positive3,positive4,positive5,positive6,
statistic,thunder,water1,water2,win,win2,wind,wind_short,alarm1,alarm2,alarm3,alarm4,alarm5,alarm6,alarm7,alarm8,alarm9,
alarm10,alarm11,alarm12,alarm13
E11: specifies how often the sound will be repeated
E12: specified for how long a notification will be shown on the display. 0=>until confirmed by main button.
>0 means number of display cycle. one display cycle lasts some seconds
E13: Priority can be 'info', 'warning', 'critical'. A message with a higher priority will stop a currently displayed notification
with lower priority and it will overtake all other notifications with lower priority in the queue
E14: lifetime specifies in ms for how long a notification will live in the queue, even if it is not yet displayed.
After the lifetime exceeds the notification will be deleted even if it was not shown on the display.
E15: 0 - deletes the currently displayed notification. >0 delete the notification with the specified number if it exists
E16: Brightness can be adjusted between 0 and 100. Works only with brightness mode 'manual'
E17: Can be 'manual' or 'auto'. In auto mode brightness will be controlled by the device based on the brightness sensor
E18: adjusts the volume of the integrated speaker between 0 and 100
E19: Switches the bluetooth on (1) or off (0). Bluetooth icon will be shown in the display
E20: sets the bluetooth name, which will be visible if bluetooth is activated on E19
E21: triggers an update of all outputs A2-A15
E22: Activates a specific app. Naming convention of apps ist com.lametric.#APP-Name#.
You have to specify the #APP-Name# here to activate the app, e.g. 'clock' activates the built-in app com.lametric.clock
E23: Switches to the next app (same a right button click on the lametric device)
E24: Switches to the previous app (same a left button click on the lametric device)
E25: Activates the radio app and executed the command sent to this input. Possible commands: play, stop, next, prev  
E26: Activates the clock app. To set the alarm you have to send the format HH:MM or HH:MM:SS to E26.
E27: Activates the timer app. To set the timer to x seconds, you have to send x to E27.
E28: Activates the stopwatch app and executes the command sent to this input. Possible commands: start, pause, reset
E28: Activates the weather app and executes the command sent to this input. Possible commands: forecast

A1: Result of the last command. 'SUCCESS', 'ERROR' or 'UNKNOWN'
A2: Level of brightness: 0-100
A3: Brightness mode: 'auto' or 'manual'
A4: Current volume level: 0-100
A5: Bluetooth status: 0-off 1-on
A6: Bluetooth name
A7: |-separated list of active notifications id's in the queue
A8: ID of the LaMetric device
A9: Name of the LaMetric device
A10: Serial Number of the LaMetric device
A11: OS Version (Firmware) of the LaMetric device
A12: Mode of the LaMetric device
A13: Model of the LaMetric device
A14: Wifi signal strength of the LaMetric device
A15: Status of the screensaver: 1-enabled, 0-disabled (1 does not mean that the screensaver is currently active)

ares

Zitat von: mando667 am 05 August 2017, 10:32:13
im KNX-User-Forum gibt es einen umfangreichen Logikbaustein für die LaMetric Uhr. (https://service.knx-user-forum.de/?comm=download&id=19000801)
Evtl. lässt sich das Modul um die dort verwendeten Funktionen erweitern? Vor allem E25 (Radio: Steuerung) und E26 (Uhr: Wecker stellen) wären super ;)

Die Funktionen werden durch die API angeboten:
http://lametric-documentation.readthedocs.io/en/latest/reference-docs/device-apps.html#id11

Generell kannst Du alles mit HttpUtils_NonblockingGet steuern falls Du nicht auf ein Modul warten möchtest bzw. keines selber erstellen möchtest. Beispiel:
https://forum.fhem.de/index.php/topic,74221.msg663245.html#msg663245

Den Wecker kannst Du auch über fhem steuern und trotzdem den Radio der Uhr auslösen:
https://forum.fhem.de/index.php/topic,62992.0.html

mando667

Danke, werde ich mir mal anschauen.

Wie lässt sich über das Modul der Radio aktivieren?


Gesendet von iPad mit Tapatalk

ares

Zitat von: mando667 am 05 August 2017, 12:18:09
Wie lässt sich über das Modul der Radio aktivieren?

Wie in der API http://lametric-documentation.readthedocs.io/en/latest/reference-docs/device-apps.html#id14 beschrieben.
Zitatradio.play - start playback
radio.stop - stop playback
radio.next - next radio station
radio.prev - previous radio station

Versuch zum Test folgendes in fhem einzugeben.
Ersetze lokale IP: 192.168.123.123
Ersetze API-Key: 123abc123abc123abc123abc123abc123abc123abc123abc123abc123abc123a
{HttpUtils_NonblockingGet({url => 'https://192.168.123.123:4343/api/v2/device/apps/com.lametric.radio/widgets/589ed1b3fcdaa5180bf4848e55ba8061/actions', data => '{"id":"radio.play"}', method => "POST", auth => "dev:123abc123abc123abc123abc123abc123abc123abc123abc123abc123abc123a", callback => sub(){}})}

Du kannst damit natürlich auch direkt den Wecker setzen.

rufus999

Hallo zusammen,

kann jemand helfen?
Ich nutze dieses Modul bekomme aber keine Messages auf der Clock angezeigt. Als Fehler kommt immer unauthorized?!

Internals:
   APIKEY     longapikeyxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
   CHANGED   
   DEF        192.168.XXX.XXX longapikeyxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
   HOST       192.168.XXX.XXX
   NAME       LaMetric
   NR         526
   STATE      ???
   TYPE       LaMetric
   READINGS:
     2018-03-28 18:16:41   lastIcon        i620
     2018-03-28 18:16:41   lastMessage     Ein Test von XXX
     2018-03-28 18:16:41   lastResult      401 Unauthorized
     2018-03-28 18:16:41   lastSound       notification
Attributes:
   room       Display

Den apikey habe ich von der developer-lametric site.

Bitte um Info wenn Ihr noch weitere logs oder Infos benötigt.

Dank und Gruß

rufus999

Thyraz

#23
Gerade gemerkt, dass der msg Befehl bei mir auch nicht mehr will.
Nutze an sich nur den privatemsg Befehl und der funktioniert einwandfrei.

Werde die Tage mal schauen ob ich rausfinde woran es liegt.

Über curl kann ich von der Konsole aus problemlos Nachrichten an die LaMetric schicken.
Somit sollte das im Modul ja auch recht einfach zu fixen sein.
Fhem und MariaDB auf NUC6i5SYH in Proxmox Container (Ubuntu)
Zwave, Conbee II, Hue, Harmony, Solo4k, LaMetric, Echo, Sonos, Roborock S5, Nuki, Prusa Mini, Doorbird, ...

Thyraz

Ok, das Problem liegt in der Änderung hier:
https://forum.fhem.de/index.php?topic=80412.0

User/Passwort wurde im Modul bisher in $param->{auth} geliefert.
Das wird von FHEM nun für was anderes verwendet und man muss es in $param->{user} und $param->{pwd} splitten.

Daher im Modul alle Stellen mit:

auth        => "dev". $hash->{APIKEY},


ersetzen durch:

user        => "dev",
pwd         => $hash->{APIKEY},


Danach sollte es wieder laufen. :)
Fhem und MariaDB auf NUC6i5SYH in Proxmox Container (Ubuntu)
Zwave, Conbee II, Hue, Harmony, Solo4k, LaMetric, Echo, Sonos, Roborock S5, Nuki, Prusa Mini, Doorbird, ...

rufus999

Hallo Thyraz,

super vielen Dank für deine Hilfe. Das schau ich mir Heute Abend gleich mal.
Ich gebe dann Rückmeldung.

Danke rufus999

rufus999

Hallo Thyraz,

sorry hat etwas gedauert. Aber es läuft!  :D

Vielen Dank dafür!

Gruß rufus999