Multi state switch definition

Hi, I’m developing a device that communicates to HomeAssistant through MQTT protocol. I’ve implemented auto discovery messages to map all entities automatically when it starts.

One of them is a switch that may have three states ON, OFF and AUTO. This is currently not possible because MQTT switch only has two possible states ON and OFF.

It would be quite useful to extend MQTT switch definition with more optional states.

An MQTT Switch simply implements Home Assistant’s switch which, by definition, has two states, on and off, and two services turn_on and turn_on.

To implement your Feature Request would require changing Home Assistant’s fundamental definition of a switch (a two-state device). That’s unlikely to happen.

The way you can currently model your 3-state switch in Home Assistant is with an input_select. However, there is no such thing as an MQTT Input_Select.

You would have to create an MQTT Sensor to represent the state of your 3-state switch. Then you need an automation to keep the input_select synchronized with the MQTT Sensor. A second automation can monitor the input_select and, whenever its state changes, publish the value to a topic (that controls your physical 3-state switch). The two automation are quite simple.