I have a lot of input_selects and selects in my config.
I can use a custom:buttoncard with select_next on tap to go through all the options.
Unfortunately there is no similar function for the select entities
Don’t forgot to vote yourself
1 Like
While you wait, that functionality is scriptable…
Select Next
alias: Select Next
fields:
target_entity:
name: Target Entity
description: |
The select entity you wish to change
selector:
entity:
domain: select
example: select.basement_scenes
required: true
sequence:
- variables:
options: "{{ state_attr(target_entity, 'options') }}"
count: "{{ options|count }}"
current: "{{ options.index(states(target_entity)) }}"
new: |
{%- if current == count - 1 %}
{{ state_attr(target_entity, 'options')[0] }}
{%- else %}
{{ state_attr(target_entity, 'options')[current + 1] }}
{%- endif %}
- service: select.select_option
data:
option: "{{ new }}"
target:
entity_id: "{{ target_entity }}"
mode: single
Select Previous
alias: Select Previous
sequence:
- variables:
options: "{{ state_attr(target_entity, 'options') }}"
count: "{{ options|count }}"
current: "{{ options.index(states(target_entity)) }}"
new: |
{% if current == 0 %}
{{ state_attr(target_entity, 'options')[-1] }}
{% else %}
{{ state_attr(target_entity, 'options')[current - 1] }}
{%- endif %}
- service: select.select_option
data:
option: "{{ new }}"
target:
entity_id: "{{ target_entity }}"
fields:
target_entity:
name: Target Entity
description: |
The select entity you wish to change
selector:
entity:
domain: select
example: select.basement_scenes
required: true
mode: single
Select Last
alias: Select Last
sequence:
- service: select.select_option
data:
option: "{{ state_attr(target_entity, 'options')[-1] }}"
target:
entity_id: "{{ target_entity }}"
fields:
target_entity:
name: Target Entity
description: |
The select entity you wish to change
selector:
entity:
domain: select
example: select.basement_scenes
required: true
mode: single
Select First
alias: Select First
sequence:
- service: select.select_option
data:
option: "{{ state_attr(target_entity, 'options')[0] }}"
target:
entity_id: "{{ target_entity }}"
fields:
target_entity:
name: Target Entity
description: |
The select entity you wish to change
selector:
entity:
domain: select
example: select.basement_scenes
required: true
mode: single
2 Likes