iobroker-community-adapters / ioBroker.shelly

Integrate your Shelly devices into ioBroker via MQTT or CoIoT
Other
163 stars 66 forks source link

Shelly RGBW2 Feature Request: Hue Datenpunkt für Nutzung im IOT Adapter #42

Closed siggi85 closed 5 years ago

siggi85 commented 5 years ago

Um den Shelly im IOT Adapter mit Farben nutzen zu können, ist ein Hue Datenpunkt (0-360°) erforderlich. Die R-G-B Datenpunkte reichen da leider nicht. Kann man das direkt im Adapter konfigurieren, sodass für jeden Shelly RGBW ein separater Hue Datenpunkt angelegt wird? Ggf. mit dem Algorhitmus von https://gist.github.com/mjackson/5311256 um aus den R-G-B Daten den Hue Datenpunkt zu berechnen?

schmupu commented 5 years ago
  1. Benötigst du HSV oder HSL?
  2. Und reicht es aus ein Datenpunkt z.b. HSL dann wie folgt zu pflegen: setState(....hsl, 'h, s, l'); Example: setState(...hsl, '10,20,30'); oder lieber einzelne States für h, s, l?
Apollon77 commented 5 years ago

Iot adapter mit Alexa? Dann isst es eher rgb was relevant ist oder?! Nur wäre neu das die anderen sauber tun ?!

Apollon77 commented 5 years ago

Ich meine einen rgb wert der Web Notation #rrggbb

schmupu commented 5 years ago

RGB wert der Web Notation #rrggbb sollte schnell umzusetzen sein

siggi85 commented 5 years ago

Ich denke Hue wird benötigt. In der Doku vom IOT steht zumindest es muss sich um einen Hue Wert handeln. https://github.com/ioBroker/ioBroker.iot/blob/master/README.md

Colors

Just now only english alexa supports the color control. The channel must have 4 states with following roles:

level.color.saturation (required for detection of the channel),
level.color.hue,
level.dimmer,
switch (optional)

Alexa, set the "device name" to "color" Alexa, turn the light fuschia Alexa, set the bedroom light to red Alexa, change the kitchen to the color chocolate

Hatte auch schon Mal im Forum nachgefragt. https://forum.iobroker.net/topic/20728/frage-anforderung-farbige-lampen-mit-rgb-datenpunkten-ohne-hue-in-alexa/8

EDIT: Obwohl mit gerade auffällt dass es auch keinen Saturation Wert gibt. Keine Ahnung ob der auch mandatory ist?! Mit Switch und Dimmer kann ich per Alexa zumindest ein/aus und dimmen. Nur Farbangaben funktionieren leider noch nicht.

schmupu commented 5 years ago

@Apollon77 , kann der IOT Adapter auch level.rgb wie Du oben beschrieben hast (#RRGGBB)?

Apollon77 commented 5 years ago

Ich erinnere mich eher das iot nur gescheit mir #rrggbb arbeitet als ein Farbstate und gerade Nicht mit hsv. Vor allem auch weil einkeile Notation gibt um hsv Atomar zu setzen.

Aber müsste ich nochmal im iot Code checken.

Apollon77 commented 5 years ago

Ps: das #rrggbb tut weiß ich 100%

siggi85 commented 5 years ago

Solange IOT damit arbeiten kann, wäre #rrggbb auch super. Sag einfach Bescheid wenn ich testen soll. :)

schmupu commented 5 years ago

@siggi85 , einmal testen. Wieder Version über GitHub laden u. Shelly Instanz neu starten. Anschließend hast Du ein neues Objekt color.rgbw . Darüber kannst Du die Farben ändern im Format #RRGGBBWW , auch sollte das Objekt angepaßt werden, wenn Du eine einzelne Farbe an color.red, color.green, ... änderst und umgekehrt. Wäre super wenn Du auch einmal den Zustand des Objektes im 'white' Modus beschreiben würdest. Vielleicht muss ich da noch etwas ändern.

siggi85 commented 5 years ago

Die Werte werden zwar geändert, aber kein Befehl kommt beim Shelly an. Der neue RGBW Wert bleibt auch leer. Wenn ich über die Shelly App die Devices ansteuer wird der aktuelle Status im ioBroker nicht mehr aktualisiert.

schmupu commented 5 years ago

kannst Du mal bei Instanzen auf Expertenmodus gehen und dort Logging von info auf debugging stellen und folgendes testen:

  1. ioBroker: Status über color.rgbw ändern (z.B. #FF00FF00)
  2. ioBroker: color.red , .... , color. white ändern
  3. Shelly App: Farbei ändern

Ich benötige dann zu jedem Punkt immer den Output von 'Set RGBW Colors: ' im Logfile

siggi85 commented 5 years ago

Ich bemerke gerade, der Adapter stürzt dauernd ab.

host.ioBroker 2019-03-16 09:58:54.855 info Restart adapter system.adapter.shelly.0 because enabled host.ioBroker 2019-03-16 09:58:54.855 error instance system.adapter.shelly.0 terminated with code 0 (OK) shelly.0 2019-03-16 09:58:54.808 debug Initialize device SHRGBW2#2B92FB#1 (1 now known) shelly.0 2019-03-16 09:58:54.729 debug Create state object for SHRGBW2#2B92FB#1.hostname if not exist shelly.0 2019-03-16 09:58:54.725 debug Call REST GET http://192.168.1.180/settings with {} shelly.0 2019-03-16 09:58:54.725 debug Update Shelly States for SHRGBW2#2B92FB#1 shelly.0 2019-03-16 09:58:54.725 debug Creating State SHRGBW2#2B92FB#1.mode shelly.0 2019-03-16 09:58:54.725 debug Creating State SHRGBW2#2B92FB#1.white3.brightness shelly.0 2019-03-16 09:58:54.725 debug Creating Channel SHRGBW2#2B92FB#1.white3 shelly.0 2019-03-16 09:58:54.725 debug Creating State SHRGBW2#2B92FB#1.white3.Switch shelly.0 2019-03-16 09:58:54.725 debug Creating Channel SHRGBW2#2B92FB#1.white3 shelly.0 2019-03-16 09:58:54.725 debug Creating State SHRGBW2#2B92FB#1.white2.brightness shelly.0 2019-03-16 09:58:54.725 debug Creating Channel SHRGBW2#2B92FB#1.white2 shelly.0 2019-03-16 09:58:54.725 debug Creating State SHRGBW2#2B92FB#1.white2.Switch shelly.0 2019-03-16 09:58:54.725 debug Creating Channel SHRGBW2#2B92FB#1.white2 shelly.0 2019-03-16 09:58:54.725 debug Creating State SHRGBW2#2B92FB#1.white1.brightness shelly.0 2019-03-16 09:58:54.725 debug Creating Channel SHRGBW2#2B92FB#1.white1 shelly.0 2019-03-16 09:58:54.725 debug Creating State SHRGBW2#2B92FB#1.white1.Switch shelly.0 2019-03-16 09:58:54.725 debug Creating Channel SHRGBW2#2B92FB#1.white1 shelly.0 2019-03-16 09:58:54.725 debug Creating State SHRGBW2#2B92FB#1.white0.brightness shelly.0 2019-03-16 09:58:54.725 debug Creating Channel SHRGBW2#2B92FB#1.white0 shelly.0 2019-03-16 09:58:54.725 debug Creating State SHRGBW2#2B92FB#1.white0.Switch shelly.0 2019-03-16 09:58:54.725 debug Creating Channel SHRGBW2#2B92FB#1.white0 shelly.0 2019-03-16 09:58:54.725 debug Creating State SHRGBW2#2B92FB#1.color.rgbw shelly.0 2019-03-16 09:58:54.725 debug Creating Channel SHRGBW2#2B92FB#1.color shelly.0 2019-03-16 09:58:54.725 debug Creating State SHRGBW2#2B92FB#1.color.effect shelly.0 2019-03-16 09:58:54.725 debug Creating Channel SHRGBW2#2B92FB#1.color shelly.0 2019-03-16 09:58:54.725 debug Creating State SHRGBW2#2B92FB#1.color.gain shelly.0 2019-03-16 09:58:54.724 debug Creating Channel SHRGBW2#2B92FB#1.color shelly.0 2019-03-16 09:58:54.724 debug Creating State SHRGBW2#2B92FB#1.color.white shelly.0 2019-03-16 09:58:54.724 debug Creating Channel SHRGBW2#2B92FB#1.color shelly.0 2019-03-16 09:58:54.724 debug Creating State SHRGBW2#2B92FB#1.color.blue shelly.0 2019-03-16 09:58:54.724 debug Creating Channel SHRGBW2#2B92FB#1.color shelly.0 2019-03-16 09:58:54.724 debug Creating State SHRGBW2#2B92FB#1.color.green shelly.0 2019-03-16 09:58:54.724 debug Creating Channel SHRGBW2#2B92FB#1.color shelly.0 2019-03-16 09:58:54.724 debug Creating State SHRGBW2#2B92FB#1.color.red shelly.0 2019-03-16 09:58:54.724 debug Creating Channel SHRGBW2#2B92FB#1.color shelly.0 2019-03-16 09:58:54.724 debug Creating State SHRGBW2#2B92FB#1.color.Switch shelly.0 2019-03-16 09:58:54.724 debug Creating Channel SHRGBW2#2B92FB#1.color shelly.0 2019-03-16 09:58:54.724 debug Create state object for SHRGBW2#2B92FB#1.online if not exist shelly.0 2019-03-16 09:58:54.724 debug Creating device SHRGBW2#2B92FB#1 shelly.0 2019-03-16 09:58:54.724 debug Create Shelly States for SHRGBW2#2B92FB#1 shelly.0 2019-03-16 09:58:54.724 debug Device description received: {"3332":"SHRGBW2#2B92FB#1"} / {"blk":[{"I":1,"D":"RGBW2"}],"sen":[{"I":111,"T":"Red","R":"0/255","L":0},{"I":121,"T":"Green","R":"0/255","L":0},{"I":131,"T":"Blue","R":"0/ shelly.0 2019-03-16 09:58:54.724 debug CoAP response: {"3332":"SHRGBW2#2B92FB#1"} shelly.0 2019-03-16 09:58:54.706 debug Connection update received for SHRGBW2#2B92FB#1: true shelly.0 2019-03-16 09:58:54.706 debug CoAP device description request for SHRGBW2#2B92FB#1 to 192.168.1.180(0) shelly.0 2019-03-16 09:58:54.706 debug Status update received for SHRGBW2#2B92FB#1: {"G":[[0,111,0],[0,121,255],[0,131,0],[0,141,0],[0,151,0]]} shelly.0 2019-03-16 09:58:54.706 debug CoAP status package received: {"3332":"SHRGBW2#2B92FB#1","3412":38400,"3420":25601,"Uri-Path":"cit/s"} / {"G":[[0,111,0],[0,121,255],[0,131,0],[0,141,0],[0,151,0]]} shelly.0 2019-03-16 09:58:52.092 debug connected set to true shelly.0 2019-03-16 09:58:52.092 info Listening for Shelly packets in the network shelly.0 2019-03-16 09:58:52.092 debug Send CoAP multicast request for discovery shelly.0 2019-03-16 09:58:52.078 debug connected set to false shelly.0 2019-03-16 09:58:52.045 info Starting shelly.0 in version 2.1.7 shelly.0 2019-03-16 09:58:51.988 info starting. Version 2.1.7 in /opt/iobroker/node_modules/iobroker.shelly, node: v8.14.0 host.ioBroker 2019-03-16 09:58:51.593 info instance system.adapter.shelly.0 started with pid 11210

schmupu commented 5 years ago

Ich glaube nicht, dass es etwas mit der Änderung zu tun hat. Ich habe noch alte Files entfernt. Wahrscheinlich liegt es daran. Kannst du einmal auf Deinem ioBroker Rechner folgendes ausführen:

cd /opt/iobroker/node_modules/iobroker.shelly
npm update

danach Instanz neu starten, wenn das nicht hilft folgendes probieren:

cd /opt/iobroker/node_modules/iobroker.shelly
npm install

und Instanz neu starten. Geht es jetzt wieder? Werden die Farben angepasst?

siggi85 commented 5 years ago

Funktioniert nichts. :/ Habe auch schon mal die ganze Instanz gelöscht und wieder angelegt. Es wurden 2 von 4 Shellys erkannt und danach ist der Adapter wieder abgeraucht. Er startet dauernd durch und mittlerweile sind die anderen Shellys auch wieder als Objekte vorhanden. Aber steuern kann ich nichts.

EDIT: Im Log steht nur

host.ioBroker 2019-03-16 10:33:52.186 error instance system.adapter.shelly.0 terminated with code 0 (OK)
schmupu commented 5 years ago

Das ist nicht viel an Info. Ich habe jetzt alles wieder ausgebaut. Kannst Du bitte die Version nochmals installieren (GitHub) und Instanz neu starten. Läuft es jetzt wieder?

siggi85 commented 5 years ago

Ja, läuft wieder.

schmupu commented 5 years ago

okay, dann baue ich mal Stück für Stück wieder Sachen ein. Bitte neue laden und Instanz neu starten Wieder eingebaut, dass man die Farbe über color.rgbw änder kann. Kannst Du hier mal #AABBCCDD00 eingeben. Geht das ?

siggi85 commented 5 years ago

Sieht gut aus. Beim ändern des neuen Wertes setzt er die Farbe korrekt (inklusive weiß) und ändert auch die einzelnen R-G-B-W Werte korrekt. Umgekehrt funktioniert es nicht. Wenn ich die R-G-B-W Werte anpasse, ändert er nicht den neuen Wert. Ich glaube der IOT Adapter arbeitet wahrscheinlich nur mit #RRGGBB und nicht mit #RRGGBBWW. Allerdings scheint das mit deinem Objekt zu funktionieren. Wenn ich einen #RRGGBB Wert setze, funktioniert es auch und er setzt WW anscheiend einfach auf 00. :)

Zu Frage wie sich weiß verhält: R-G-B kann man setzen wie man will und Gain steuert dann die Helligkeit der Farbe. Weiß ist aber quasi bereits sein eigener Helligkeitswert, Gain hat hier keinen Einfluss. Man kann auch weiß und Farbe gleichzeitig an schalten, dann wir die Farbe etwas heller aber nicht mehr so kräftig (je nachdem wie hoch man weiß schaltet). D.h. in der Praxis wird man selten Weiß und Farbe zusammen nutzen, es ist aber möglich (auch über die offizielle Shelly App).

schmupu commented 5 years ago

Okay, Rest auch wieder eingebaut (anders). Bitte die Version nochmals installieren (GitHub) und Instanz neu starten. Jetzt sollte alles gehen:

  1. ioBroker: Status über color.rgbw ändern (z.B. #AABBCCDD)
  2. ioBroker: color.red , .... , color. white ändern -> color.rgbw ändert sich mit
  3. Shelly App: Farbei ändern, werte in color.red, ..., color.white und color.rgbw sollten sich ändern
siggi85 commented 5 years ago
  1. ja
  2. nein
  3. nein

Der neue Wert wird dauerhaft rot angezeigt. Änderugen dieses Wertes funktionieren. Änderungen durch R-G-B-W oder shelly app ändern den Wert nicht. Auch das Löschen des Wertes und Wiederanlegen durch Neustart der Instanz brachte keine Besserung.

schmupu commented 5 years ago

Kannst Du bitte nochmals Punkte 2 + 3 testen, mit der neuen Version und mir den Logfile Output mit den Wörtern: 2.x Color RGBW updateShellyRGBWW2States schicken

siggi85 commented 5 years ago

EDIT: Konnte "updateShellyRGBWW2States" nicht finden, daher habe ich es mit "RGBW" Filter versucht. Hoffe das hilft dir etwas weiter.

Ändern eines Wertes in ioBroker auf 2B8EBC (Debug Log mit Filter auf "RGBW"):

shelly.0 2019-03-16 13:53:54.713 debug REST Response {"device":{"type":"SHRGBW2","mac":"3E71BF2B8EEB","hostname":"shellyrgbw2-2B8EEB","num_outputs":4},"wifi_ap":{"enabled":false,"ssid":"shellyrgbw2-2B8EEB","key":""},"wifi_sta":{"enabled":t
shelly.0 2019-03-16 13:53:54.593 debug Update Shelly States for SHRGBW2#2B8EEB#1
shelly.0 2019-03-16 13:53:54.585 debug REST Response {"device":{"type":"SHRGBW2","mac":"3E71BF2B92FB","hostname":"shellyrgbw2-2B92FB","num_outputs":4},"wifi_ap":{"enabled":false,"ssid":"shellyrgbw2-2B92FB","key":""},"wifi_sta":{"enabled":t
shelly.0 2019-03-16 13:53:54.455 debug Update Shelly States for SHRGBW2#2B92FB#1
shelly.0 2019-03-16 13:53:53.652 debug REST Response {"device":{"type":"SHRGBW2","mac":"3E71BF2B8EBC","hostname":"shellyrgbw2-2B8EBC","num_outputs":4},"wifi_ap":{"enabled":false,"ssid":"shellyrgbw2-2B8EBC","key":""},"wifi_sta":{"enabled":t
shelly.0 2019-03-16 13:53:53.531 debug Update Shelly States for SHRGBW2#2B8EBC#1
shelly.0 2019-03-16 13:53:53.531 debug Status update received for SHRGBW2#2B8EBC#1: {"G":[[0,111,0],[0,121,0],[0,131,255],[0,141,0],[0,151,1]]}
shelly.0 2019-03-16 13:53:53.531 debug CoAP status package received: {"3332":"SHRGBW2#2B8EBC#1","3412":38400,"3420":64513,"Uri-Path":"cit/s"} / {"G":[[0,111,0],[0,121,0],[0,131,255],[0,141,0],[0,151,1]]}
shelly.0 2019-03-16 13:53:53.458 debug CoAP data ignored: {"3332":"SHRGBW2#2B8EEB#1","3412":38400,"3420":51712,"Uri-Path":"cit/s"} / {"G":[[0,111, 255],[0,121, 0],[0,131, 255],[0,141, 0],[0,151, 0]]}
shelly.0 2019-03-16 13:53:53.336 debug REST Response {"device":{"type":"SHRGBW2","mac":"3E71BF2B8F05","hostname":"shellyrgbw2-2B8F05","num_outputs":4},"wifi_ap":{"enabled":false,"ssid":"shellyrgbw2-2B8F05","key":""},"wifi_sta":{"enabled":t
shelly.0 2019-03-16 13:53:53.220 debug Update Shelly States for SHRGBW2#2B8F05#1
shelly.0 2019-03-16 13:53:53.158 debug CoAP data ignored: {"3332":"SHRGBW2#2B92FB#1","3412":38400,"3420":26625,"Uri-Path":"cit/s"} / {"G":[[0,111, 255],[0,121, 0],[0,131, 255],[0,141, 0],[0,151, 0]]}
shelly.0 2019-03-16 13:53:52.996 debug stateChange shelly.0.SHRGBW2#2B8EBC#1.color.green {"val":0,"ack":false,"ts":1552740832995,"q":0,"from":"system.adapter.admin.0","lc":1552740832995}
shelly.0 2019-03-16 13:53:52.582 debug CoAP data ignored: {"3332":"SHRGBW2#2B8F05#1","3412":38400,"3420":52224,"Uri-Path":"cit/s"} / {"G":[[0,111, 0],[0,121, 255],[0,131, 255],[0,141, 0],[0,151, 0]]}
shelly.0 2019-03-16 13:53:49.396 debug REST Response {"device":{"type":"SHRGBW2","mac":"3E71BF2B8EBC","hostname":"shellyrgbw2-2B8EBC","num_outputs":4},"wifi_ap":{"enabled":false,"ssid":"shellyrgbw2-2B8EBC","key":""},"wifi_sta":{"enabled":t
shelly.0 2019-03-16 13:53:49.274 debug Update Shelly States for SHRGBW2#2B8EBC#1

Ändern eines Wertes in der App auf 2B8EBC (Debug Log mit Filter auf "RGBW"):

shelly.0 2019-03-16 13:56:37.615 debug Update Shelly States for SHRGBW2#2B8EEB#1
shelly.0 2019-03-16 13:56:37.512 debug Update Shelly States for SHRGBW2#2B92FB#1
shelly.0 2019-03-16 13:56:36.306 debug REST Response {"device":{"type":"SHRGBW2","mac":"3E71BF2B8F05","hostname":"shellyrgbw2-2B8F05","num_outputs":4},"wifi_ap":{"enabled":false,"ssid":"shellyrgbw2-2B8F05","key":""},"wifi_sta":{"enabled":t
shelly.0 2019-03-16 13:56:36.190 debug Update Shelly States for SHRGBW2#2B8F05#1
shelly.0 2019-03-16 13:56:33.362 debug REST Response {"device":{"type":"SHRGBW2","mac":"3E71BF2B8EBC","hostname":"shellyrgbw2-2B8EBC","num_outputs":4},"wifi_ap":{"enabled":false,"ssid":"shellyrgbw2-2B8EBC","key":""},"wifi_sta":{"enabled":t
shelly.0 2019-03-16 13:56:33.239 debug Update Shelly States for SHRGBW2#2B8EBC#1
shelly.0 2019-03-16 13:56:33.239 debug Status update received for SHRGBW2#2B8EBC#1: {"G":[[0,111,255],[0,121,0],[0,131,0],[0,141,0],[0,151,1]]}
shelly.0 2019-03-16 13:56:33.239 debug CoAP status package received: {"3332":"SHRGBW2#2B8EBC#1","3412":38400,"3420":64769,"Uri-Path":"cit/s"} / {"G":[[0,111,255],[0,121,0],[0,131,0],[0,141,0],[0,151,1]]}
shelly.0 2019-03-16 13:56:32.466 debug REST Response {"device":{"type":"SHRGBW2","mac":"3E71BF2B8EBC","hostname":"shellyrgbw2-2B8EBC","num_outputs":4},"wifi_ap":{"enabled":false,"ssid":"shellyrgbw2-2B8EBC","key":""},"wifi_sta":{"enabled":t
shelly.0 2019-03-16 13:56:32.348 debug Update Shelly States for SHRGBW2#2B8EBC#1
schmupu commented 5 years ago

Hmm, hattest du Adapter nochmals von GitHub geladen? Wundert mich, dass "Color RGBW updateShellyRGBWW2States " nirgends auftaucht. Du kannst auch den Log Modus von debug auf info zurücksetzen. Ich habe das als Info eingebaut.

siggi85 commented 5 years ago

Ja, habe noch mal neu installiert, Instanz neu gestartet und auf Info geschaltet. Keine Logs zu sehen (bis auf die Startlogs der Instanz) beim Ändern eines Wertes; weder per App noch per ioBroker.

schmupu commented 5 years ago

habe den Fehler gefunden. warte mal 2 minuten

schmupu commented 5 years ago

Jetzt bitte nochmals Testen. Ich hoffe nun sollten Punkt 2+3 funktionieren:

  1. ioBroker: Status über color.rgbw ändern (z.B. #AABBCCDD)
  2. ioBroker: color.red , .... , color. white ändern -> color.rgbw ändert sich mit
  3. Shelly App: Farbei ändern, werte in color.red, ..., color.white und color.rgbw sollten sich ändern
siggi85 commented 5 years ago

Funktioniert. Ich teste gleich mal im IOT Adapter. ;)

schmupu commented 5 years ago

Klasse, wenn das so okay ist packe ich heute Abend in das latest repo

siggi85 commented 5 years ago

Farbwechsel über iot funktionieren auch. :) Einige Farben sehen mit dem Farbcode den Alexa einstellt nicht sehr gut aus (bspw. lila) , aber die Grundfarben sehen super aus. Auf jeden Fall kannst du da erst mal nichts mehr machen. ;) Danke für die viele Hilfe in den letzten Tagen. Bin sehr zufrieden mit dem Adapter. Daumen noch!