NEWS
[Tutorial] Node Red Sub-Flow: Yeelights steuern mit Alexa
-
Hallo Community,
Ich melde mich nach langer Zeit mal wieder zurück und möchte einen kleinen Sub-Flow mit euch teilen um Yeelights über Alexa und Node-Red mit node-red-contrib-amazon-echo ansteuern zu können. Entstanden ist dieser Flow aus mehreren Gründen. Zum einen wurden es im laufen der Zeit extrem viele Datenpunkte die im Hauptflow eingefügt werden mussten und ich hatte das Problem, dass teilweise Farben die in VIS gesetzt wurden später durch Alexa beim Ausschalten überschrieben wurden.
Hoffentlich ist das ganze nicht doppelt. Als voraussetzung muss noch das node-red-contrib-color-convert Paket installiert werden.
Nach dem Einfügen vom Flow gebt ihr diesem noch die IDs der Datenpunkte für power, rgb, active_bright und ct mit
[{"id":"2d0f0584.d8aa7a","type":"subflow","name":"Yeelight","info":"","category":"","in":[{"x":60,"y":60,"wires":[{"id":"b3475bcf.d6b288"}]}],"out":[],"env":[{"name":"id_on_off","type":"str","value":""},{"name":"id_rgb","type":"str","value":""},{"name":"id_bright","type":"str","value":""},{"name":"id_ct","type":"str","value":""}],"color":"#DDAA99"},{"id":"b3475bcf.d6b288","type":"switch","z":"2d0f0584.d8aa7a","name":"was?","property":"meta.input","propertyType":"msg","rules":[{"t":"hask","v":"on","vt":"str"},{"t":"hask","v":"bri","vt":"str"},{"t":"hask","v":"ct","vt":"str"},{"t":"hask","v":"hue","vt":"str"}],"checkall":"true","repair":false,"outputs":4,"x":190,"y":60,"wires":[["5f0ae8c3.9baae8"],["27bdd852.7755d8"],["625c6fb5.e27f3"],["5f20cadd.4fbe04"]]},{"id":"5f0ae8c3.9baae8","type":"change","z":"2d0f0584.d8aa7a","name":"on","rules":[{"t":"move","p":"meta.input.on","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":370,"y":40,"wires":[["8903d883.8da6e8"]]},{"id":"8903d883.8da6e8","type":"ioBroker out","z":"2d0f0584.d8aa7a","name":"AN/AUS","topic":"${id_on_off}","ack":"false","autoCreate":"false","x":760,"y":40,"wires":[]},{"id":"625c6fb5.e27f3","type":"change","z":"2d0f0584.d8aa7a","name":"ct","rules":[{"t":"move","p":"meta.input.ct","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":370,"y":120,"wires":[["16ef54f7.7aca0b"]]},{"id":"27bdd852.7755d8","type":"change","z":"2d0f0584.d8aa7a","name":"%","rules":[{"t":"move","p":"meta.input.bri","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":370,"y":80,"wires":[["2798e9f6.606c66"]]},{"id":"16ef54f7.7aca0b","type":"range","z":"2d0f0584.d8aa7a","minin":"153","maxin":"500","minout":"6500","maxout":"2600","action":"clamp","round":true,"property":"payload","name":"","x":570,"y":120,"wires":[["4d7a88c5.b679a8"]]},{"id":"2798e9f6.606c66","type":"range","z":"2d0f0584.d8aa7a","minin":"4","maxin":"254","minout":"1","maxout":"100","action":"scale","round":true,"property":"payload","name":"","x":550,"y":80,"wires":[["fe3442c.2a198c"]]},{"id":"5f20cadd.4fbe04","type":"change","z":"2d0f0584.d8aa7a","name":"rgb","rules":[{"t":"move","p":"rgb","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":370,"y":160,"wires":[["3a67967f.0f7b6a"]]},{"id":"3a67967f.0f7b6a","type":"color-convert","z":"2d0f0584.d8aa7a","input":"rgb","output":"hex","outputType":"string","scaleInput":false,"x":570,"y":160,"wires":[["2018210e.d81d7e"]]},{"id":"2018210e.d81d7e","type":"ioBroker out","z":"2d0f0584.d8aa7a","name":"Farbe","topic":"${id_rgb}","ack":"false","autoCreate":"false","x":750,"y":160,"wires":[]},{"id":"fe3442c.2a198c","type":"ioBroker out","z":"2d0f0584.d8aa7a","name":"Helligkeit","topic":"${id_bright}","ack":"false","autoCreate":"false","x":760,"y":80,"wires":[]},{"id":"4d7a88c5.b679a8","type":"ioBroker out","z":"2d0f0584.d8aa7a","name":"ct","topic":"${id_ct}","ack":"false","autoCreate":"false","x":750,"y":120,"wires":[]}]
Vielleicht hilft es ja dem einen oder anderem ebenfalls weiter das WIrrwar in Node Red etwas aufzuräumen.
Als nächstes baue ich mir dann noch Flows für die Zigbee Geräte die über deconz eingebunden sind. -
Klasse - genau das, was ich gesucht habe - habe an lauter individueller Subflows und Funktionen, nur um eine Yeelight zu steuern die Übersicht verloren.
Besten Dank, hat mir sehr geholfen - steuere damit meine Yeelight 2.0 Schreibtischlampe -
@soulforged
Hallo,
ein toller SUB-Flow. Werde in mal testen! Eine frage aber noch, wäre es möglich irgendwie den moon_mode der yeelight Lampen noch einzubinden. Ist Grundsätzlich nur eine Umschaltung zwischen Normalen Modus und den noch abgedimmteren Mondmodus.
Wie auch super wenn du mal die ausführliche Variante zeigen kannst, damit ich verstehe wie es funktioniert.Viele Grüße