Virtual Switch with Feedback Status

Hi All,

I am controlling a water heater contactor (~relay) using a PLC. I have connected the PLC to Home Assistant with mqtt. I created an input_button called “Trigger Water Heater” which toggles the state of the water heater via publishing to an mqtt topic which the PLC subscribed to. The PLC also publishes the status of the relay output to a separate topic.

How can I create a virtual switch that both takes on and off commands AND shows the actual status via the reporting from the PLC? I am able to create the input_boolean which seems to create the virtual switch… But I am at a loss on how to show its actual state. Thanks!

Create a mqtt switch.

1 Like