Ui_switch - msg.enable - payload control

I have a field device that send LWT to mqtt.

When the device goes "Off-Line", i disable the relevant ui_switch with msg.enabled = false;
The switch is set to pass through msg if payload match new state.
This then make the switch not clickable and this part work as the switch will switch Off if it was On and send the Off command to mqtt.

When the field device come "On-Line" again, i enable the relevant switch with msg.enabled=true;
This is where it goes wrong for me.

How enable the switch without the "On" msg.payload getting send as well?
I only want the "Off" msg.payload to get pass through?

If you set the Switch to Not pass through then if there are some messages that you do want through then you can put them in after the switch instead of before.
A common mode of use is to set the switch to not pass through and to show the state of the Input. Then when the switch is clicked the output goes to the device which then responds with a new state, which is fed back in to the switch input. Therefore the switch always shows the actual state of the device and if it doesn't respond then the switch will not change. If there are additional ways of controlling the device then they don't need to be fed into the switch but can be sent to the device directly, as the device change will then feed back and make the switch show the correct state automatically.

Hi Colin

I shall have to redo my system to work in that mode.
I have been looking at that, but i have not gone there due to the scale of my system.

Thank you for your input.

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