I’m looking for an elegant way to create a drop down (helper)(or cluster of buttons) in HA GUI that i can select from a list of 17 programs for my pool lights. The lights themselves have built in logic that allows the user, via turning the power off and on quickly, to cycle through the different color patterns/programs. I would like to use a drop down or perhaps a card with all the programs listed as a button the user could select.
The tricky part is the system would have to keep track of what program # the lights are currently on then flick the off/on X amount of times to get to the next selected program.
Alt: I can have each button/dropdown line linked to an automation that would turn the light off for 5 seconds so it resets to program 1 then cycle power the appropriate amount of times to get to the selected program.
I’m fairly new to HA (about 2 months now) and have zero javascript knowledge. So any elegant solutions you can think of would require some detail for me to understand.
It provides zero feedback. Just a dumb switch I fitted with a Sonoff mini.
I think it had to be cycled off then back on within 5 seconds otherwise at 5 seconds the light resets back to program 1.
I was messing around with the helper drop down but I’m really struggling with the automation part behind the scenes. Thanks for the link. Confirmed how I guessed the helper worked.
@VDRainer
That’s great. thanks for the code behind your solution. Do you know of a way that the GUI could display the actual color text rather than the value? i.e.dispay “gold” return value “2” to the automation.
I guess i could create another helper and automation that assigns a number based on color text the users selects.
I’m getting some config error with the automation file. Would you be able to decipher the error and let me know what is wrong with the code?
Error message:
Invalid config for [automation]: expected str for dictionary value @ data[‘id’]. Got None
extra keys not allowed @ data[‘trigger’][0][‘action’]. Got None
required key not provided @ data[‘action’]. Got None. (See ?, line ?).
- id: 11111111111
alias: pool_lights_program
# Description: cycles light to appropriate program number based on user selection
trigger:
- platform: state
entity_id: input_select.pool_light_color
action:
- service: switch.turn_off
entity_id: switch.sonoff_pool_light
- delay: 00:00:06
- condition: template
value_template: "{{ trigger.to_state.state.split(':')[0] | int > 0 }}"
- service: switch.turn_on
entity_id: switch.sonoff_pool_light
- condition: template
value_template: "{{ trigger.to_state.state.split(':')[0] | int > 1 }}"
- delay: 00:00:01
- service: switch.turn_off
entity_id: switch.sonoff_pool_light
- delay: 00:00:01
- service: switch.turn_on
entity_id: switch.sonoff_pool_light
- condition: template
value_template: "{{ trigger.to_state.state.split(':')[0] | int > 2 }}"