Dashboard switch not turning on any more in one tab

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

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

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

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")

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

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