Odd behaviour with select card
For any feature request you can open a new discussion here:
https://github.com/Clooos/Bubble-Card/discussions/categories/feature-requests
For any question you can open a new discussion here:
https://github.com/Clooos/Bubble-Card/discussions/categories/q-a
Describe the bug
I have created a input selector, with 6 options for running my hoover in various rooms. I have 6 scripts that relate to these options. And I have set an automation to run the script when the corrosponding option is selected. (hope that makes sense)
From here I have added a selector bubble card using this input selector.
The issue I have is that when I select a option from the drop down it works. But I cannot use that same optoin next time, I need to pick another option then go back to the first option.
ie if I select downstairs, then a day later I select downstairs again it doesnt work, unless I select another room then downstairs again.
YAML
This is the YAML for the automation.
alias: Hoover - Input select downstairs
description: ""
triggers:
- trigger: state
entity_id:
- input_select.hoover_downstairs
conditions: []
actions:
- action: >
{% if is_state('input_select.hoover_downstairs', 'downstairs') %}
script.hoover_start_downstairs {% elif
is_state('input_select.hoover_downstairs', 'empty') %}
script.hoover_empty_downstairs {% elif
is_state('input_select.hoover_downstairs', 'kitchen') %}
script.hoover_clean_kitchen {% elif
is_state('input_select.hoover_downstairs', 'dining room') %}
script.hoover_clean_dining_room {% elif
is_state('input_select.hoover_downstairs', 'living room') %}
script.hoover_clean_living_room {% elif
is_state('input_select.hoover_downstairs', 'entrance') %}
script.hoover_clean_entrance {% endif %}
mode: single
Informations (please complete the following information):
- OS: iOS.Windows
- Browser/App: iOS app/Chrome
- Bubble Card version: 2.4.0
- Home Assistant version: 2025.3.1
Thank you! 🍻
Unfortunately, I think this is a limitation of the input_select helper itself and not the Bubble select card. You might want to look into template selects which will allow you to define custom actions that will be executed even upon reselects. In your select_option, you can define an action which executes the relevant script using a dict/map, where each option maps to a script. Another great benefit of this is not needing an additional automation to handle the select logic! Here's an example for my vacuum's fan speed controls:
- select:
- name: "Q5 Pro Fan Speed"
unique_id: q5_pro_fan_speed
state: >-
{% set fan_power_name = state_attr('vacuum.q5_pro', 'fanPowerName') | default('off') %}
{% set display_map = {
'off': 'Off',
'quiet': 'Quiet',
'balanced': 'Balanced',
'turbo': 'Turbo',
'max': 'Max',
'custom': 'Custom',
'max_plus': 'Max+'
} %}
{{ display_map.get(fan_power_name, fan_power_name) }}
options: >-
{% set raw_options = state_attr('vacuum.q5_pro', 'fanPowerOptions') | default([]) %}
{% set current = state_attr('vacuum.q5_pro', 'fanPowerName') | default('off') %}
{% set display_map = {
'off': 'Off',
'quiet': 'Quiet',
'balanced': 'Balanced',
'turbo': 'Turbo',
'max': 'Max',
'custom': 'Custom',
'max_plus': 'Max+'
} %}
{% set data = namespace(display_options=[]) %}
{% for opt in raw_options %}
{% if opt == 'custom' and current != 'custom' %}
{# Skip adding the "Custom" option if not currently set #}
{% else %}
{% set data.display_options = data.display_options + [ display_map.get(opt, opt) ] %}
{% endif %}
{% endfor %}
{{ data.display_options }}
icon: >-
{% set icons = {
'Off': 'mdi:fan-off',
'Quiet': 'mdi:volume-medium',
'Balanced': 'mdi:fan',
'Turbo': 'mdi:car-turbocharger',
'Max': 'mdi:turbine',
'Custom': 'mdi:alpha-c-circle',
'Max+': 'mdi:fan-alert'
} %}
{{ icons.get(this.state, 'mdi:fan') }}
select_option:
- action: vacuum.set_fan_speed
target:
entity_id: vacuum.q5_pro
data:
fan_speed: >-
{% set internal_map = {
'Off': 'off',
'Quiet': 'quiet',
'Balanced': 'balanced',
'Turbo': 'turbo',
'Max': 'max',
'Custom': 'custom',
'Max+': 'max_plus'
} %}
{{ internal_map.get(option, option) }}
Here's how that looks in practice using a bubble select card.
Your template select might look something like this:
template:
- select:
- name: "Launch Hoover Select"
unique_id: launch_hoover_select_template
state: >-
{{ this.state | default('downstairs') }}
options: >-
{{ ['downstairs', 'empty', 'kitchen', 'dining room', 'living room', 'entrance'] }}
icon: >-
{% set icons = {
'downstairs': 'mdi:home-floor-0',
'empty': 'mdi:trash-can',
'kitchen': 'mdi:fridge',
'dining room': 'mdi:table-chair',
'living room': 'mdi:sofa',
'entrance': 'mdi:door'
} %}
{{ icons.get(this.state, 'mdi:robot-vacuum') }}
select_option:
- action: script.turn_on
target:
entity_id: >-
{% set script_map = {
'downstairs': 'script.hoover_start_downstairs',
'empty': 'script.hoover_empty_downstairs',
'kitchen': 'script.hoover_clean_kitchen',
'dining room': 'script.hoover_clean_dining_room',
'living room': 'script.hoover_clean_living_room',
'entrance': 'script.hoover_clean_entrance'
} %}
{{ script_map.get(option, 'script.hoover_start_downstairs') }}
I just started out with Home Assistant so not sure if this is the best way of solving the issue or if the YAML above even works, but I hope it's a good starting point!
Hey thanks for the reply, sorry its taken me so long to reply. I have been swamped.
This looks like it could be a good solution, i just need to figure it out.
Could you share your image again? it doesnt seem to work.
I also want to learn more about template selects, but as a work around for now, you could create another automation to select a blank option in the input select once the clean ends. That way you're always starting from a blank option