Simple JSON input string to LEDs on dash

hello,
taking my first steps into Node-RED, I'm running into what seems a simple problem.

I have an existing home automation system that outputs a JSON string with the status of every light in the house. The output looks like this: { "L1":0,"L2":1,"L3":0,"L4":0 }.....and so on
Using Node-RED dashboard and node-red-contrib-ui-led, I'd like to make a LED for every light and turn green when it's value is 1 and grey for 0.

The node-red-contrib-ui-led seems to have a JSON option for the msg.payload type
So in the "Colors for value of msg.payload" I tried entering "L1" === 1 and enter color "green" ...
But that results in a syntax error.
I'm not sure how the JSON input works for node-red-contrib-ui-led.
Using a debug node, I see that the JSON input string gets well recognized.

Or perhaps I'm using the wrong approach.
I can also alter the output of the system, to CSV for example... should that make it easier.
Just like to keep it short and simple.

Any ideas? thank you in advance

Why not change the 'false' color to grey and send in 'true' and 'false'?

Where do you see that it can handle a json string in msg payload?

If you want to send in a numeric 1 and 0 to turn the led on/off then you need to set msg.payload to numeric 1 or 2 AND in ui_led change the options to look for those types and values

Note one thing, setting the 'off' color to grey will still show a grey haze around the led because you will be displaying a grey light. If no matching value is found the LED reverts back to it's invalid, off state and turns gray and unlit.

Hi zenofmud, thanks for the reply.

You can select JSON from the dropdown menu, on every line:

image

The behaviour of the led works fine with msg.payload type set to "string" or "boolean"
And I been thinking of using that, but then I'm not sure what's a good way to split out my JSON string into boolean values or "1" / "0" strings. I'm hoping the JSON of the LED itself can do this.

Dieter

Well it looks like you can send in json, but the entire json object has to match. i.e. it you send
{ "L1":0,"L2":1,"L3":0,"L4":0 } then that is what needs to be in the node for the color you want.

Sounds like a great request to the author of the node or better yet, you should code up a fix and submit a PR :grin:

Yes it seems so, I tested it too, and the string needs to match exactly for the LED to light up.
That pretty much renders it useless for JSON input :slight_smile:
I'm unable to change the code myself. I'll contact the author.

Any suggestions for a workaround, or other ways to acheive this?
thanks a lot

Can you feed your JSON string into a debug node and show us exactly what the debug node outputs please?

Hi Colin,

this is the input:
{ "L1":0,"L2":1,"L3":0,"L4":0,"L5":0,"L6":0,"L7":0,"L8":0,"L9":0,"L10":0,"L11":0,"L12":0,"L13":0,"L14":0 }

and this is the debug:

The message payload shown in the debug is not a JSON string, it is a javascript object. If you wish to use the L1 value then that is referenced by msg.payload.L1, so if you use a Change node to Move msg.payload.L1 To msg.payload then you can test the payload value directly in the led node.

Here is one way you could do it. set each LED to turn on/off based on a boolean true/false.
Feed your input to a change node that looks like this:
Screen Shot 2020-01-07 at 9.49.27 AM
You will have to have one set for each LED. This will test the item in the object and set msg.ln (n being the number of the led) to true or false. each of these is fed into a change node that will set msg.payload to the value of msg.ln (n being the number of the led) and that is fed to the led.Screen Shot 2020-01-07 at 9.49.37 AM

Here is what the test flow I've attached looks like:


here is the flow:

[{"id":"deac162c.dbbc1","type":"ui_led","z":"129cad76.8cd6cb","group":"c3070762.41f66","order":0,"width":"2","height":"1","label":"","labelPlacement":"left","labelAlignment":"left","colorForValue":[{"color":"grey","value":"false","valueType":"bool"},{"color":"yellow","value":"true","valueType":"bool"}],"allowColorForValueInMessage":false,"name":"","x":790,"y":160,"wires":[]},{"id":"ea90596f.c03f98","type":"ui_led","z":"129cad76.8cd6cb","group":"c3070762.41f66","order":0,"width":"2","height":"1","label":"","labelPlacement":"left","labelAlignment":"left","colorForValue":[{"color":"grey","value":"false","valueType":"bool"},{"color":"green","value":"true","valueType":"bool"}],"allowColorForValueInMessage":false,"name":"","x":790,"y":240,"wires":[]},{"id":"9863156e.4a8638","type":"ui_led","z":"129cad76.8cd6cb","group":"c3070762.41f66","order":0,"width":"2","height":"1","label":"","labelPlacement":"left","labelAlignment":"left","colorForValue":[{"color":"grey","value":"false","valueType":"bool"},{"color":"blue","value":"true","valueType":"bool"}],"allowColorForValueInMessage":false,"name":"","x":790,"y":200,"wires":[]},{"id":"424addf7.a5fb94","type":"inject","z":"129cad76.8cd6cb","name":"","topic":"","payload":"{ \"L1\":0,\"L2\":1,\"L3\":0}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":160,"y":160,"wires":[["61d798c5.730048"]]},{"id":"61d798c5.730048","type":"change","z":"129cad76.8cd6cb","name":"","rules":[{"t":"set","p":"l1","pt":"msg","to":"payload.L1=1","tot":"jsonata"},{"t":"set","p":"l2","pt":"msg","to":"payload.L2=1","tot":"jsonata"},{"t":"set","p":"l3","pt":"msg","to":"payload.L3=1","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":380,"y":200,"wires":[["c26a3c51.9f2638","c27fae78.395ad8","e410d873.70b198"]]},{"id":"c26a3c51.9f2638","type":"change","z":"129cad76.8cd6cb","name":"set l1","rules":[{"t":"set","p":"payload","pt":"msg","to":"l1","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":570,"y":160,"wires":[["deac162c.dbbc1"]]},{"id":"c27fae78.395ad8","type":"change","z":"129cad76.8cd6cb","name":"set l2","rules":[{"t":"set","p":"payload","pt":"msg","to":"l2","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":570,"y":200,"wires":[["9863156e.4a8638"]]},{"id":"e410d873.70b198","type":"change","z":"129cad76.8cd6cb","name":"set l3","rules":[{"t":"set","p":"payload","pt":"msg","to":"l3","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":570,"y":240,"wires":[["ea90596f.c03f98"]]},{"id":"b0b744c6.731878","type":"inject","z":"129cad76.8cd6cb","name":"","topic":"","payload":"{\"L1\":0,\"L2\":0,\"L3\":0}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":160,"y":200,"wires":[["61d798c5.730048"]]},{"id":"5837b7ab.8be3b8","type":"inject","z":"129cad76.8cd6cb","name":"","topic":"","payload":"{ \"L1\":1,\"L2\":1,\"L3\":1}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":160,"y":240,"wires":[["61d798c5.730048"]]},{"id":"c3070762.41f66","type":"ui_group","z":"","name":"Default","tab":"30a1a1f1.1aa7a6","disp":true,"width":"6","collapse":false},{"id":"30a1a1f1.1aa7a6","type":"ui_tab","z":"","name":"Home","icon":"dashboard","disabled":false,"hidden":false}]

thanks Colin .. I'm probaly mixing up JSON & javascript object. Unfortunately the same issue exists with the led in both cases.

zenofmud, THANKS , it works!!!!

What issue? Show us how you have configured the change node and the led node.

hi Colin, I was trying to use the led without a 'change' function,
having the string directly connected to the input of the led.

zenofmud, thanks again for showing me this solution.

I'm just a bit puzzled how it works ...
You mention "This will test the item in the object" ... where is the actual testing done?
I'm only seeing "Set" directives in the change nodes. Shoulnd't I find something like " msg.l1 == 1 set payload.L1=1"

The JSONata expression is going to be evaluated and it will return a true or false (the power of JSONata!!) and then it sets msg.L1 to the result. Because it is returning true/false is why I said to set the led test to true and false.

To clarify further, confusingly the single = in JSONata is equivalent to == in javascript. So the first item in @zenofmud's Change node tests whether msg.payload.L1 is 1 and sets msg.l1 either false or true appropriately.

interesting :slight_smile: ... am I correct to understand it this way:
payload.L1=1 is an evaluation and not an set to 1
I'm used to C or bash, where this would be ==

@colin is right, look at his answer

ah Colin, that's exacly what i was wondering :slight_smile: thanks!

I've actually discovered an easier way to achieve this ....
using a functions with multiple outputs.
This 'splits out' the incoming JSON strings into separate outputs.

the function is like this:
var r1 = {payload: "P47."+(msg.payload.L_slpk3_dressing)};
var r2 = {payload: "H33."+(msg.payload.L_slpk1_wand)};
var r3 = {payload: "P41."+(msg.payload.L_inkom)};
var r4 = {payload: "P21."+(msg.payload.L_garage)};
var r5 = {payload: "P61."+(msg.payload.L_badkamer_douche)};
var r6 = {payload: "P56."+(msg.payload.L_slpk1_lavabo)};
.......
return [r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11,r12,r13,r14,r15,r16,r17,r18,r19,r20,r21,r22,r23,r24,r25,r26,r27,r28];

and the flow:

[{"id":"84347079.797518","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"79b59fcf.7bd228","type":"udp in","z":"84347079.797518","name":"lighthub","iface":"192.168.1.9","port":"51180","ipv":"udp4","multicast":"true","group":"224.1.1.3","datatype":"utf8","x":70,"y":760,"wires":[["fb0793a0.431018"]]},{"id":"b9d5f979.051098","type":"udp out","z":"84347079.797518","name":"","addr":"224.0.0.1","iface":"eth0","port":"5556","ipv":"udp4","outport":"","base64":false,"multicast":"multi","x":1100,"y":900,"wires":[]},{"id":"e9f7254d.bb5af8","type":"ui_switch","z":"84347079.797518","name":"slpk3_dressing","label":"slpk3_dressing","tooltip":"","group":"b0f2271e.a7b688","order":8,"width":0,"height":0,"passthru":false,"decouple":"true","topic":"","style":"","onvalue":"P47.1","onvalueType":"str","onicon":"","oncolor":"","offvalue":"P47.0","offvalueType":"str","officon":"","offcolor":"","x":560,"y":60,"wires":[["f4c1a4e0.bb1898"]]},{"id":"f4c1a4e0.bb1898","type":"function","z":"84347079.797518","name":"trim","func":"msg.payload = msg.payload.slice(0,-2);\nreturn msg;","outputs":1,"noerr":0,"x":1050,"y":780,"wires":[["b9d5f979.051098"]]},{"id":"ce270d74.471048","type":"function","z":"84347079.797518","name":"","func":"var r1 = {payload: \"P47.\"+(msg.payload.L_slpk3_dressing)};\nvar r2 = {payload: \"H33.\"+(msg.payload.L_slpk1_wand)};\nvar r3 = {payload: \"P41.\"+(msg.payload.L_inkom)};\nvar r4 = {payload: \"P21.\"+(msg.payload.L_garage)};\nvar r5 = {payload: \"P61.\"+(msg.payload.L_badkamer_douche)};\nvar r6 = {payload: \"P56.\"+(msg.payload.L_slpk1_lavabo)};\nvar r7 = {payload: \"P54.\"+(msg.payload.L_slpk1_dressing)};\nvar r8 = {payload: \"H5.\"+(msg.payload.L_terras)};\nvar r9 = {payload: \"P24.\"+(msg.payload.L_vide)};\nvar r10 = {payload: \"P0.\"+(msg.payload.L_keuken_fornuis)};\nvar r11 = {payload: \"P39.\"+(msg.payload.L_wc_boven)};\nvar r12 = {payload: \"Pxx.\"+(msg.payload.L_tuin)};\nvar r13 = {payload: \"P1.\"+(msg.payload.L_keuken_eiland)};\nvar r14 = {payload: \"P20.\"+(msg.payload.L_voordeur)};\nvar r15 = {payload: \"P34.\"+(msg.payload.L_slpk1_centraal)};\nvar r16 = {payload: \"P62.\"+(msg.payload.L_badkamer_lavabo)};\nvar r17 = {payload: \"P4.\"+(msg.payload.L_keuken_wand)};\nvar r18 = {payload: \"P13.\"+(msg.payload.L_keuken_tafel)};\nvar r19 = {payload: \"P2.\"+(msg.payload.L_berging)};\nvar r20 = {payload: \"P43.\"+(msg.payload.L_buro)};\nvar r21 = {payload: \"P32.\"+(msg.payload.L_balkon)};\nvar r22 = {payload: \"P38.\"+(msg.payload.L_slpk2_centraal)};\nvar r23 = {payload: \"P40.\"+(msg.payload.L_gang)};\nvar r24 = {payload: \"P15.\"+(msg.payload.L_wc_beneden)};\nvar r25 = {payload: \"P6.\"+(msg.payload.L_wasruimte)};\nvar r26 = {payload: \"P37.\"+(msg.payload.L_slpk2_dressing)};\nvar r27 = {payload: \"P49.\"+(msg.payload.L_slpk3_centraal)};\nvar r28 = {payload: \"N70.\"+(msg.payload.L_zijdeur)};\nreturn [r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11,r12,r13,r14,r15,r16,r17,r18,r19,r20,r21,r22,r23,r24,r25,r26,r27,r28];\n","outputs":28,"noerr":0,"x":250,"y":860,"wires":[["e9f7254d.bb5af8"],["944a9868.81072"],["85fe4e17.cb3508"],["1dd89db1.ae18ca"],["8c5d83eb.f64c8"],["7b3646a2.dd1b8"],["3e76348.14e0dcc"],["38aada1b.ce7166"],["d8190d98.e9d57"],["afc2bef2.b6c488"],["294b1189.68b54e"],["726f3e71.1fd318"],["7c1abf92.1128c"],["6803f7f0.9d0ee"],["a1f6ae46.cbee8"],["412e93ae.61870c"],["fe92e084.89cf4"],["e9806cfe.273f7"],["ab5797ab.25c8d"],["3ba72542.58241a"],["430b5897.ff6d7"],["e7b9e5a9.8c2448"],["195ff11b.d102ef"],["4b436cbb.e8e2d4"],["ffcb0d06.a137e8"],["d1f2a763.8f37e"],["589120af.2bac88"],["3333ec92.813fc4"]]},{"id":"fb0793a0.431018","type":"json","z":"84347079.797518","name":"","property":"payload","action":"","pretty":false,"x":90,"y":900,"wires":[["ce270d74.471048","ce7ba8ee.744ca"]]},{"id":"944a9868.81072","type":"ui_switch","z":"84347079.797518","name":"slpk1_wand","label":"slpk1_wand","tooltip":"","group":"b0f2271e.a7b688","order":3,"width":0,"height":0,"passthru":false,"decouple":"true","topic":"","style":"","onvalue":"H33.1","onvalueType":"str","onicon":"","oncolor":"","offvalue":"H33.0","offvalueType":"str","officon":"","offcolor":"","x":550,"y":120,"wires":[["f4c1a4e0.bb1898"]]},{"id":"85fe4e17.cb3508","type":"ui_switch","z":"84347079.797518","name":"inkom","label":"inkom","tooltip":"","group":"b8c899b6.e17a4","order":13,"width":0,"height":0,"passthru":false,"decouple":"true","topic":"","style":"","onvalue":"P41.1","onvalueType":"str","onicon":"","oncolor":"","offvalue":"P41.0","offvalueType":"str","officon":"","offcolor":"","x":530,"y":180,"wires":[["f4c1a4e0.bb1898"]]},{"id":"1dd89db1.ae18ca","type":"ui_switch","z":"84347079.797518","name":"garage","label":"garage","tooltip":"","group":"b8c899b6.e17a4","order":1,"width":0,"height":0,"passthru":false,"decouple":"true","topic":"","style":"","onvalue":"P21.1","onvalueType":"str","onicon":"","oncolor":"","offvalue":"P21.0","offvalueType":"str","officon":"","offcolor":"","x":540,"y":240,"wires":[["f4c1a4e0.bb1898"]]},{"id":"8c5d83eb.f64c8","type":"ui_switch","z":"84347079.797518","name":"badkamer_douche","label":"badkamer_douche","tooltip":"","group":"b0f2271e.a7b688","order":10,"width":0,"height":0,"passthru":false,"decouple":"true","topic":"","style":"","onvalue":"P61.1","onvalueType":"str","onicon":"","oncolor":"","offvalue":"P61.0","offvalueType":"str","officon":"","offcolor":"","x":570,"y":300,"wires":[["f4c1a4e0.bb1898"]]},{"id":"7b3646a2.dd1b8","type":"ui_switch","z":"84347079.797518","name":"slpk1_lavabo","label":"slpk1_lavabo","tooltip":"","group":"b0f2271e.a7b688","order":4,"width":0,"height":0,"passthru":false,"decouple":"true","topic":"","style":"","onvalue":"P56.1","onvalueType":"str","onicon":"","oncolor":"","offvalue":"P56.0","offvalueType":"str","officon":"","offcolor":"","x":550,"y":360,"wires":[["f4c1a4e0.bb1898"]]},{"id":"3e76348.14e0dcc","type":"ui_switch","z":"84347079.797518","name":"slpk1_dressing","label":"slpk1_dressing","tooltip":"","group":"b0f2271e.a7b688","order":2,"width":0,"height":0,"passthru":false,"decouple":"true","topic":"","style":"","onvalue":"P54.1","onvalueType":"str","onicon":"","oncolor":"","offvalue":"P54.0","offvalueType":"str","officon":"","offcolor":"","x":560,"y":420,"wires":[["f4c1a4e0.bb1898"]]},{"id":"38aada1b.ce7166","type":"ui_switch","z":"84347079.797518","name":"terras","label":"terras","tooltip":"","group":"b8c899b6.e17a4","order":9,"width":0,"height":0,"passthru":false,"decouple":"true","topic":"","style":"","onvalue":"H5.1","onvalueType":"str","onicon":"","oncolor":"","offvalue":"H5.0","offvalueType":"str","officon":"","offcolor":"","x":530,"y":480,"wires":[["f4c1a4e0.bb1898"]]},{"id":"d8190d98.e9d57","type":"ui_switch","z":"84347079.797518","name":"vide","label":"vide","tooltip":"","group":"b8c899b6.e17a4","order":8,"width":0,"height":0,"passthru":false,"decouple":"true","topic":"","style":"","onvalue":"P24.1","onvalueType":"str","onicon":"","oncolor":"","offvalue":"P24.0","offvalueType":"str","officon":"","offcolor":"","x":530,"y":540,"wires":[["f4c1a4e0.bb1898"]]},{"id":"afc2bef2.b6c488","type":"ui_switch","z":"84347079.797518","name":"keuken_fornuis","label":"keuken_fornuis","tooltip":"","group":"b8c899b6.e17a4","order":3,"width":0,"height":0,"passthru":false,"decouple":"true","topic":"","style":"","onvalue":"P0.1","onvalueType":"str","onicon":"","oncolor":"","offvalue":"P0.0","offvalueType":"str","officon":"","offcolor":"","x":560,"y":600,"wires":[["f4c1a4e0.bb1898"]]},{"id":"294b1189.68b54e","type":"ui_switch","z":"84347079.797518","name":"wc_boven","label":"wc_boven","tooltip":"","group":"b0f2271e.a7b688","order":11,"width":0,"height":0,"passthru":false,"decouple":"true","topic":"","style":"","onvalue":"P39.1","onvalueType":"str","onicon":"","oncolor":"","offvalue":"P39.0","offvalueType":"str","officon":"","offcolor":"","x":540,"y":660,"wires":[["f4c1a4e0.bb1898"]]},{"id":"726f3e71.1fd318","type":"ui_switch","z":"84347079.797518","name":"tuin","label":"tuin","tooltip":"","group":"b8c899b6.e17a4","order":10,"width":0,"height":0,"passthru":false,"decouple":"true","topic":"","style":"","onvalue":"Pxx.1","onvalueType":"str","onicon":"","oncolor":"","offvalue":"Pxx.0","offvalueType":"str","officon":"","offcolor":"","x":530,"y":720,"wires":[["f4c1a4e0.bb1898"]]},{"id":"7c1abf92.1128c","type":"ui_switch","z":"84347079.797518","name":"keuken_eiland","label":"keuken_eiland","tooltip":"","group":"b8c899b6.e17a4","order":4,"width":0,"height":0,"passthru":false,"decouple":"true","topic":"","style":"","onvalue":"P1.1","onvalueType":"str","onicon":"","oncolor":"","offvalue":"P1.0","offvalueType":"str","officon":"","offcolor":"","x":560,"y":780,"wires":[["f4c1a4e0.bb1898"]]},{"id":"6803f7f0.9d0ee","type":"ui_switch","z":"84347079.797518","name":"voordeur","label":"voordeur","tooltip":"","group":"b8c899b6.e17a4","order":11,"width":0,"height":0,"passthru":false,"decouple":"true","topic":"","style":"","onvalue":"P20.1","onvalueType":"str","onicon":"","oncolor":"","offvalue":"P20.0","offvalueType":"str","officon":"","offcolor":"","x":540,"y":840,"wires":[["f4c1a4e0.bb1898"]]},{"id":"a1f6ae46.cbee8","type":"ui_switch","z":"84347079.797518","name":"slpk1_centraal","label":"slpk1_centraal","tooltip":"","group":"b0f2271e.a7b688","order":1,"width":0,"height":0,"passthru":false,"decouple":"true","topic":"","style":"","onvalue":"P34.1","onvalueType":"str","onicon":"","oncolor":"","offvalue":"P34.0","offvalueType":"str","officon":"","offcolor":"","x":560,"y":900,"wires":[["f4c1a4e0.bb1898"]]},{"id":"412e93ae.61870c","type":"ui_switch","z":"84347079.797518","name":"badkamer_lavabo","label":"badkamer_lavabo","tooltip":"","group":"b0f2271e.a7b688","order":9,"width":0,"height":0,"passthru":false,"decouple":"true","topic":"","style":"","onvalue":"P62.1","onvalueType":"str","onicon":"","oncolor":"","offvalue":"P62.0","offvalueType":"str","officon":"","offcolor":"","x":570,"y":960,"wires":[["f4c1a4e0.bb1898"]]},{"id":"fe92e084.89cf4","type":"ui_switch","z":"84347079.797518","name":"keuken_wand","label":"keuken_wand","tooltip":"","group":"b8c899b6.e17a4","order":6,"width":0,"height":0,"passthru":false,"decouple":"true","topic":"","style":"","onvalue":"P4.1","onvalueType":"str","onicon":"","oncolor":"","offvalue":"P4.0","offvalueType":"str","officon":"","offcolor":"","x":560,"y":1020,"wires":[["f4c1a4e0.bb1898"]]},{"id":"e9806cfe.273f7","type":"ui_switch","z":"84347079.797518","name":"keuken_tafel","label":"keuken_tafel","tooltip":"","group":"b8c899b6.e17a4","order":5,"width":0,"height":0,"passthru":false,"decouple":"true","topic":"","style":"","onvalue":"P13.1","onvalueType":"str","onicon":"","oncolor":"","offvalue":"P13.0","offvalueType":"str","officon":"","offcolor":"","x":550,"y":1080,"wires":[["f4c1a4e0.bb1898"]]},{"id":"ab5797ab.25c8d","type":"ui_switch","z":"84347079.797518","name":"berging","label":"berging","tooltip":"","group":"b8c899b6.e17a4","order":7,"width":0,"height":0,"passthru":false,"decouple":"true","topic":"","style":"","onvalue":"P2.1","onvalueType":"str","onicon":"","oncolor":"","offvalue":"P2.0","offvalueType":"str","officon":"","offcolor":"","x":540,"y":1140,"wires":[["f4c1a4e0.bb1898"]]},{"id":"3ba72542.58241a","type":"ui_switch","z":"84347079.797518","name":"buro","label":"buro","tooltip":"","group":"b0f2271e.a7b688","order":12,"width":0,"height":0,"passthru":false,"decouple":"true","topic":"","style":"","onvalue":"P43.1","onvalueType":"str","onicon":"","oncolor":"","offvalue":"P43.0","offvalueType":"str","officon":"","offcolor":"","x":530,"y":1200,"wires":[["f4c1a4e0.bb1898"]]},{"id":"430b5897.ff6d7","type":"ui_switch","z":"84347079.797518","name":"balkon","label":"balkon","tooltip":"","group":"b0f2271e.a7b688","order":13,"width":0,"height":0,"passthru":false,"decouple":"true","topic":"","style":"","onvalue":"P32.1","onvalueType":"str","onicon":"","oncolor":"","offvalue":"P32.0","offvalueType":"str","officon":"","offcolor":"","x":530,"y":1260,"wires":[["f4c1a4e0.bb1898"]]},{"id":"e7b9e5a9.8c2448","type":"ui_switch","z":"84347079.797518","name":"slpk2_centraal","label":"slpk2_centraal","tooltip":"","group":"b0f2271e.a7b688","order":5,"width":0,"height":0,"passthru":false,"decouple":"true","topic":"","style":"","onvalue":"P38.1","onvalueType":"str","onicon":"","oncolor":"","offvalue":"P38.0","offvalueType":"str","officon":"","offcolor":"","x":560,"y":1320,"wires":[["f4c1a4e0.bb1898"]]},{"id":"195ff11b.d102ef","type":"ui_switch","z":"84347079.797518","name":"gang","label":"gang","tooltip":"","group":"b0f2271e.a7b688","order":14,"width":0,"height":0,"passthru":false,"decouple":"true","topic":"","style":"","onvalue":"P40.1","onvalueType":"str","onicon":"","oncolor":"","offvalue":"P40.0","offvalueType":"str","officon":"","offcolor":"","x":530,"y":1380,"wires":[["f4c1a4e0.bb1898"]]},{"id":"4b436cbb.e8e2d4","type":"ui_switch","z":"84347079.797518","name":"wc_beneden","label":"wc_beneden","tooltip":"","group":"b8c899b6.e17a4","order":12,"width":0,"height":0,"passthru":false,"decouple":"true","topic":"","style":"","onvalue":"P15.1","onvalueType":"str","onicon":"","oncolor":"","offvalue":"P15.0","offvalueType":"str","officon":"","offcolor":"","x":550,"y":1440,"wires":[["f4c1a4e0.bb1898"]]},{"id":"ce7ba8ee.744ca","type":"debug","z":"84347079.797518","name":"lighthub","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":100,"y":1020,"wires":[]},{"id":"ffcb0d06.a137e8","type":"ui_switch","z":"84347079.797518","name":"wasruimte","label":"wasruimte","tooltip":"","group":"b8c899b6.e17a4","order":2,"width":0,"height":0,"passthru":false,"decouple":"true","topic":"","style":"","onvalue":"P6.1","onvalueType":"str","onicon":"","oncolor":"","offvalue":"P6.0","offvalueType":"str","officon":"","offcolor":"","x":540,"y":1500,"wires":[["f4c1a4e0.bb1898"]]},{"id":"d1f2a763.8f37e","type":"ui_switch","z":"84347079.797518","name":"slpk2_dressing","label":"slpk2_dressing","tooltip":"","group":"b0f2271e.a7b688","order":6,"width":0,"height":0,"passthru":false,"decouple":"true","topic":"","style":"","onvalue":"P37.1","onvalueType":"str","onicon":"","oncolor":"","offvalue":"P37.0","offvalueType":"str","officon":"","offcolor":"","x":560,"y":1560,"wires":[["f4c1a4e0.bb1898"]]},{"id":"589120af.2bac88","type":"ui_switch","z":"84347079.797518","name":"slpk3_centraal","label":"slpk3_centraal","tooltip":"","group":"b0f2271e.a7b688","order":7,"width":0,"height":0,"passthru":false,"decouple":"true","topic":"","style":"","onvalue":"P49.1","onvalueType":"str","onicon":"","oncolor":"","offvalue":"P49.0","offvalueType":"str","officon":"","offcolor":"","x":560,"y":1620,"wires":[["f4c1a4e0.bb1898"]]},{"id":"3333ec92.813fc4","type":"ui_switch","z":"84347079.797518","name":"zijdeur","label":"zijdeur","tooltip":"","group":"b8c899b6.e17a4","order":15,"width":0,"height":0,"passthru":false,"decouple":"true","topic":"","style":"","onvalue":"N70.1","onvalueType":"str","onicon":"","oncolor":"","offvalue":"N70.0","offvalueType":"str","officon":"","offcolor":"","x":530,"y":1680,"wires":[["f4c1a4e0.bb1898"]]},{"id":"130ba99e.809b66","type":"ui_button","z":"84347079.797518","name":"all_off","group":"3ff9c068.24f268","order":0,"width":0,"height":0,"passthru":false,"label":"all off","tooltip":"","color":"","bgcolor":"","icon":"","payload":"H20","payloadType":"str","topic":"","x":950,"y":1100,"wires":[["b9d5f979.051098"]]},{"id":"b0f2271e.a7b688","type":"ui_group","z":"","name":"boven","tab":"1edf33c5.a44e14","order":2,"disp":true,"width":"6","collapse":false},{"id":"b8c899b6.e17a4","type":"ui_group","z":"","name":"beneden","tab":"1edf33c5.a44e14","order":1,"disp":true,"width":"6","collapse":false},{"id":"3ff9c068.24f268","type":"ui_group","z":"","name":"functies","tab":"1edf33c5.a44e14","disp":true,"width":"6","collapse":false},{"id":"1edf33c5.a44e14","type":"ui_tab","z":"","name":"verlichting","icon":"dashboard","disabled":false,"hidden":false}]

inspired by this post " Using switch node to show actual state "