home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.68k stars 30.81k forks source link

input_select changes options permanently (to prior options) after switching between values #77981

Closed therealjsie closed 2 years ago

therealjsie commented 2 years ago

The problem

Hey everyone,

I've set up a new HA instance, and I'm running into a recurring problem that I can't pin down. I'll start with the problem description and then run down the steps that got me here:

I've got an input_select defined in YAML containing a couple of options, e.g. scene.living_room_bright, scene.living_room_dim, etc. I've got an automation that automatically triggers when the input_select value is changed to activate a scene in the living room. This works fine until something happens and the input_select options change to Bright, Dim, etc. (obviously these values don't work with the aforementioned automation).

These values correspond to the values I chose when I initially created an input_select through the UI. However, I've deleted any input helpers that I've created through the UI. I'm unsure why these leftover values still show up, or why they replace the values that are defined in the input_select.yaml.

I can trigger the switch between the new/wanted values and the old values through the state menu in the developer tools. Changing from scene.living_room_dim to scene.living_room_bright will reproducible alter the input_select values. Changing the values the other way around (bright->dim) will not alter the values. However, the same behavior can be triggered through the UI (i.e. with a dropdown field).

I've found that these old/deprecated values show up in the config/.storage/core.restore_state file. However, I'm not sure if this is connected to this behavior in any way.

The following screenshots show the gist of what I tried to describe above:

Before:

image

After:

image

These are the events leading up to the problem (changing bright->dim, dim->bright). The automation does not meddle with the input values (I'll attach the corresponding YAML):

image

Restarting the server will reset the input_select values to the wanted values (that's until they are altered by the process described above or by other interactions).

Here are the relevant configs:

default_config:

automation manual: !include_dir_merge_list automations/
automation ui: !include automations.yaml

input_select: !include input_select.yaml

script: !include scripts.yaml
scene: !include scenes.yaml

[...]
- id: "14041987000305"
  alias: "Living room: Cycle through scenes"
  description: ""
  trigger:
    - device_id: 077f7b281b63565e5b4e3139bc941eb4
      domain: zha
      platform: device
      type: remote_button_short_press
      subtype: turn_off
  condition: []
  action:
    - service: input_select.select_next
      data:
        cycle: true
      target:
        entity_id: input_select.living_room_scenes
  mode: single
living_room_scenes:
  name: "Living room: Scenes"
  options:
  - "scene.living_room_bright"
  - "scene.living_room_dim"
  - "scene.living_room_movies"
  initial: "scene.living_room_bright"
  icon: "mdi:form-dropdown"

Let me know if you need more information.

What version of Home Assistant Core has the issue?

version: 2022.9.0
version_latest: 2022.9.0
update_available: false
machine: generic-x86-64
arch: amd64
image: ghcr.io/home-assistant/generic-x86-64-homeassistant
boot: true
port: 8123
ssl: true
watchdog: true
audio_input:
audio_output:

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

No response

Link to integration documentation on our website

No response

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

probot-home-assistant[bot] commented 2 years ago

input_select documentation input_select source (message by IssueLinks)

probot-home-assistant[bot] commented 2 years ago

Hey there @home-assistant/core, mind taking a look at this issue as it has been labeled with an integration (input_select) you are listed as a code owner for? Thanks! (message by CodeOwnersMention)