# MagicHome Nodes configure...?

**URL:** <https://discourse.nodered.org/t/magichome-nodes-configure/34102>\
**Category:** General\
**Created:** [11 October 2020 16:33 UTC](https://discourse.nodered.org/t/magichome-nodes-configure/34102 "2020-10-11T16:33:47Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Steinspiel](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steinspiel/32/30095_2.png) [@Steinspiel](https://discourse.nodered.org/u/Steinspiel)\
**Post date:** [11 October 2020 16:33 UTC](https://discourse.nodered.org/t/magichome-nodes-configure/34102/1 "2020-10-11T16:33:47Z")

</div>

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.

 ![](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/3/4364411f4d8d1ef06ec45316d6c609186cd41bc7.png)

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,

```auto
{"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

```auto
{"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"

```auto
{"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"

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

```

 ![](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/9/09baeaf368cf220a7cf27f5568200c6ce8650bfd.png)

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 ...

```auto
[{"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"]]}]

```

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [11 October 2020 16:50 UTC](https://discourse.nodered.org/t/magichome-nodes-configure/34102/2 "2020-10-11T16:50:20Z")

</div>

Which contrib node are you using?

> [@Steinspiel](#):
>
> msg.payload=color {"red":255,"green":0,"blue":0"}  
> return msg;

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

```

---

<div class="post-metadata">

**Author:** ![Steinspiel](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steinspiel/32/30095_2.png) [@Steinspiel](https://discourse.nodered.org/u/Steinspiel)\
**Post date:** [11 October 2020 17:51 UTC](https://discourse.nodered.org/t/magichome-nodes-configure/34102/3 "2020-10-11T17:51:34Z")

</div>

> [@E1cid](#):
>
> Which contrib node are you using?

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

> [@E1cid](#):
>
> `msg.payload...`

Thanks, there are no more error messages.😉

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [11 October 2020 17:57 UTC](https://discourse.nodered.org/t/magichome-nodes-configure/34102/4 "2020-10-11T17:57:49Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Steinspiel](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steinspiel/32/30095_2.png) [@Steinspiel](https://discourse.nodered.org/u/Steinspiel)\
**Post date:** [11 October 2020 18:46 UTC](https://discourse.nodered.org/t/magichome-nodes-configure/34102/5 "2020-10-11T18:46:09Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [11 October 2020 19:22 UTC](https://discourse.nodered.org/t/magichome-nodes-configure/34102/6 "2020-10-11T19:22:29Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Steinspiel](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steinspiel/32/30095_2.png) [@Steinspiel](https://discourse.nodered.org/u/Steinspiel)\
**Post date:** [11 October 2020 19:47 UTC](https://discourse.nodered.org/t/magichome-nodes-configure/34102/7 "2020-10-11T19:47:53Z")

</div>

> [@E1cid](#):
>
> ry 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

 ![](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/e/de9b811c23cad77eb16170cb7f2f388099d59271.png)

```auto
msg.payload.power = "true"
return msg;

```

```auto
msg.payload.power = "false"
return msg;

```

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [11 October 2020 19:50 UTC](https://discourse.nodered.org/t/magichome-nodes-configure/34102/8 "2020-10-11T19:50:52Z")

</div>

```auto
msg.payload.power = true;

```

Or just use a inject node for testing.

```auto
[{"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.

---

<div class="post-metadata">

**Author:** ![Steinspiel](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steinspiel/32/30095_2.png) [@Steinspiel](https://discourse.nodered.org/u/Steinspiel)\
**Post date:** [12 October 2020 14:59 UTC](https://discourse.nodered.org/t/magichome-nodes-configure/34102/9 "2020-10-12T14:59:47Z")

</div>

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

```auto
{"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?

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [12 October 2020 15:19 UTC](https://discourse.nodered.org/t/magichome-nodes-configure/34102/10 "2020-10-12T15:19:33Z")

</div>

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

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

> **[node-red-contrib-magichome-controller](https://flows.nodered.org/node/node-red-contrib-magichome-controller)**
>
> NodeRED node for MagicHome RGB LED controller

  

> **[node-red-contrib-magichome](https://flows.nodered.org/node/node-red-contrib-magichome)**
>
> Magic Home LED controller

---

<div class="post-metadata">

**Author:** ![Steinspiel](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steinspiel/32/30095_2.png) [@Steinspiel](https://discourse.nodered.org/u/Steinspiel)\
**Post date:** [12 October 2020 17:37 UTC](https://discourse.nodered.org/t/magichome-nodes-configure/34102/11 "2020-10-12T17:37:25Z")

</div>

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...

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [11 December 2020 17:37 UTC](https://discourse.nodered.org/t/magichome-nodes-configure/34102/12 "2020-12-11T17:37:31Z")

</div>

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