# Dashboard switch not turning on any more in one tab

**URL:** <https://discourse.nodered.org/t/dashboard-switch-not-turning-on-any-more-in-one-tab/70977>\
**Category:** Dashboard\
**Created:** [21 November 2022 12:16 UTC](https://discourse.nodered.org/t/dashboard-switch-not-turning-on-any-more-in-one-tab/70977 "2022-11-21T12:16:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mikee1234K](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mikee1234k/32/70283_2.png) [@Mikee1234K](https://discourse.nodered.org/u/Mikee1234K)\
**Post date:** [21 November 2022 12:16 UTC](https://discourse.nodered.org/t/dashboard-switch-not-turning-on-any-more-in-one-tab/70977/1 "2022-11-21T12:16:32Z")

</div>

I have a few dashboard switches in one tab which have stopped working. First, they lost sync with the dashboard. Meaning, they showed off in the flow, while the dashboard showed on. Trying to change status on the dashboard sent a command, but the status on the dashboard did not change. I restarted Node Red. All my switches turned off. I can send a on in the flow, they will not change state either in the flow, or the dashboard. To eliminate other influences. I created a test switch, with injects on the on off. Looking at the debug, they send the message, but the switch does not change ! I checked on anotehr NR flow I have to see if I inadvertedly changed something, but the use the same payload and the switches there still work. Very weird.

![Switch 2](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/4/242385acef860d2fa0ab6b96915ffeaeff9ca046.png)

 ![Switch](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/b/3b4764027734ea85429e4582d46543c4b471b441.png)

As you can see from the debug, the last command was on. The switch is still off...

```auto
[{"id":"f3844ac592f01520","type":"change","z":"620ffedbfaeeb4e8","name":"Set payload On","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"status\":\"On\"}","tot":"json"},{"t":"set","p":"strongcolor","pt":"msg","to":"deepskyblue","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":820,"y":3800,"wires":[["fa17c7b5c057caba","1266b0a0c71a5830"]]},{"id":"6ac62a85a87e3c39","type":"change","z":"620ffedbfaeeb4e8","name":"Set payload Off","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"status\":\"Off\"}","tot":"json"},{"t":"set","p":"strongcolor","pt":"msg","to":"deepskyblue","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":820,"y":3840,"wires":[["fa17c7b5c057caba","1266b0a0c71a5830"]]},{"id":"fa17c7b5c057caba","type":"ui_switch","z":"620ffedbfaeeb4e8","name":"Test TRV","label":"<font color= {{msg.strongcolor}} > {{\"Test TRV\"}} </font>","tooltip":"","group":"07554a310ef48bc2","order":1,"width":0,"height":0,"passthru":false,"decouple":"true","topic":"control","topicType":"str","style":"","onvalue":"{\"value\":\"1\"}","onvalueType":"json","onicon":"","oncolor":"","offvalue":"{\"value\":\"0\"}","offvalueType":"json","officon":"","offcolor":"","animate":false,"className":"red-on-off","x":1020,"y":3820,"wires":[[]]},{"id":"da160f8107373946","type":"inject","z":"620ffedbfaeeb4e8","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":600,"y":3800,"wires":[["f3844ac592f01520"]]},{"id":"caa5cc0ea44d729d","type":"inject","z":"620ffedbfaeeb4e8","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":600,"y":3840,"wires":[["6ac62a85a87e3c39"]]},{"id":"1266b0a0c71a5830","type":"debug","z":"620ffedbfaeeb4e8","name":"debug 3","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1040,"y":3740,"wires":[]},{"id":"07554a310ef48bc2","type":"ui_group","name":"TRVs","tab":"f62ea21253d08c19","order":2,"disp":true,"width":5,"collapse":false,"className":""},{"id":"f62ea21253d08c19","type":"ui_tab","name":"System","icon":"dashboard","order":6,"disabled":false,"hidden":false}]

```

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [21 November 2022 13:30 UTC](https://discourse.nodered.org/t/dashboard-switch-not-turning-on-any-more-in-one-tab/70977/2 "2022-11-21T13:30:01Z")

</div>

You are injecting an object `{"status":"On"}` while your switch generates `{"value":"1"}`.

Injecting `{"value":"On"}` doesn't work but injecting `{"value":"1"}` does change the dashboard representation of the switch.

Using objects seems to me overly complex. It's simpler if the switch generates "on" or "off" and a change node after the switch changes this to the object you want.  
(Or, if you prefer, 1/0 or true/false. But surely not "1"/"0")

 ![Untitled 3](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/e/0e0af24c85947813fc72269bb10ab84a4fb10be3.jpeg)

 ![Untitled 2](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/e/5eac34195adb2b377bb64ea8d08563a4bedc79fa.jpeg)

---

<div class="post-metadata">

**Author:** ![Mikee1234K](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mikee1234k/32/70283_2.png) [@Mikee1234K](https://discourse.nodered.org/u/Mikee1234K)\
**Post date:** [21 November 2022 13:52 UTC](https://discourse.nodered.org/t/dashboard-switch-not-turning-on-any-more-in-one-tab/70977/3 "2022-11-21T13:52:19Z")

</div>

As I need the {"value":"1"} to turn on the device, I thought it was easier to set the switch to send that. Initially it worked. Going to what you suggested, has solved the problem. I had a feeling it might be something to do with a difference of what is coming into the switch and what its sending out. Hence me creating the test setup I posted here. What I did not realise is that taking away the device controlled by the switch does not elimnate the problem with the switch trying to send something different

---

<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:** [5 December 2022 13:53 UTC](https://discourse.nodered.org/t/dashboard-switch-not-turning-on-any-more-in-one-tab/70977/4 "2022-12-05T13:53:15Z")

</div>

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