Change state dinamically of ui-switch

Hi guys this is my scenario

I have an esp32 device conected with a temeratures sensor.
this esp32 have two mode of operation manual and automatic
manual means that in the dashboard i have a ui-switch that control the way the esp32 works.

when is in automatic mode compare the temperature provided by the sensor and compare with some number, if is below that number(temp when the relay is turn on the heater) and (if is greater turn off the heater)
When is working in Manual mode in the dashboar have another Switch to turn on and off manually..

My problem is when the device turn on or off the heater , i want to refresh automatically the state of the Manual Switch.. I communicate with the esp32 with Mqtt..
when i change any state of the heater i sent and mqtt to a specific topic and the flow know that the state has changed..

how connect this mqtt in to the state of the Manual switch to show the real state of the heater ?


Feed in a value in the payload that exactly matches the configured on/off payloads in the switch node. Set the switch node to not pass through the message and set it to show the state of the input, not the output.

The mqtt receive false and true from the esp32,
the Cal 001 switch receive "false" or "true"

this the code what iam doing wrong ?

The switch node is configured for Boolean true/false so that is what you must feed in, not string "true".

Edit. If you set the mqtt In node to parsed JSON output it might convert it Boolean for you. Otherwise use a change node.

Thank you @Colin , works fine now .. all the switches now are updated like i need...


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