Is there a way to create a frontend switch that has three positions?
Instead of just ON/OFF I would like an entity switch that can be OFF (keep entity off/disables automation), ON (manually turn things on from interface/disables automation), AUTO (automation run normally).
You can use an input_select to create a ‘switch’ with as many states as you need.
However, I’m not sure how you intend to use it to set an automation to one of three states (on/off/auto) because it only has two states (on/off). Here are the available services to set an automation to one of its two states:
automation.turn_on
automation.turn_off
automation.toggle
Thanks for the reply. I’m familiar with Input Selects but I didn’t articulate clear enough what it is I’m looking for. Is there a switch icon that can be used in the frontend user interface that is a switch like the normal on/off switch only it has three positions instead of two?
Sort of like this:
No there isn’t a 3 state switch.
And you are mixing up two things, the state of the entity, and the state of an automation that affects the entity.
You can always change an entity, independent of any automation that may also control it. They are, logically, quite independent. Indeed you can have many automations that affect a particular entity.
I used automation merely as an example as I would have nodered control automations based on the position of the three position switch. For example I have a pump that runs everyday at a certain time. Thus the switch would be on Auto and nodered would run my automation to turn on the pump. However there are times when I want to manually turn the pump on/off and not have nodered control it. Since you say a three position switch doesn’t already exist I’ll make one. I just didn’t want to “re-invent the wheel”. Thanks
It is as simple as turning the automation off, and turning the pump on. Then turning it off. I think you are over thinking this.
That’s precisely what I want to do but using only one control. The title says it all “Three way UI switch” which apparently does not exist.
Like 123Taras said, use an input select and just make more automations to cover all cases
For a light, we have 3 modes selected by an input select on the front-end:
AUTO: the light is controlled by motion sensors or timers or switches or whatever.
ON: the light is always on and ignores automated triggers
OFF: the light is always off and ignores automated triggers
In your automations file you make an automation to turn the light on when ON is selected, another to turn it off when OFF is selected.
Then, for all other automations you add AUTO mode as a condition so they only trigger when auto mode is selected.
Same theory can be applied to any other equipment. You could even put in more options, like for lights you might like to split AUTO into a TIMER mode and a MOTION SENSOR mode or similar.
with the lovelace-slider-entity-row addon by @thomasloven you can turn an input-select entity (and others) into an slider. Works well for my ON/AUTO/OFF entity.
Thanks for pinging me into this.
I’ve actually done some experimenting with this:
Not nearly ready for release, unfortunately…
How easy, and reliable, will it be to set the center position of the tristate switch when using one’s finger? The toggle is already small target and there’s very little “travel” between left and right. Now there’s half that distance for left/right to center.
To paraphrase Brody from Jaws:
That’s only one of several reasons it’s not nearly ready for release - and may in fact never be.
Though currently it always toggles to the next state. on-auto-off-on-auto-off-etc.
It’s a neat little ‘thingymy’ but the next application is “off - slow - medium - fast”
Or
“off - low - medium - high - auto”
Etc.
So would need to be configurable
I don’t see why a slider doesn’t do that already, maybe coupled with a sensor reading what the value ‘means’ / ‘is set at’ .
Something more buttony and feedbacky like the custom fan card would make more sense imho
(not least bearing in mind that when in ‘auto’ one also may need visual feedback of whether it is actually on or off at any given moment)
I wanted Kerboros
Is there any update on this?
Hu @thomasloven, i am trying to get the same sort of function for a pool controller switch. I have installed a sonoff sv (with esphome) into my Pool chlorinator/pump controller. the controller has a single button which, when pressed cycles through On > Auto > Off then back through the same cycle. the sonoff sv simply sends a dry connection into the controller to cycle through these states, which works fine. I would like to implement your tristate switch onto my dashboard so that i can see the state of the controller.
Could i please ask you to provide the code for the card, and any associated scene or automation you have. (I have set up the input_select already).
thanks in advance
This would be really useful for my Fish tank controller… Any update?
And for home ventilation systems/ fan control!