MagicHome Nodes configure...?

I have RGBWW Wifi Controler from MagicHome. I can control these with the app, GoogleHome and openHAB. That works very well !.

For Node Red I installed "node-red-contrib-magic-home-local" and configured the correct device in each node.

But, only the "on / off" node can be switched ON and goes OFF again after a few seconds.

Debug shows the following:

"on/off" Node,

{"payload":true,"input":{"_msgid":"3b7db03f.35101","topic":"","payload":true},"_msgid":"15789ffa.2b289"}
{"payload":true,"input":{"_msgid":"6d9146b4.b5a1d8","topic":"","payload":false},"_msgid":"44f4fade.7ee104"}

"status", only returns "false" when debugging

{"payload":{"type":4,"on":false,"mode":"color","pattern":null,"speed":90,"color":{"red":255,"green":255,"blue":255},"warm_white":0,"cold_white":0},"input":true,"_msgid":"fdd752e2.51652}
{"payload":{"type":4,"on":false,"mode":"color","pattern":null,"speed":90,"color":{"red":255,"green":255,"blue":255},"warm_white":0,"cold_white":0},"input":false,"_msgid":"da81cf32.e9b0}

"rgb/ww/cw" only "true"

{"payload":true,"input":{"_msgid":"f9fc0a6f.177448","topic":"","payload":true},"_msgid":"5609a756.fc2c58"}
{"payload":true,"input":{"_msgid":"d1363d51.22e59","topic":"","payload":false},"_msgid":"d710e093.7827e"}

"pattern" also just "true"

{"payload":true,"input":{"_msgid":"d41cce3c.5d5ac","topic":"","payload":true},"_msgid":"5ab119a7.83f5a8"}
{"payload":true,"input":{"_msgid":"6dd4f02.8f1aa1","topic":"","payload":false},"_msgid":"c8c863ae.6bc7e"}

My first question: how do I have to switch the nodes so that they switch "true" and "false"?
My second question: how can I change RGB, warm_white and cold_white?

If I use a "function" node, I always get an error message:

"SyntaxError: Unexpected token {"

Content of my "function" node:

msg.payload=color {"red":255,"green":0,"blue":0"}
return msg;

Thanks for reading and have a healthy week ...

[{"id":"8033cc2c.3f8c7","type":"tab","label":"magichome_1","disabled":false,"info":""},{"id":"4bfc8913.ddddf8","type":"inject","z":"8033cc2c.3f8c7","name":"","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":1170,"y":200,"wires":[["a8dc764a.7ca6d8"]]},{"id":"9ea1141d.e14e78","type":"inject","z":"8033cc2c.3f8c7","name":"","topic":"","payload":"false","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":1170,"y":280,"wires":[["a8dc764a.7ca6d8"]]},{"id":"99fbaa25.545938","type":"debug","z":"8033cc2c.3f8c7","name":"on/off IPx89 ","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1530,"y":240,"wires":[]},{"id":"a8dc764a.7ca6d8","type":"magic-home-on","z":"8033cc2c.3f8c7","name":"on/off IPx89 ","device":"192.168.178.89","x":1350,"y":240,"wires":[["99fbaa25.545938"]]},{"id":"b51e86cb.a115d8","type":"magic-home-status","z":"8033cc2c.3f8c7","name":"status IPx89 ","device":"192.168.178.89","x":1350,"y":80,"wires":[["3e21b813.654cd8"]]},{"id":"ed3740de.542cc","type":"inject","z":"8033cc2c.3f8c7","name":"","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":1170,"y":60,"wires":[["b51e86cb.a115d8"]]},{"id":"517f6968.4c3af8","type":"inject","z":"8033cc2c.3f8c7","name":"","topic":"","payload":"false","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":1170,"y":120,"wires":[["b51e86cb.a115d8"]]},{"id":"3e21b813.654cd8","type":"debug","z":"8033cc2c.3f8c7","name":"status IPx89 ","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1530,"y":80,"wires":[]},{"id":"8e7b7cc.b5d248","type":"function","z":"8033cc2c.3f8c7","name":"red","func":"msg.payload=color {\"red\":255,\"green\":0,\"blue\":0\"}\nreturn msg;","outputs":1,"noerr":12,"x":930,"y":260,"wires":[[]]},{"id":"c24f6a37.62a128","type":"magic-home-rgbcw","z":"8033cc2c.3f8c7","name":"rgbww IPx89 ","device":"192.168.178.89","x":1350,"y":400,"wires":[["27e35aba.2b7b56"]]},{"id":"27e35aba.2b7b56","type":"debug","z":"8033cc2c.3f8c7","name":"rgbww IPx89 ","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1530,"y":400,"wires":[]},{"id":"90e8f8b4.c80d98","type":"magic-home-pattern","z":"8033cc2c.3f8c7","name":"pattern IPx89","device":"192.168.178.89","pattern":"purple_gradual_change","speed":"100","x":1350,"y":560,"wires":[["35341585.51c57a"]]},{"id":"73cab779.80b598","type":"inject","z":"8033cc2c.3f8c7","name":"","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":1170,"y":520,"wires":[["90e8f8b4.c80d98"]]},{"id":"84bda5b0.4c78c8","type":"inject","z":"8033cc2c.3f8c7","name":"","topic":"","payload":"false","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":1170,"y":600,"wires":[["90e8f8b4.c80d98"]]},{"id":"35341585.51c57a","type":"debug","z":"8033cc2c.3f8c7","name":"pattern IPx89 ","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1530,"y":560,"wires":[]},{"id":"65028c41.2d3a34","type":"inject","z":"8033cc2c.3f8c7","name":"","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":1170,"y":360,"wires":[["c24f6a37.62a128"]]},{"id":"ae152473.efc998","type":"inject","z":"8033cc2c.3f8c7","name":"","topic":"","payload":"false","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":1170,"y":440,"wires":[["c24f6a37.62a128"]]}]

Which contrib node are you using?

msg.payload.color = {"red":255,"green":0,"blue":0}
return msg;

I use the "node-red-contrib-magic-home-local"
https://flows.nodered.org/node/node-red-contrib-magic-home-local

Thanks, there are no more error messages.:wink:

There is no info on that page , do you have a link to a where you got the payload object examples?

Unfortunately I couldn't find any further information either, hence my problem ...
If you mean my payload examples, they are from my debug node as shown in the screenshot.

Try setting
msg.payload.power to true or "on" for the on/off node

if I understand you correctly, I have switched a "function" node ...
But even with "false" a "true" is sent as payload as you can see in the picture ... Or did I understand that incorrectly?
Thank you

msg.payload.power = "true"
return msg;
msg.payload.power = "false"
return msg;
msg.payload.power = true;

Or just use a inject node for testing.

[{"id":"1bee0cfe.53dbc3","type":"inject","z":"7760f563.ea0324","name":"","props":[{"p":"payload.power","v":"true","vt":"bool"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":200,"y":660,"wires":[["25b822ea.62d8f6"]]}]

Also could you copy the values from the second screenshots top item. and post please.

I have adapted the code of the "function" node. But the result is just as negative as before :frowning:

{"payload":true,"input":{"_msgid":"f593f1b1.a2f0e","topic":"","payload":true},"_msgid":"356c361.d01fdca"}
{"payload":true,"input":{"_msgid":"6718c666.dfbbc8","topic":"","payload":false},"_msgid":"5387cdcf.2ac954"}

I just think the nodes are still in beta and have to be developed!
Do you know another way to use MagicHome LED Stripes in NodeRed?

You could open a issue ticket on github to ask for more info.

There are other magichome nodes, i have not tried them,


Hello,

I have already installed both contrib nodes. The UFO node has no pattern, but switches my LED stripes ...
So I'll use this one first.

Thank you for your help...

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.