# Dashboard Switch for status and control

**URL:** <https://discourse.nodered.org/t/dashboard-switch-for-status-and-control/39703>\
**Category:** Dashboard\
**Created:** [25 January 2021 10:36 UTC](https://discourse.nodered.org/t/dashboard-switch-for-status-and-control/39703 "2021-01-25T10:36:29Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![molt](https://avatars.discourse-cdn.com/v4/letter/m/51bf81/32.png) [@molt](https://discourse.nodered.org/u/molt)\
**Post date:** [25 January 2021 10:36 UTC](https://discourse.nodered.org/t/dashboard-switch-for-status-and-control/39703/1 "2021-01-25T10:36:29Z")

</div>

Hi,

this is my first try to implement sth. with node-red.  
I´ve installed node-red-contrib-deconz and node-red-dashboard - they´re both up and running.

The switch should show me the actual state of the light (on or off) and i want also to be able to change the status of the switch (which controls the light).  
But the switch sends the value direct to the light so i can not manual change the light from the switch on the Dashboard-UI.

 ![node-red-switch](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/b/7bc83547d9110b099a89f07f55cc6f8b1b162627.jpeg)

I hope someone knows what ive tried to explain in my bad english _lol_

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [25 January 2021 11:40 UTC](https://discourse.nodered.org/t/dashboard-switch-for-status-and-control/39703/2 "2021-01-25T11:40:10Z")

</div>

Welcome to the forum @molt

> [@molt](#):
>
> the switch sends the value direct to the light so i can not manual change the light from the switch on the Dashboard-UI.

Do you mean that the output from the switch is not the correct output to drive the light node? If so then you can use a Change or Function node to set it to the right value.  
Make sure that you have _not_ selected message pass through in the switch or you will get an infinite loop.

Edit: or change the configuration of the Switch node to send the correct output, then adjust the function on in the input of the switch to also use those values

---

<div class="post-metadata">

**Author:** ![molt](https://avatars.discourse-cdn.com/v4/letter/m/51bf81/32.png) [@molt](https://discourse.nodered.org/u/molt)\
**Post date:** [25 January 2021 12:39 UTC](https://discourse.nodered.org/t/dashboard-switch-for-status-and-control/39703/3 "2021-01-25T12:39:06Z")

</div>

Hey @Colin,  
thanks for your fast reply!

Let me try to explain what ive done so far.

1. The "light-node" gives me a true or false (boolean) for the object "on"
2. The "change-node" search the boolean "true" and replaces it with a string "true"
3. The function is:  
if (msg.payload.on == "true"){  
msg.payload = "true";  
}  
else {  
msg.payload = "false";  
}
4. the "switch\_light" is now true or false and gives the parameter to the last node to turn the light on or off

Now my challange: If i switch the light by using the switch in the ui it will be overwritten by the intput from the "light-node"

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [25 January 2021 13:35 UTC](https://discourse.nodered.org/t/dashboard-switch-for-status-and-control/39703/4 "2021-01-25T13:35:45Z")

</div>

Please export your flow (select the nodes and select Export in the menus) and paste it here. When pasting use the `</>` button at the top of the forum entry window.  
Also tell us what values you have to send to the light to control it.

---

<div class="post-metadata">

**Author:** ![molt](https://avatars.discourse-cdn.com/v4/letter/m/51bf81/32.png) [@molt](https://discourse.nodered.org/u/molt)\
**Post date:** [25 January 2021 14:15 UTC](https://discourse.nodered.org/t/dashboard-switch-for-status-and-control/39703/5 "2021-01-25T14:15:03Z")

</div>

To control the light i have to send the value from object "on"

```auto
msg.payload : Object
object
alert: "none"
bri: 254
colormode: "ct"
ct: 370
on: true
reachable: true

```

```auto
[
    {
        "id": "29255051.dc251",
        "type": "tab",
        "label": "Dashboard UI",
        "disabled": false,
        "info": ""
    },
    {
        "id": "66bf7b9a.ab07b4",
        "type": "ui_switch",
        "z": "29255051.dc251",
        "name": "",
        "label": "switch_light",
        "tooltip": "",
        "group": "b45673d4.b5364",
        "order": 0,
        "width": 0,
        "height": 0,
        "passthru": true,
        "decouple": "false",
        "topic": "",
        "style": "",
        "onvalue": "true",
        "onvalueType": "str",
        "onicon": "",
        "oncolor": "",
        "offvalue": "false",
        "offvalueType": "str",
        "officon": "",
        "offcolor": "",
        "x": 870,
        "y": 160,
        "wires": [
            [
                "edb65647.889838"
            ]
        ]
    },
    {
        "id": "ab8fa445.09ab18",
        "type": "function",
        "z": "29255051.dc251",
        "name": "",
        "func": "if (msg.payload.on == \"true\"){\nmsg.payload = \"true\";\n}\nelse {\nmsg.payload = \"false\";\n}\nreturn msg;\n",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "x": 700,
        "y": 160,
        "wires": [
            [
                "66bf7b9a.ab07b4"
            ]
        ]
    },
    {
        "id": "5a309341.18881c",
        "type": "change",
        "z": "29255051.dc251",
        "name": "",
        "rules": [
            {
                "t": "change",
                "p": "payload.on",
                "pt": "msg",
                "from": "true",
                "fromt": "bool",
                "to": "true",
                "tot": "str"
            },
            {
                "t": "change",
                "p": "payload.false",
                "pt": "msg",
                "from": "false",
                "fromt": "bool",
                "to": "false",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 500,
        "y": 160,
        "wires": [
            [
                "ab8fa445.09ab18"
            ]
        ]
    },
    {
        "id": "d56e2d4b.d5343",
        "type": "deconz-input",
        "z": "29255051.dc251",
        "name": "",
        "server": "c4ace8e0.769aa8",
        "device": "7c:b0:3e:aa:00:ad:86:ee-03",
        "device_name": "Badezimmer-Decke : Color temperature light",
        "topic": "",
        "state": "0",
        "output": "always",
        "outputAtStartup": true,
        "x": 190,
        "y": 160,
        "wires": [
            [
                "5a309341.18881c"
            ],
            []
        ]
    },
    {
        "id": "edb65647.889838",
        "type": "deconz-output",
        "z": "29255051.dc251",
        "name": "",
        "server": "c4ace8e0.769aa8",
        "device": "7c:b0:3e:aa:00:ad:86:ee-03",
        "device_name": "Badezimmer-Decke : Color temperature light",
        "command": "on",
        "commandType": "deconz_cmd",
        "payload": "payload",
        "payloadType": "msg",
        "transitionTime": "",
        "x": 1170,
        "y": 160,
        "wires": []
    },
    {
        "id": "b45673d4.b5364",
        "type": "ui_group",
        "name": "Standard",
        "tab": "7874e5cb.93b9ec",
        "order": 1,
        "disp": true,
        "width": "6",
        "collapse": false
    },
    {
        "id": "c4ace8e0.769aa8",
        "type": "deconz-server",
        "name": "deconz",
        "ip": "192.168.1.75",
        "port": "80",
        "apikey": "1A32BAACC0",
        "ws_port": "443",
        "secure": false,
        "polling": "15"
    },
    {
        "id": "7874e5cb.93b9ec",
        "type": "ui_tab",
        "name": "Home",
        "icon": "dashboard",
        "disabled": false,
        "hidden": false
    }
]

```

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [25 January 2021 14:55 UTC](https://discourse.nodered.org/t/dashboard-switch-for-status-and-control/39703/6 "2021-01-25T14:55:39Z")

</div>

> [@molt](#):
>
> ```auto
> msg.payload : Object
> object
> alert: "none"
> bri: 254
> colormode: "ct"
> ct: 370
> on: true
> reachable: true
> 
> ```

Do you mean you have to send that whole structure? If so then see if this controls the light (note, I have changed the switch config so use this one not the one you currently have). Don't connect anything to the input yet.

**[edit]** Forgot the flow, here it is, hopefully

```auto
[{"id":"66bf7b9a.ab07b4","type":"ui_switch","z":"29255051.dc251","name":"","label":"switch_light","tooltip":"","group":"b45673d4.b5364","order":0,"width":0,"height":0,"passthru":false,"decouple":"false","topic":"","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":870,"y":160,"wires":[["bde16114.37d62"]]},{"id":"bde16114.37d62","type":"function","z":"29255051.dc251","name":"","func":"msg.payload = {\n alert: \"none\",\n bri: 254,\n colormode: \"ct\",\n ct: 370,\n on: msg.payload,\n reachable: true,\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1050,"y":160,"wires":[["953eb27a.de8a98"]]},{"id":"953eb27a.de8a98","type":"debug","z":"29255051.dc251","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1230,"y":120,"wires":[]},{"id":"b45673d4.b5364","type":"ui_group","name":"Standard","tab":"7874e5cb.93b9ec","order":1,"disp":true,"width":"6","collapse":false},{"id":"7874e5cb.93b9ec","type":"ui_tab","name":"Home","icon":"dashboard","disabled":false,"hidden":false}]

```

---

<div class="post-metadata">

**Author:** ![molt](https://avatars.discourse-cdn.com/v4/letter/m/51bf81/32.png) [@molt](https://discourse.nodered.org/u/molt)\
**Post date:** [25 January 2021 16:20 UTC](https://discourse.nodered.org/t/dashboard-switch-for-status-and-control/39703/7 "2021-01-25T16:20:36Z")

</div>

Maybe you missunderstood me or im too stupid to explain it with english skills.

The switch is working properly. I can turn the lights on and off with the switch.  
What i want is that the switch is showing the status of the light and additionally that i am able to turn the lights on and off with the switch.  
But currently thats not possible because the switch is getting the message from the first light-node and is automatically using this value to control the light.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [25 January 2021 16:37 UTC](https://discourse.nodered.org/t/dashboard-switch-for-status-and-control/39703/8 "2021-01-25T16:37:57Z")

</div>

> [@molt](#):
>
> Maybe you missunderstood me

Well I asked what you have to send to the light to control it and you showed me a data structure with `on: true` in it which appeared to mean that you need to send that to control it. If the existing flow does control the light then it seems you have to send just strings "true" or "false".  
If so then your original flow should work if you do what I originally suggested, which is to set the switch to Not pass messages through and to Show state of the input. Then when you click the switch it should send the required state to control the light. The switch will not visually change, however, until the input comes in with the new state.  
If that doesn't work add a debug node showing what is coming out of the switch and what is going into it. Give the debug nodes names so it is clear which is which. Also post the new flow.

---

<div class="post-metadata">

**Author:** ![molt](https://avatars.discourse-cdn.com/v4/letter/m/51bf81/32.png) [@molt](https://discourse.nodered.org/u/molt)\
**Post date:** [25 January 2021 17:59 UTC](https://discourse.nodered.org/t/dashboard-switch-for-status-and-control/39703/9 "2021-01-25T17:59:03Z")

</div>

Thanks for your patience @Colin !  
I´ve uploaded a video to demonstrate you what ive tried to explain.  
Everything is working except the "turn off light" by the switch command.

[![](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/8/a8f5796de2c39503d09cf1c3f6ca87f15cded3d1.jpeg "Node Red Dashboard - Switch with Deconz Light") ](https://www.youtube.com/watch?v=wlfOgfhk7AQ)

```auto
[
    {
        "id": "29255051.dc251",
        "type": "tab",
        "label": "Dashboard UI",
        "disabled": false,
        "info": ""
    },
    {
        "id": "66bf7b9a.ab07b4",
        "type": "ui_switch",
        "z": "29255051.dc251",
        "name": "",
        "label": "switch_light",
        "tooltip": "",
        "group": "b45673d4.b5364",
        "order": 0,
        "width": 0,
        "height": 0,
        "passthru": false,
        "decouple": "true",
        "topic": "",
        "style": "",
        "onvalue": "true",
        "onvalueType": "str",
        "onicon": "",
        "oncolor": "",
        "offvalue": "false",
        "offvalueType": "str",
        "officon": "",
        "offcolor": "",
        "x": 890,
        "y": 160,
        "wires": [
            [
                "168163dc.c083dc",
                "edb65647.889838"
            ]
        ]
    },
    {
        "id": "5a309341.18881c",
        "type": "change",
        "z": "29255051.dc251",
        "name": "",
        "rules": [
            {
                "t": "change",
                "p": "payload.on",
                "pt": "msg",
                "from": "true",
                "fromt": "bool",
                "to": "true",
                "tot": "str"
            },
            {
                "t": "change",
                "p": "payload.on",
                "pt": "msg",
                "from": "false",
                "fromt": "bool",
                "to": "false",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 500,
        "y": 160,
        "wires": [
            [
                "6ff2a14d.f12a5"
            ]
        ]
    },
    {
        "id": "d56e2d4b.d5343",
        "type": "deconz-input",
        "z": "29255051.dc251",
        "name": "",
        "server": "c4ace8e0.769aa8",
        "device": "7c:b0:3e:aa:00:ad:86:ee-03",
        "device_name": "Badezimmer-Decke : Color temperature light",
        "topic": "",
        "state": "0",
        "output": "always",
        "outputAtStartup": true,
        "x": 190,
        "y": 160,
        "wires": [
            [
                "5a309341.18881c"
            ],
            []
        ]
    },
    {
        "id": "edb65647.889838",
        "type": "deconz-output",
        "z": "29255051.dc251",
        "name": "",
        "server": "c4ace8e0.769aa8",
        "device": "7c:b0:3e:aa:00:ad:86:ee-03",
        "device_name": "Badezimmer-Decke : Color temperature light",
        "command": "on",
        "commandType": "deconz_cmd",
        "payload": "payload",
        "payloadType": "str",
        "transitionTime": "",
        "x": 1230,
        "y": 160,
        "wires": []
    },
    {
        "id": "168163dc.c083dc",
        "type": "function",
        "z": "29255051.dc251",
        "name": "",
        "func": "if (msg.payload == \"false\"){\nmsg.payload = \"false\";\n}\nelse {\nmsg.payload = \"true\";\n}\nreturn msg;\n",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "x": 900,
        "y": 340,
        "wires": [
            [
                "66bf7b9a.ab07b4"
            ]
        ]
    },
    {
        "id": "6ff2a14d.f12a5",
        "type": "function",
        "z": "29255051.dc251",
        "name": "",
        "func": "if (msg.payload.on == \"true\"){\nmsg.payload = \"true\";\n}\nelse {\nmsg.payload = \"false\";\n}\nreturn msg;\n",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "x": 700,
        "y": 160,
        "wires": [
            [
                "66bf7b9a.ab07b4"
            ]
        ]
    },
    {
        "id": "b45673d4.b5364",
        "type": "ui_group",
        "name": "Standard",
        "tab": "7874e5cb.93b9ec",
        "order": 1,
        "disp": true,
        "width": "6",
        "collapse": false
    },
    {
        "id": "c4ace8e0.769aa8",
        "type": "deconz-server",
        "name": "deconz",
        "ip": "192.168.1.75",
        "port": "80",
        "apikey": "1A32BAACC0",
        "ws_port": "443",
        "secure": false,
        "polling": "15"
    },
    {
        "id": "7874e5cb.93b9ec",
        "type": "ui_tab",
        "name": "Home",
        "icon": "dashboard",
        "disabled": false,
        "hidden": false
    }
]

```

 ![deconz node red](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/a/ca9c388ceb418a7f5235ccd348426ac73e3e685e.jpeg)

---

<div class="post-metadata">

**Author:** ![markost](https://avatars.discourse-cdn.com/v4/letter/m/3d9bf3/32.png) [@markost](https://discourse.nodered.org/u/markost)\
**Post date:** [25 January 2021 19:36 UTC](https://discourse.nodered.org/t/dashboard-switch-for-status-and-control/39703/10 "2021-01-25T19:36:57Z")

</div>

Are you looking for this?

```auto
[{"id":"29255051.dc251","type":"tab","label":"Dashboard UI","disabled":false,"info":""},{"id":"66bf7b9a.ab07b4","type":"ui_switch","z":"29255051.dc251","name":"","label":"switch_light1","tooltip":"","group":"b45673d4.b5364","order":0,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"","style":"","onvalue":"true","onvalueType":"str","onicon":"","oncolor":"","offvalue":"false","offvalueType":"str","officon":"","offcolor":"","x":850,"y":160,"wires":[["376e3c15.2661c4"]]},{"id":"5a309341.18881c","type":"change","z":"29255051.dc251","name":"","rules":[{"t":"change","p":"payload.on","pt":"msg","from":"true","fromt":"bool","to":"true","tot":"str"},{"t":"change","p":"payload.on","pt":"msg","from":"false","fromt":"bool","to":"false","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":500,"y":160,"wires":[["6ff2a14d.f12a5"]]},{"id":"6ff2a14d.f12a5","type":"function","z":"29255051.dc251","name":"","func":"if (msg.payload.on == \"true\"){\nmsg.payload = \"true\";\n}\nelse {\nmsg.payload = \"false\";\n}\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":680,"y":160,"wires":[["66bf7b9a.ab07b4"]]},{"id":"77f90995.eb3488","type":"inject","z":"29255051.dc251","name":"msg.payload.on boolean true","props":[{"p":"payload.on","v":"true","vt":"bool"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":220,"y":140,"wires":[["5a309341.18881c"]]},{"id":"376e3c15.2661c4","type":"debug","z":"29255051.dc251","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1010,"y":160,"wires":[]},{"id":"4750783.2e79888","type":"inject","z":"29255051.dc251","name":"msg.payload.on boolean false","props":[{"p":"payload.on","v":"false","vt":"bool"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":220,"y":180,"wires":[["5a309341.18881c"]]},{"id":"b45673d4.b5364","type":"ui_group","name":"Standard","tab":"7874e5cb.93b9ec","order":1,"disp":true,"width":"6","collapse":false},{"id":"7874e5cb.93b9ec","type":"ui_tab","name":"Home","icon":"dashboard","disabled":false,"hidden":false}]

```

Without 2nd function and ticked checkbox in switch( Pass through msg if payload matches new state)

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [25 January 2021 20:26 UTC](https://discourse.nodered.org/t/dashboard-switch-for-status-and-control/39703/11 "2021-01-25T20:26:11Z")

</div>

I think there may be some confusion. What does the input coming from the deconz input node indicate? I assumed that it was showing you the actual state of the light - the actual real light. Is that correct?  
If it is not correct is it possible to have an input node showing the actual state of the light?

---

<div class="post-metadata">

**Author:** ![molt](https://avatars.discourse-cdn.com/v4/letter/m/51bf81/32.png) [@molt](https://discourse.nodered.org/u/molt)\
**Post date:** [26 January 2021 16:41 UTC](https://discourse.nodered.org/t/dashboard-switch-for-status-and-control/39703/12 "2021-01-26T16:41:55Z")

</div>

@markost If i replace the inject with the deconz input and the debug with the deconz-out i am not able to switch the light off by using the ui-switch, like before.

@Colin The "deconz-input" listens for messages send from deconz.  
Theres also a "deconz-get" which gets the current state of a device a group.  
Yep, deconz-input is showing the actual state of the light...the real light.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [26 January 2021 16:54 UTC](https://discourse.nodered.org/t/dashboard-switch-for-status-and-control/39703/14 "2021-01-26T16:54:56Z")

</div>

> [@molt](#):
>
> Yep, deconz-input is showing the actual state of the light...the real light.

In that case show us the debug output that I asked for. What is being sent by the switch and what is going into the switch as a result of that. Also what the light does in that situation.

---

<div class="post-metadata">

**Author:** ![markost](https://avatars.discourse-cdn.com/v4/letter/m/3d9bf3/32.png) [@markost](https://discourse.nodered.org/u/markost)\
**Post date:** [26 January 2021 17:19 UTC](https://discourse.nodered.org/t/dashboard-switch-for-status-and-control/39703/15 "2021-01-26T17:19:20Z")

</div>

I dont have "deconz", so inject/debug are used for simulation...  
What about: Without 2nd function and ticked checkbox in switch( Pass through msg if payload matches new state)?

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [26 January 2021 17:27 UTC](https://discourse.nodered.org/t/dashboard-switch-for-status-and-control/39703/16 "2021-01-26T17:27:46Z")

</div>

Are you posting under two different names? It is confusing. Which flow are you testing now and what is not working?  
Do not tick pass through. Do not have feedback round the switch.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [26 January 2021 17:39 UTC](https://discourse.nodered.org/t/dashboard-switch-for-status-and-control/39703/17 "2021-01-26T17:39:00Z")

</div>

The flow you posted in post #10 works perfectly for me after I remove the pass through selection and select Show State of Input.

```auto
[{"id":"17833bc8.a56494","type":"ui_switch","z":"219f852.e8be6fa","name":"","label":"switch_light1","tooltip":"","group":"3f589707.4f5da","order":0,"width":0,"height":0,"passthru":false,"decouple":"true","topic":"","style":"","onvalue":"true","onvalueType":"str","onicon":"","oncolor":"","offvalue":"false","offvalueType":"str","officon":"","offcolor":"","x":850,"y":160,"wires":[["5346050f.c5ff94"]]},{"id":"5f6eceac.457318","type":"change","z":"219f852.e8be6fa","name":"","rules":[{"t":"change","p":"payload.on","pt":"msg","from":"true","fromt":"bool","to":"true","tot":"str"},{"t":"change","p":"payload.on","pt":"msg","from":"false","fromt":"bool","to":"false","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":500,"y":160,"wires":[["1c5c7a56.3f864e"]]},{"id":"1c5c7a56.3f864e","type":"function","z":"219f852.e8be6fa","name":"","func":"if (msg.payload.on == \"true\"){\nmsg.payload = \"true\";\n}\nelse {\nmsg.payload = \"false\";\n}\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":680,"y":160,"wires":[["17833bc8.a56494"]]},{"id":"2488c8c3.b7bff","type":"inject","z":"219f852.e8be6fa","name":"msg.payload.on boolean true","props":[{"p":"payload.on","v":"true","vt":"bool"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":220,"y":140,"wires":[["5f6eceac.457318"]]},{"id":"5346050f.c5ff94","type":"debug","z":"219f852.e8be6fa","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1010,"y":160,"wires":[]},{"id":"4e6b042e.bc1e34","type":"inject","z":"219f852.e8be6fa","name":"msg.payload.on boolean false","props":[{"p":"payload.on","v":"false","vt":"bool"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":220,"y":180,"wires":[["5f6eceac.457318"]]},{"id":"3f589707.4f5da","type":"ui_group","name":"Standard","tab":"7874e5cb.93b9ec","order":1,"disp":true,"width":"6","collapse":false},{"id":"7874e5cb.93b9ec","type":"ui_tab","name":"Home","icon":"dashboard","disabled":false,"hidden":false}]

```

On a side note you can replace the Change and Function node with a Function node containing

```auto
msg.payload = msg.payload.on ? "true" : "false"
return msg;

```

---

<div class="post-metadata">

**Author:** ![vikozo](https://avatars.discourse-cdn.com/v4/letter/v/858c86/32.png) [@vikozo](https://discourse.nodered.org/u/vikozo)\
**Post date:** [26 January 2021 17:50 UTC](https://discourse.nodered.org/t/dashboard-switch-for-status-and-control/39703/18 "2021-01-26T17:50:54Z")

</div>

Hello @Colin  
how did you set the node for sending the information to the bulb itself?  
The Nodes like you have it, show the correct information but the Bulb is not changing 😉  
i have the lidl bulb with (Color temperature light)

have a nice day  
vinc

---

<div class="post-metadata">

**Author:** ![markost](https://avatars.discourse-cdn.com/v4/letter/m/3d9bf3/32.png) [@markost](https://discourse.nodered.org/u/markost)\
**Post date:** [26 January 2021 17:56 UTC](https://discourse.nodered.org/t/dashboard-switch-for-status-and-control/39703/19 "2021-01-26T17:56:57Z")

</div>

For me it is working as I posted (Pass through select) 🤔

 ![ui_switch](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/0/10bb088b1d746d03171fa9c51c62139254374c19.gif)

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [26 January 2021 17:59 UTC](https://discourse.nodered.org/t/dashboard-switch-for-status-and-control/39703/20 "2021-01-26T17:59:16Z")

</div>

I am unclear who all the various people posting here are. Are you all separate people or are one or more of you using multiple names?

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [26 January 2021 18:01 UTC](https://discourse.nodered.org/t/dashboard-switch-for-status-and-control/39703/21 "2021-01-26T18:01:41Z")

</div>

> [@markost](#):
>
> For me it is working as I posted (Pass through select)

It will until you close the loop so that a message sent by the switch controls the light and triggers an input where the Inject nodes are, then you will get an infinite loop.

[Next page](https://discourse.nodered.org/t/dashboard-switch-for-status-and-control/39703.md?page=2)
