List for activating switches

I have gotten into quite a pickle :slight_smile:

I have a bunch of switches and I would like to create a list which would activate the selected switch -this is to prevent making buttons for all of them-.

Now I tried the input_select approach but I feel like I am missing an automation.

Here is how I wrote it in my config file.

> input_select:
>   where_to_go:
>     name: where to go
>     options:
>       - switch.sergh
>       - switch.nicole
>       - switch.hadar
>       - switch.yair
>       - switch.rotem
>       - switch.ori
>       - switch.nir
>       - switch.elena
>       - switch.sergey
>       - switch.tyler
>       - switch.jeremie
>       - switch.david_r
>       - switch.andrew
>       - switch.reuven
>     initial: switch.sergh
>     icon: mdi:account-search

Now on my dashboad it looks exactly how I want it to be…

Untitled

However, it does not operate… I want to be able to select a switch and trigger it to turn on

So make the automation that does what you want. The input select does nothing but create an input select. You have to create an automation that reacts to the input select changing.

The problem is I have no idea how to structure the automation

I’ll give you some hints, your trigger will be the input_select changing state. Your action will use the trigger object inside a template for the entity_id in the target. Your service will simply be script.turn_on.

Im sorry but I have a few questions. Firstly starting with trigger.

  trigger:
  - platform: state
    entity_id: input_select.personnel_nav
    id: 'Personnel selected '
    to: sergh

Above is how I set my trigger in the automation. However when selecting the name “sergh” the automation does not trigger. I did try to play with the from and to options in trigger. but nothing seems to work.

Conditions I see I do not need. I guess

and for actions.

I honestly do not know what you mean even after doing more research :frowning: Below is what I have achieved for now…

- id: '1638970984299'
  alias: 'CTO selected '
  description: 'Once Sergh is selected in input select then trigger switch.sergh to
    activate '
  trigger:
  - platform: state
    entity_id: input_select.personnel_nav
    id: 'Personnel selected'
    to: sergh
  condition: []
  action:
  - scene: scene.sergh
  mode: single


Currently, for action I did make a scene that looks something like this (below). However, I do not like it even though it works. Because I really want to avoid making a scene for every personnel :frowning:

- id: '1638970960987'
  name: Sergh
  entities:
    switch.sergh:
      friendly_name: sergh
      state: 'on'

Thank you for your time and patience though!!! Very appreciated

Trigger object is only accessible in templates. It’s all documented here.

The state of your input_select will always be an item in that list. Which is always a switch. So use the to_state state as the entity you’re turning on.

trigger:
  - platform: state
    entity_id: input_select.personnel_nav
action:
- service: switch.turn_on
  target:
    entity_id: "{{ trigger.to_state.state }}"
1 Like