Help requested for usage of dropdowns

Hi all,

So my dishwasher has a few programs that can be selected via a service:

I now want to create a dropdown to select a program. My approach was to create an automation that runs when I select a program in the drop down.

So I would create an automation that says when program Auto is selected in the dropdown run the service to select program id 6. Doing it that way I would need one automation for each program.

Can anybody show me a more elegant where, maybe with only one automation or script?

There are a many ways to accomplish this with a single automation, the way that is right for you depends on your comfort and/or familiarity with different tools in HA. In the following options, #1 is the most new-user, UI Automation Editor friendly, but setting it up will feel repetitive and the end result can be a little hard to read if there are a lot of options. Option #2 will produce a much more compact automation, but it requires a little bit more understanding/learning about basic data structures, YAML configuration and templates…

Options:

  1. Set up individual triggers for each program option in your dropdown, each with a specific ID, then use a Choose action that uses a Trigger condition for each option.
  2. Use a script variable mapping to create a logical relationship between the options from your dropdown and the program ID needed for your action. Then use templates to fill in the data in the action based on the value passed from the trigger.

However, you don’t actually need an automation or a script if you use a Template Select.

1 Like

Thank you for the detailed explanation! I will choose option 2 :slight_smile: