UI not updating (sometimes) and input_select bug

Update: See this post below for a simpler example.

The problem is I’m updating an input_select and it does’t always update in the UI. Sorry, this is a bit obscure, but maybe someone has seen this.

Summary

I have cascading input_selects. That is, when you make a selection on the first, or primary, input_select that triggers an automation to populate the secondary input_select’s options. e.g. Select a country and then the next select populates cities in that country.

That works fine. The problem is when Home Assistant restarts it doesn’t restore the input_select state1. So, I have to find a work-around.

So, what I do is save the current input_selects’ states into two input_text entities for restoring later.

Then I can save the current selects:

When I press that bottom button it calls input_select.reload to emulate a HA restart, and then I populate the options and finally update the input_selects’ state from the saved input_text entities.

The UI issue

But often what happens is the UI will then show this where one (or the other) doesn’t show the actual current state – but I know the state is set.

It varies which select doesn’t update in the UI.

The input_selects do get their state updated, though. Refreshing or changing tabs will update the UI. Same behavior in Chrome and Safari.

I also log to confirm the input_selects are the expected value.

2025-11-05 15:35:16.114 ERROR (MainThread) [homeassistant.components.system_log.external] Emulating a restart by reloading input_selects. (4s delay)
2025-11-05 15:35:20.774 ERROR (MainThread) [homeassistant.components.system_log.external] >>> Secondary options set to: Nothing
2025-11-05 15:35:22.024 ERROR (MainThread) [homeassistant.components.system_log.external] >>> Primary Options set to: Nothing, Metals, Weather, Food
2025-11-05 15:35:22.050 ERROR (MainThread) [homeassistant.components.system_log.external] >>> Secondary options set to: Nothing, Sunny, Rain, Fog, Clouds
2025-11-05 15:35:22.081 ERROR (MainThread) [homeassistant.components.system_log.external] Set primary: saved='Weather', select='Weather'.
2025-11-05 15:35:22.083 ERROR (MainThread) [homeassistant.components.system_log.external] Set secondary: saved='Rain', select=='Rain'

Any idea why it fails to render – or if there’s a trick I could use to get it to update?

If really curious, here’s the package I’m using to run all of this:

input_select.yaml


input_select:

  # Define the two caascaded selects
  example_select_primary:
    options:
      - Nothing

  example_select_secondary:
    options:
      - Nothing

input_text:

  # To save the current state of the selects
  # to restore after a HA restart
  example_select_last_primary_value:
  example_select_last_secondary_value:


input_button:

  # Button to initaily load the priamry selects
  example_select_load_primary_selects:

  # Button to store the current input_select values
  example_select_remember_values:

  # Button to reload input_select
  example_select_reload_all:

timer:
  example_select_ha_restarted:
    duration: 2

script:
  example_select_script:
    mode: queued
    fields:
      action:
        selector:
          text: null
        name: action
        required: true
    sequence:
      - variables:
          default_option: Nothing
          option_lookup:
            Metals:
              - Gold
              - Silver
              - Tin
            Weather:
              - Sunny
              - Rain
              - Fog
              - Clouds
            Food:
              - Pasta
              - Tacos
              - Stir Fry
      - choose:
          - alias: "*** Set the primary select options (at startup) ***"
            conditions:
              - condition: template
                value_template: "{{ action == 'set_primary_options' }}"
            sequence:
              - action: input_select.set_options
                target:
                  entity_id: input_select.example_select_primary
                data:
                  options: "{{ [default_option] + option_lookup.keys()|list }}"
              - action: system_log.write
                data:
                  message: >-
                    >>> Primary Options set to: {{
                    state_attr('input_select.example_select_primary', 'options'
                    )|join(', ') }}
          - alias: "*** Set the secondary options whenever the primary changes. ***"
            conditions:
              - condition: template
                value_template: "{{ action == 'set_secondary_options' }}"
            sequence:
              - alias: To avoid HA WARNING about selecting an invalid option
                action: input_select.select_option
                target:
                  entity_id: input_select.example_select_secondary
                data:
                  option: "{{ default_option }}"
              - action: input_select.set_options
                target:
                  entity_id: input_select.example_select_secondary
                data:
                  options: >-
                    {% set primary_select =
                    states('input_select.example_select_primary') %} {{
                      [default_option] +
                      (option_lookup[primary_select] if primary_select in option_lookup else [])
                    }}
              - action: system_log.write
                data:
                  message: >-
                    >>> Secondary options set to: {{
                    state_attr('input_select.example_select_secondary', 'options'
                    )|join(', ') }}
        default:
          - action: system_log.write
            data:
              message: "{{ this.entity_id }} called with invalid 'action' = '{{ action }}'"


automation:
  - id: example_select_updates_id
    alias: Example Select Updates
    mode: queued
    triggers:
      - id: set_primary_options
        trigger: state
        entity_id: input_button.example_select_load_primary_selects

      - id: set_secondary_options
        trigger: state
        entity_id: input_select.example_select_primary
    actions:
      - action: script.example_select_script
        data:
          action: "{{ trigger.id }}"
    description: |-
      # Here's two cards to use
      - type: sections
        max_columns: 4
        title: Test Selects
        path: test-selects
        sections:
          - type: grid
            cards:
              - type: entities
                entities:
                  - entity: input_button.example_select_load_primary_selects
                    name: Load Primary Selects
                  - entity: input_select.example_select_primary
                  - entity: input_select.example_select_secondary
          - type: grid
            cards:
              - type: entities
                entities:
                  - entity: input_button.example_select_remember_values
                  - entity: input_text.example_select_last_primary_value
                  - entity: input_text.example_select_last_secondary_value
                  - entity: input_button.example_select_reload_all
                    name: input_select.reload (all)


  - id: example_select_reloading_id
    alias: Example Select Reloading
    mode: queued
    triggers:
      - id: remember_selects
        trigger: state
        entity_id: input_button.example_select_remember_values


      - id: ha_restarted
        trigger: homeassistant
        event: start

      - id: emulate_ha_restarted
        trigger: state
        entity_id: input_button.example_select_reload_all

      - id: reload_all_selects
        trigger: event
        event_type: timer.finished
        event_data:
          entity_id: timer.example_select_ha_restarted

    actions:
      - choose:

          ## Save the current select states to input_text to survice a HA restart ##
          - conditions:
              - condition: trigger
                id: remember_selects
            sequence:
              - action: input_text.set_value
                target:
                  entity_id: input_text.example_select_last_primary_value
                data:
                  value: "{{ states('input_select.example_select_primary') }}"
              - action: input_text.set_value
                target:
                  entity_id: input_text.example_select_last_secondary_value
                data:
                  value: "{{ states('input_select.example_select_secondary') }}"


          ## When HA restart set a short timer to fire script again ##
          - conditions:
              - condition: trigger
                id: ha_restarted
            sequence:
              - action: timer.start
                target:
                  entity_id: timer.example_select_ha_restarted
                data:
                  duration: 2

          ## Same as above but loadings all the input_selects ##
          - conditions:
              - condition: trigger
                id: emulate_ha_restarted
            sequence:
              - action: system_log.write
                data:
                  message: Emulating a restart by reloading input_selects. (4s delay)
              - delay: 4
              - action: input_select.reload

              - action: timer.start
                target:
                  entity_id: timer.example_select_ha_restarted
                data:
                  duration: 2


          ## This disables the above automation and manually restores the selects ##
          - conditions:
              - condition: trigger
                id: reload_all_selects
            sequence:

              # First, disable the automation so updating the selects do not trigger the automation #
              - action: automation.turn_off
                target:
                  entity_id: automation.example_select_updates

              # Then we call the script to populate the primary select's options
              - action: script.example_select_script
                data:
                  action: set_primary_options


              # Once the primary options have been set, now select the saved option
              - action: input_select.select_option
                target:
                  entity_id: input_select.example_select_primary
                data:
                  option: "{{ states('input_text.example_select_last_primary_value') }}"

              # Do the same for the secondary input_select #
              - action: script.example_select_script
                data:
                  action: set_secondary_options

              - action: input_select.select_option
                target:
                  entity_id: input_select.example_select_secondary
                data:
                  option: "{{ states('input_text.example_select_last_secondary_value') }}"

              # Finally, re-enable the automation #
              - action: automation.turn_on
                target:
                  entity_id: automation.example_select_updates

              # LAST, let's show whhat we did:
              - action: system_log.write
                data:
                  message: >-
                    Set primary:
                    saved='{{ states('input_text.example_select_last_primary_value') }}',
                    select='{{ states('input_select.example_select_primary') }}'.

              - action: system_log.write
                data:
                  message: >-
                    Set secondary:
                    saved='{{ states('input_text.example_select_last_secondary_value') }}',
                    select=='{{ states('input_select.example_select_secondary') }}'

        default:
          - action: system_log.write
            data:
              message: >-
                {{ this.entity_id }} called with invalid trigger = '{{ trigger.id
                }}'

Input Select Trouble

1 Note that the docs do say that the input_select is restored on restart, which is not quit true. HA will first restore the default options, and if the current state isn’t one of those default options it will then pick the first option.

There’s no warning in the logs about the (now) invalid option, or that it was changed. And there’s no state change event, either.

There’s the input_select.set_options action, so maybe there needs to be a restore_options flag (similar to the restore flag on timers) to load the options from `.storage/core.entity_registry’.

My versions.

  • Installation methodHome Assistant OS
  • Core 2025.10.3
  • Supervisor 2025.11.1
  • Operating System 16.2
  • Frontend 20251001.4

Home assistant can’t restore the state to an option not in the list of options. So you would be better off asking for the edited list of options to be restored. Which I’m pretty sure has been asked for and rejected before.

Why not just do that with an automation using this trigger, so that no button pressing is required:

  triggers:
  - trigger: homeassistant
    event: start

As the dashboards are reloaded on a restart that might solve your UI issue. It could be a race between dashboard reload and the automation finishing though.

1 Like

Yeah, exactly. Curious why it was rejected. Since there’s an action to dynamically set the options seems like they should be restored, too. Or at least have an option to have them restored.

:laughing: The button is only to test – so I didn’t have to wait over and over for the restart when trying to debug. I have both triggers in my automation:

      - id: ha_restarted
        trigger: homeassistant
        event: start

      - id: emulate_ha_restarted
        trigger: state
        entity_id: input_button.example_select_reload_all

The issue came up because I noticed after a restart that the UI hadn’t updated, so I added that “emulate_ha_restarted” just to save time.

Not a huge issue, of course. Don’t restart HA that often.

The acutal use case is for running irrigation which runs frequently and for a long time, so it’s not that odd that a restart would happen while running irrigation and then the display would be off. Handling the selects not reloading is a bit convoluted.

Use timers. They can be restored after a restart. Or…

Personally I use the core weekly scheduler helper for this. I trigger on the schedule helper turning on or off. That way it is very unlikely to miss a trigger. I do however have an overrun automation (state trigger on the valve being open for longer than the maximum run time I use), just in case.

Have you considered moving to Template Selects instead? That would let you set the secondary’s availability based on the primary having a valid state.

1 Like

Maybe rather than having dynamic lists for the secondary, you could create separate ones for each primary, and then use the ‘visibility’ to show the correct one in the UI.

Thanks for all the suggestions. I will look into those.

The overall system is working right now, it’s just a minor UI issue when HA restarts, so as I said, not a huge deal. Not quite ready to reimplement it. Just wondered if there was something obvious with the UI loading issue.

Maybe fixed-option selects are the way to go. I am using restorable timers, of course. I also set a timer on restart to trigger the re-load of the selects.

Wasn’t really a post about irrigation systems. I’ve been using Irrigation Unlimited for a few years, but wanted something more native HA.

I considered scheduler and also considered using json in an attribute as my program and valve tracking queue.

I’m using one one of the selects as a queue, if it wasn’t obvious.

Here’s where I am right now with very little styling, if curious.

The UX “team” at my house seems satisfied so far…

Ok, here’s a much simpler example that shows how the UI fails to update.

Maybe it’s not an HA-specific issue, but the javascript library not updating the “select”. Because I can see HA send the updated select value via the websocket, but it just doesn’t show up in the UI.

Update: that said, if you remove the input_select.reload the UI updates. So, maybe a timing issue – although a delay doesn’t fix.

  1. create a input_button helper
  2. create two input_selects.
    They have to be in YAML not in the helper UI because input_selcte.reload only reloads the YAML ones.
    (input_select.reload is simply to avoid having to restart HA core.)
input_select:

  bar_select_one:
    name: Bar Select One
    options:
      - Nothing Selected

  bar_select_two:
    name: Bar Select Two
      - Nothing Selected
  1. Use this automation (updating for the entity_id of your input_button):
Automation
description: ""
mode: single
triggers:

  - trigger: state
    entity_id:
      - input_button.foo_reset_selects
    id: reset_selects

  - trigger: homeassistant
    event: start
    id: ha_restarted

conditions: []
actions:
  - alias: If not really restarting force a reload of input_selects
    if:
      - condition: trigger
        id: reset_selects
    then:
      - action: input_select.reload
      - delay: 1



  - alias: Set the options
    action: input_select.set_options
    target:
      entity_id: input_select.bar_select_one
    data:
      options:
        - Nothing Selected
        - Three
        - Four
        - Five

  - alias: Then "restore" the selected option
    action: input_select.select_option
    target:
      entity_id: input_select.bar_select_one
    data:
      option: Three

  
  - alias: Repeat the same as above for the second select
    action: input_select.set_options
    target:
      entity_id: input_select.bar_select_two
    data:
      options:
        - Nothing Selected
        - Six
        - Seven
        - Eight
  - action: input_select.select_option
    target:
      entity_id: input_select.bar_select_two
    data:
      option: Seven

  - alias: Log what the CURRENT select values are
    action: system_log.write
    data:
      message: |-
        input_select-two 
        state="{{ states('input_select.bar_select_one') }}"
        options="{{ state_attr('input_select.bar_select_one','options')|join(', ') }}]"
            
  - alias: Log what the CURRENT select values are
    action: system_log.write
    data:
      message: |-
        input_select-one 
        state="{{ states('input_select.bar_select_two') }}"
        options="[{{ state_attr('input_select.bar_select_two','options')|join(', ') }}]"

This is just entities:

And when I press “Foo Reset Selects” the UI doesn’t refresh:

But my logs (or Debug->States) show that the state (and options) are indeed updated.

2025-11-06 11:48:36.891 ERROR (MainThread) [homeassistant.components.system_log.external] input_select-two
state="Three"
options="Nothing Selected, Three, Four, Five]"
2025-11-06 11:48:36.894 ERROR (MainThread) [homeassistant.components.system_log.external] input_select-one
state="Seven"
options="[Nothing Selected, Six, Seven, Eight]"

Now, looking at the websocket I can see the updated options are being sent to the browser. Indeed the browser’s select does have the options.

{
    "type": "event",
    "event": {
        "c": {
            "input_select.bar_select_one": {
                "+": {
                    "lu": 1762459520.5686648,
                    "c": {
                        "parent_id": "01K9DCC1XEM95QYE2PVJMDTJQM",
                        "id": "01K9DCC1XG0N4PYMXZVE5CCBFE"
                    },
                    "a": {
                        "options": [
                            "Nothing Selected",
                            "Three",
                            "Four",
                            "Five"
                        ]
                    }
                }
            }
        }
    },
    "id": 3
}

And I can see the websocket send a message with the updated value, but the UI browser doesn’t select it.

{
  "type": "event",
  "event": {
    "c": {
      "input_select.bar_select_one": {
        "+": {
          "s": "Three",
          "lc": 1762459520.5718327
        }
      }
    }
  },
  "id": 3
}

There’s no error in the broswer log, though.