Custom multiple state switch

Hi,

I’m quiet new to the HA system, so I’m not sure whether something like this already exists, but so far, I haven’t found anything so, here it goes:

I’m looking to design a custom switch which would be able to have multiple states.

In this case, I want to add a 433MHz RF receiver to my sound system, and send commands to it from either a Raspberry Pi, or a USB emitter. I would like HA to have something that could look like a TV remove, and when you’d press a button, a certain command (pything script) would be executed. This is quiet similar to the “command_swich”, yet it should have more states than just “ON” and “OFF”.

Any suggestion or guidance is highly appreciated.

Thank you all

I suggest that you have a look at the Switch template and create one for every state. So every state you want to control will have its own ‘on’ and ‘off’ state.

Thank you for this answer. Although, I’m not sure I fully understand how this can be implements to suit my needs.
My understanding is that the switch_template would sort of “sync” various swtiches. Is that right? If so, can this also work with command_switches?

If I follow your explanation, I should have command_switches such as:

platform: command_switch switches: setAux: onCmd: "auxOn.py" offCmd : "auxOff.py" setPhono: onCmd: "phonoOn.py" offCmd : "phonoOff.py" setTuner: onCmd: "tunerOn.py" offCmd : "tunerOff.py"

then, I should have

platform: template
  aux:
    value_template: '{{ states.switch.setAux.state }}'
    turn_on:
        service: switch.turn_off
        entity_id: switch.setPhono
        entity_id: switch.setTuner
  phono:
    value_template: '{{ states.switch.setPhono.state }}'
    turn_on:
        service: switch.turn_off
        entity_id: switch.setAux
        entity_id: switch.setTuner
  tuner:
    value_template: '{{ states.switch.setTuner.state }}'
    turn_on:
        service: switch.turn_off
        entity_id: switch.setAux
        entity_id: switch.setPhono

So that when I turn on one of them, the two others turn off?

Hi,

This “multi state switch” would be very usefull for me also.

Regards

Hschroyen

bump.

Any followup on such a feature?

I think a input_select component can do what you need.

I agree. I am looking for same kind of functionality.