Shame you’re in Spain, you’re missing out on all the rain we’re having!
Please don’t go to too much trouble, I am muddling my way through. I managed to write a function to convert part of the msg object into a 1/0, and the flow is working apart from the colour changing mucking things up.
I will attach the flow below but no worries if you don’t get around to looking!
Next I am going to look at the zeRGBa widget and see how that works!
Cheers
[{"id":"37acee0a.bbe3a2","type":"inject","z":"8bb23b43.f1a468","name":"boolean true","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":230,"y":240,"wires":[["5227b36e.42645c"]]},{"id":"f52adcd7.f34c5","type":"inject","z":"8bb23b43.f1a468","name":"boolean false","topic":"","payload":"false","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":230,"y":280,"wires":[["5227b36e.42645c"]]},{"id":"3ab14e07.e86872","type":"debug","z":"8bb23b43.f1a468","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":990,"y":260,"wires":[]},{"id":"5227b36e.42645c","type":"change","z":"8bb23b43.f1a468","name":"Power","rules":[{"t":"move","p":"payload","pt":"msg","to":"payload.power","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":570,"y":260,"wires":[["870e3ede.1062"]]},{"id":"870e3ede.1062","type":"MagicHome","z":"8bb23b43.f1a468","name":"","server":"69d1b800.953898","x":790,"y":260,"wires":[["3ab14e07.e86872","265e4617.a11caa"]]},{"id":"99ff57a2.c2e868","type":"inject","z":"8bb23b43.f1a468","name":"{ \"red\":255, \"green\":255, \"blue\":255 }","topic":"","payload":"{ \"red\":255, \"green\":255, \"blue\":255 }","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":240,"y":400,"wires":[["8af9dad9.d84d58"]]},{"id":"8af9dad9.d84d58","type":"change","z":"8bb23b43.f1a468","name":"Colour","rules":[{"t":"move","p":"payload","pt":"msg","to":"payload.color","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":570,"y":360,"wires":[["870e3ede.1062","be8c2425.526538"]]},{"id":"22d41c78.7b24c4","type":"inject","z":"8bb23b43.f1a468","name":"{ \"red\":255, \"green\":255, \"blue\":0 }","topic":"","payload":"{ \"red\":255, \"green\":255, \"blue\":0 }","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":240,"y":480,"wires":[["8af9dad9.d84d58"]]},{"id":"631ba16e.16c86","type":"inject","z":"8bb23b43.f1a468","name":"{ \"red\":255, \"green\":0, \"blue\":255 }","topic":"","payload":"{ \"red\":255, \"green\":0, \"blue\":255 }","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":240,"y":440,"wires":[["8af9dad9.d84d58"]]},{"id":"be8c2425.526538","type":"debug","z":"8bb23b43.f1a468","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1010,"y":360,"wires":[]},{"id":"850cdafb.3932a8","type":"inject","z":"8bb23b43.f1a468","name":"{ \"red\":255, \"green\":0, \"blue\":0 }","topic":"","payload":"{ \"red\":255, \"green\":0, \"blue\":0 }","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":230,"y":520,"wires":[["8af9dad9.d84d58"]]},{"id":"cc84f1c.cde7b1","type":"blynk-ws-in-write","z":"8bb23b43.f1a468","name":"Write Pin V3","pin":"3","pin_all":0,"client":"2400f3e3.50c3fc","x":110,"y":120,"wires":[["f922489.c6c9ab8"]]},{"id":"f922489.c6c9ab8","type":"change","z":"8bb23b43.f1a468","name":"","rules":[{"t":"change","p":"payload","pt":"msg","from":"1","fromt":"str","to":"true","tot":"bool"},{"t":"change","p":"payload","pt":"msg","from":"0","fromt":"str","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":340,"y":120,"wires":[["5227b36e.42645c"]]},{"id":"265e4617.a11caa","type":"function","z":"8bb23b43.f1a468","name":"Convert to 1/0","func":"//function to convert power on/off to 1 or 0\nvar power;\nvar topic=msg.payload.power;\n\nif (topic==\"on\")\n{\n power=1;\n}\n\nelse\n\n{\n power =0;\n}\n\nmsg.payload=power;\nreturn msg;","outputs":1,"noerr":0,"x":740,"y":120,"wires":[["7945125d.c2c72c","52fe627.109cc9c"]]},{"id":"7945125d.c2c72c","type":"debug","z":"8bb23b43.f1a468","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":980,"y":120,"wires":[]},{"id":"52fe627.109cc9c","type":"blynk-ws-out-write","z":"8bb23b43.f1a468","name":"Write to pin V3","pin":"3","pinmode":0,"client":"2400f3e3.50c3fc","x":1000,"y":60,"wires":[]},{"id":"69d1b800.953898","type":"MagicHome-config","z":"","name":"RGB","host":"192.168.1.215","interval":10},{"id":"2400f3e3.50c3fc","type":"blynk-ws-client","z":"","name":"Blynk (Node Red Test)","path":"wss://blynk-cloud.com/websockets","key":"544bdd5b51684576b02d8a19780d778d","dbg_all":false,"dbg_read":false,"dbg_write":false,"dbg_notify":false,"dbg_mail":false,"dbg_prop":false,"dbg_sync":false,"dbg_bridge":false,"dbg_low":false,"dbg_pins":"","multi_cmd":false,"proxy_type":"no","proxy_url":"","enabled":true}]
The function I wrote to convert msg.payload.power “on” or “off” to 1 or 0:
//function to convert power on/off to 1 or 0
var power;
var topic=msg.payload.power;
if (topic=="on")
{
power=1;
}
else
{
power =0;
}
msg.payload=power;
return msg;