Thanks for your help, I added the command in the in/output function, but think I am missing something, cause it immediately lets me see a red triangle.
Code: Select all
[{"id":"3c92e734.171818","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"41536b1a.23a72c","type":"mqtt in","z":"3c92e734.171818","name":"","topic":"domoticz/out","qos":"0","datatype":"auto","broker":"bbb8a5f8.078ff","x":90,"y":660,"wires":[["d3d38b58.c22548"]]},{"id":"d3d38b58.c22548","type":"json","z":"3c92e734.171818","name":"","property":"payload","action":"","pretty":false,"x":130,"y":300,"wires":[["c1c1221.3dde76","8f1008e.edf9bf8"]]},{"id":"c1c1221.3dde76","type":"function","z":"3c92e734.171818","name":"Function In on/off","func":"msg.topic = msg.payload.idx\nif (msg.payload.nvalue === 1)\n{\n msg.payload = true\n}\nelse if (msg.payload.nvalue === 0)\n{\n msg.payload = false\n}\n{\"command\": \"switchlight\", \"idx\": 2450, \"switchcmd\": \"On\" }\n{\"command\": \"switchlight\", \"idx\": 2450, \"switchcmd\": \"Set Level\", \"level\": 100 }\n{\"command\": \"setcolbrightnessvalue\", \"idx\": 2450, \"hue\": 274, \"brightness\": 40, \"iswhite\": false }\n{\"command\": \"setcolbrightnessvalue\", \"idx\": 2450, \"hex\": \"RRGGBB\", \"brightness\": 100, \"iswhite\": false }\n{\"command\": \"setcolbrightnessvalue\", \"idx\": 2450, \"color\": {\"m\":3,\"t\":0,\"r\":0,\"g\":0,\"b\":50,\"cw\":0,\"ww\":0}, \"brightness\": 40} \n return msg;","outputs":1,"noerr":11,"x":310,"y":300,"wires":[["e20c4746.7cba2"]]},{"id":"e20c4746.7cba2","type":"switch","z":"3c92e734.171818","name":"","property":"topic","propertyType":"msg","rules":[{"t":"eq","v":"112","vt":"str"},{"t":"eq","v":"92","vt":"str"},{"t":"eq","v":"42","vt":"str"},{"t":"eq","v":"151","vt":"str"},{"t":"eq","v":"66","vt":"str"},{"t":"eq","v":"169","vt":"str"},{"t":"eq","v":"170","vt":"str"},{"t":"eq","v":"171","vt":"str"},{"t":"eq","v":"172","vt":"str"},{"t":"eq","v":"173","vt":"str"},{"t":"eq","v":"174","vt":"str"},{"t":"eq","v":"53","vt":"str"},{"t":"eq","v":"155","vt":"str"}],"checkall":"true","repair":false,"outputs":13,"x":510,"y":300,"wires":[[],[],[],[],[],[],["c9a6badd.48a34"],["c423af4b.628d48"],["29a47fec.b643b8"],["536ac963.3a9dd8"],[],[],[]]},{"id":"c9a6badd.48a34","type":"nora-light","z":"3c92e734.171818","devicename":"Woonkamerlamp","lightcolor":false,"brightnesscontrol":true,"turnonwhenbrightnesschanges":false,"passthru":false,"statepayload":true,"brightnessoverride":"","roomhint":"Woonkamer","name":"Woonkamerlamp","nora":"ee0cddb4.0c0618","topic":"7","onvalue":"true","onvalueType":"bool","offvalue":"false","offvalueType":"bool","x":790,"y":120,"wires":[["b26b1405.3cd0a"]]},{"id":"b26b1405.3cd0a","type":"function","z":"3c92e734.171818","name":"Function Out ON/OFF","func":"var idx = msg.topic\nif ( msg.payload === true )\n{\nmsg.payload = { \"command\": \"switchlight\", \"idx\": idx, \"switchcmd\": \"On\" };\n}\nelse if ( msg.payload === false )\n{\nmsg.payload = { \"command\": \"switchlight\", \"idx\": idx, \"switchcmd\": \"Off\" };\n}\n{\"command\": \"switchlight\", \"idx\": 2450, \"switchcmd\": \"On\" }\n{\"command\": \"switchlight\", \"idx\": 2450, \"switchcmd\": \"Set Level\", \"level\": 100 }\n{\"command\": \"setcolbrightnessvalue\", \"idx\": 2450, \"hue\": 274, \"brightness\": 40, \"iswhite\": false }\n{\"command\": \"setcolbrightnessvalue\", \"idx\": 2450, \"hex\": \"RRGGBB\", \"brightness\": 100, \"iswhite\": false }\n{\"command\": \"setcolbrightnessvalue\", \"idx\": 2450, \"color\": {\"m\":3,\"t\":0,\"r\":0,\"g\":0,\"b\":50,\"cw\":0,\"ww\":0}, \"brightness\": 40} \nreturn msg\n","outputs":1,"noerr":11,"x":1020,"y":280,"wires":[["97ed54ee.bdb78"]]},{"id":"97ed54ee.bdb78","type":"template","z":"3c92e734.171818","name":"Gen MQTT On/Off","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{\"command\": \"switchlight\", \"idx\": {{payload.idx}}, \"switchcmd\": \"{{payload.switchcmd}}\" }","output":"str","x":1230,"y":280,"wires":[["e285baf1.c8221"]]},{"id":"e285baf1.c8221","type":"mqtt out","z":"3c92e734.171818","name":"","topic":"domoticz/in","qos":"","retain":"","broker":"c774ffd3.5056a8","x":1290,"y":360,"wires":[]},{"id":"c423af4b.628d48","type":"nora-light","z":"3c92e734.171818","devicename":"Eettafellamp","lightcolor":false,"brightnesscontrol":false,"turnonwhenbrightnesschanges":false,"passthru":false,"statepayload":true,"brightnessoverride":"","roomhint":"Woonkamer","name":"Eettafellamp","nora":"ee0cddb4.0c0618","topic":"8","onvalue":"true","onvalueType":"bool","offvalue":"false","offvalueType":"bool","x":770,"y":220,"wires":[["b26b1405.3cd0a"]]},{"id":"29a47fec.b643b8","type":"nora-light","z":"3c92e734.171818","devicename":"Keukenlamp","lightcolor":false,"brightnesscontrol":false,"turnonwhenbrightnesschanges":false,"passthru":false,"statepayload":true,"brightnessoverride":"","roomhint":"Woonkamer","name":"Keukenlamp","nora":"ee0cddb4.0c0618","topic":"9","onvalue":"true","onvalueType":"bool","offvalue":"false","offvalueType":"bool","x":770,"y":300,"wires":[["b26b1405.3cd0a"]]},{"id":"536ac963.3a9dd8","type":"nora-light","z":"3c92e734.171818","devicename":"Slaapkamerlamp","lightcolor":false,"brightnesscontrol":false,"turnonwhenbrightnesschanges":false,"passthru":false,"statepayload":true,"brightnessoverride":"","roomhint":"Slaapkamer","name":"Slaapkamerlamp","nora":"ee0cddb4.0c0618","topic":"10","onvalue":"true","onvalueType":"bool","offvalue":"false","offvalueType":"bool","x":800,"y":420,"wires":[["b26b1405.3cd0a","8a1a9da.bb3cc6"]]},{"id":"8a1a9da.bb3cc6","type":"debug","z":"3c92e734.171818","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1080,"y":460,"wires":[]},{"id":"8f1008e.edf9bf8","type":"debug","z":"3c92e734.171818","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":280,"y":400,"wires":[]},{"id":"bbb8a5f8.078ff","type":"mqtt-broker","z":"","broker":"localhost","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"ee0cddb4.0c0618","type":"nora-config","z":"","name":"nora config","group":""},{"id":"c774ffd3.5056a8","type":"mqtt-broker","broker":"localhost","port":"1883","clientid":""}]
The one connected to slaapkamerlamp says "true".
The one connected to JSON: {"Battery":255,"Color":{"b":182,"cw":0,"g":248,"m":3,"r":255,"t":0,"ww":0},"Level":73,"RSSI":12,"description":"gBridge-Slaapkamerlamp","dtype":"Color Switch","id":"1","idx":10,"name":"Slaapkamerlamp","nvalue":1,"stype":"RGBWW","svalue1":"73","switchType":"Dimmer","unit":4}