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!