I am able to switch on a light using node-RED that works perfect however an RGBW strip sometimes switches on and immediately off again. But most of the times is just stays off.
The flow I made is working (there is a JSON error you can dismiss "Unexpected token c in JSON at position 0") just change the idx in the functions
Code: Select all
[{"id":"38d76626.40560a","type":"inject","z":"75ec7863.1959e8","name":"set color","topic":"","payload":"FF0B85","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":140,"y":60,"wires":[["fa3a4b82.b07b88"]]},{"id":"21317f95.a289c","type":"inject","z":"75ec7863.1959e8","name":"","topic":"light","payload":"On","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":240,"wires":[["2f822c74.4153d4"]]},{"id":"fa3a4b82.b07b88","type":"function","z":"75ec7863.1959e8","name":"","func":"var newMsg = { command: \"setcolbrightnessvalue\", idx: 59, hex: msg.payload, brightness: 90, iswhite: false };\nreturn {payload: newMsg}\n","outputs":1,"noerr":0,"x":410,"y":120,"wires":[["3c7b98c0.c99a28","b170a429.7792e8"]]},{"id":"3c7b98c0.c99a28","type":"mqtt out","z":"75ec7863.1959e8","name":"","topic":"domoticz/in","qos":"1","retain":"true","broker":"fc68fc78.a14ae","x":710,"y":120,"wires":[]},{"id":"b170a429.7792e8","type":"debug","z":"75ec7863.1959e8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":690,"y":260,"wires":[]},{"id":"2f822c74.4153d4","type":"function","z":"75ec7863.1959e8","name":"","func":"// 59 is a RGB strip, 28 is a normal ligth\nif (msg.topic==\"rgb\"){\n var newMsg = { command: \"switchlight\", idx: 59, switchcmd: msg.payload };\n} else if (msg.topic==\"light\"){\n var newMsg={ command: \"switchlight\", idx: 28, switchcmd: msg.payload }\n}\nreturn {payload: newMsg}\n","outputs":1,"noerr":0,"x":410,"y":260,"wires":[["3c7b98c0.c99a28","b170a429.7792e8"]]},{"id":"de09d7bd.29a8e8","type":"inject","z":"75ec7863.1959e8","name":"","topic":"light","payload":"Off","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":280,"wires":[["2f822c74.4153d4"]]},{"id":"5e1d95e8.8198ac","type":"inject","z":"75ec7863.1959e8","name":"","topic":"rgb","payload":"Off","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":140,"wires":[["2f822c74.4153d4"]]},{"id":"dbea6765.a9ad18","type":"inject","z":"75ec7863.1959e8","name":"","topic":"rgb","payload":"On","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":100,"wires":[["2f822c74.4153d4"]]},{"id":"fc68fc78.a14ae","type":"mqtt-broker","z":"","name":"","broker":"192.168.178.188","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]
The debug node shows the command-object I am publishing to Domoticz/in.
Does anyone have any idea how to keep the RGBW lights on after injecting the command?