How can I update a switch status on the dashboard

That is a nice way of doing it. I will keep this on file in case I need it for a future project.

Thanks for that Paul.

Somewhere I wanted something like that and that is the answer.

I now just have to remember where it was I needed it.

:stuck_out_tongue_winking_eye:

2 Likes

Hi guys , thanks in advance for your help..

I have this situation, i have an esp32 with 6 Relays conected a heaters.
my question is how can i update in the dashboard the real state of the six switches (Calefactor 001....006) when i press the button Turn ON ALL and Turn OFF ALL...

only that i need is update the switches, when i turn on i sent a 'true' via mqtt to my esp32 ..

I try to implemet a feedback from the esp32 and the esp32 send me a mqtt informing the real state of the heater..

how implement ? i start with node 2 days ago , and all help be useful, how can reduce my flow wih functions ?

Thanks in advance

1 Like

You can subscribe to the status topic on mqtt to get the current state of the switch, if necessary change that to exactly the same values that the switch outputs and feed that into the switch node. Set the switch to not pass the message through (that is most important or you will have an mqtt loop) and set it to show the status of the input.

@Paolo I have just noticed that you tacked this on the end of a very old thread. It is generally better to start a new thread in such situations. If you have further questions on this please start a new thread. Thanks.

1 Like