Switch with several states

Hi,

I’m absolutely new to HomeAssistant, I want to do the following and need a general guidiance what the best way is to do…

I have a heater that can have sever states, e.g. “off”, “WarmWater”, “HeatingAndWarmWater”,…
I can set it from command line (I guess, I should use “Command line switch”) like this:
heatercommand setMode State1
or
heatercommand setMode State2
I can also get the state like
heatercommand getMode

So, what is the best way to present a switch in the Frontend that show all three states?
I think about 3 Switches that show one as “on” and the other two as “off” and toggle when one is switched. Should I use automation to do that? Using a template switch? Or a script?

Maybe someone has an example.
Or, is there another way to do implement a 3 state switch?

Thanks and Regards
Sirko

I think you could use https://home-assistant.io/components/input_select/ and three scripts. And automation that triggers when input changes and runs desired script.

1 Like

Thanks for the hint, I got it working in that way:

input_select:
  heizung:
    name: Heizungsmodus
    options:
     - Aus
     - Warmwasser
     - Heizen und Warmwasser

shell_command:
  setbetriebart: "/usr/local/bin/vclient -h 127.0.0.1:3002 -c 'setBetriebArt {{ betriebart }}'"

and an Automation:

- action:
  - data_template:
      betriebart: '{{ trigger.to_state.state | string }}'
    service: shell_command.setbetriebart
  hide_entity: true
  alias: Heizung
  condition: []
  id: '1521470300850'
  trigger:
  - entity_id: input_select.heizung
    platform: state
1 Like

a question related to
hide_entity: true
in the automation: it seems not to work in that way.

How do I hide the automation from the frontend?

ok, please ignore the last one,
hide_ntity: true
works :slight_smile: