Selector with 3 items off/on/auto?

hello to all

Who knows a NICE 3-position selector OFF / ON / AUTO
Ideally a bit of the style of the standard switches, but with 3 positions.
I think OFF/ON/AUTO is a problem that comes up often…
something like that:
image
not this (ugly) one:
image

Try this…

thanks
i will try to understand how it works.
some future plan for native selector in HA ?

A differnt suggestion, not that it fullfills your requirement about looking like a standard.
I came across this when I was playing with the set_state.py file to see what’s possible and what isn’t in combination with the custom:button-card

type: custom:button-card
entity: button.test
name: Test
show_state: true
state:
  - value: 'off'
    color: blue
    icon: mdi:power
  - value: 'on'
    color: red
    icon: mdi:power
  - value: auto
    color: white
    icon: mdi:power
tap_action:
  action: call-service
  service: python_script.set_state
  service_data:
    entity_id: button.test
    state: |
      [[[
        if (entity.state === 'on') {
          return 'off';
        }
        else if (entity.state === 'off') {
            return 'auto';
        }
        else
          return 'on';
      ]]]

Does require 3 things to be done before it works:
1.
you need to manually create that button entity since the card doesn’t like to do so
nor did I get the option allow_create working offered by the set_state. I know this does work but perhaps not from within the button_card. No idea yet.

Creating a button.test goes like this
Developper-tools>State> then where it says ‘set state’ write button.test for the entity and on off or auto into the state field. done
2.
Does require to install the custom:button-card addon using HACS

you need a python file named set_state.py easily to be found using the search in here.
store this file in /config/python_scripts/
and don’t forget to add “python_script:” w/o the quotes to your main configuration.yaml

Unlikely. What you want is not a standard Material Web Component (which is what the HA frontend uses): Components – Material Design 3 and while the frontend dev team have made their own controls in the past (like the circular slider for climate control) this is not a common occurrence.

1 Like

I personally think some of the integrations are more powerful than the devs could make the front end.

The devs could definitely do it, however, it’s much more time to make it standard.

I personally would use the HACs addons.

@tom_l OK let dev team concentrate on the core.
@justone thanks for your answer, but I’m looking for a most ‘native’ solution… it seems that using
custom:button-card addon is a necessity. I have never used python scripts in HA (seems a little bit hard).
@91JJ thanks for your answer, i used it to make a workaround: it works but it is not the beautiful yet simple 3 states switch I had in mind:
2 types (from the others i have tried):
image
and
image
in action:
2023-01-20_2

click on the name send to the original input_select
2023-01-20_
For this
1: create an input_select (here ‘radio3’)

# https://community.home-assistant.io/t/help-with-automation-home-security-toggle/314986
# 2023-01-20_09-19

input_select:
  radio3:
    name: radio3
    options:
      - "off"
      - "auto"
      - "on"

2 create an horizontal card (code from the yaml editor)

type: horizontal-stack
cards:
  - type: custom:button-card
    color_type: card
    entity: input_select.radio3
    name: Radio3
    styles:
      card:
        - height: 60px
        - '--mdc-ripple-color': '#0288d1'
        - '--mdc-ripple-press-opacity': 0.7
    state:
      - operator: default
        color: white
  - type: custom:button-card
    color_type: card
    entity: input_select.radio3
    name: 'Off'
    icon: mdi:close-circle-outline
    styles:
      card:
        - height: 60px
        - '--mdc-ripple-color': '#0288d1'
        - '--mdc-ripple-press-opacity': 0.7
        - width: 70px
    tap_action:
      action: call-service
      service: input_select.select_option
      service_data:
        entity_id: input_select.radio3
        option: 'off'
    state:
      - value: 'off'
        color: '#03a9f4'
      - operator: default
        color: white
  - type: custom:button-card
    color_type: card
    entity: input_select.radio3
    name: Auto
    icon: mdi:power-cycle
    styles:
      card:
        - height: 60px
        - '--mdc-ripple-color': '#0288d1'
        - '--mdc-ripple-press-opacity': 0.7
        - width: 70px
    tap_action:
      action: call-service
      service: input_select.select_option
      service_data:
        entity_id: input_select.radio3
        option: auto
    state:
      - value: auto
        color: '#0288d1'
      - operator: default
        color: white
  - type: custom:button-card
    color_type: card
    entity: input_select.radio3
    name: 'On'
    icon: mdi:power
    styles:
      card:
        - height: 60px
        - '--mdc-ripple-color': '#0288d1'
        - '--mdc-ripple-press-opacity': 0.7
        - width: 70px
    tap_action:
      action: call-service
      service: input_select.select_option
      service_data:
        entity_id: input_select.radio3
        option: 'on'
    state:
      - value: 'on'
        color: '#0288d1'
      - operator: default
        color: white

this code should be improved, this is my first usage of custom:button-card, so it is not pretty.

thanks to all

2 Likes

If it works, it works!

There’s many different add-ons out there to make it a little more pretty.