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
72.67k stars 30.43k forks source link

Issue with input_select: options added via code disappear after restart #124636

Open Marvelous94v opened 1 month ago

Marvelous94v commented 1 month ago

The problem

I am experiencing an issue with the virtual dropdown list (input_select) in Home Assistant. When I add new options using code, they are added without any problems. However, when I go to the settings, I only see the values that were added manually, not the ones added via code. The main issue is that all values added via code disappear after a restart, leaving only the manually added values.

What version of Home Assistant Core has the issue?

6.6.46-haos

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

input_select

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

Steps to reproduce the issue

Create an input_select entity: Define a dropdown list in your Home Assistant configuration file with a couple of initial options.

Add new options via code: Use a service call in Home Assistant to add more options to the dropdown list programmatically.

Check the options in the settings: Open the Home Assistant UI and navigate to the settings of the dropdown list. You will see only the manually added options.

Restart Home Assistant: Restart Home Assistant. After the restart, the options added via code will disappear, leaving only the manually added options.

home-assistant[bot] commented 1 month 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!

Code owner commands Code owners of `input_select` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign input_select` Removes the current integration label and assignees on the issue, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


input_select documentation input_select source (message by IssueLinks)

mib1185 commented 1 month ago

Hi @Marvelous94v

I guess you mean the input_select.set_options service? It is not intended to change the configuration of the input select helper, but add or set the list of options "on the fly" (dynamically during runtime). If you want to permanently change the list of options, you've to reconfigure the helper.

Marvelous94v commented 1 month ago

Hi @mib1185

Yes, I am using this service to update the list of options. In the context of my task, I have an access control system (ACS) that is constantly updated with a new list of people, and the selection from the list is done manually (assigning a person to a workplace). I assumed that this service works this way, at least it works until a restart.

I find it difficult to imagine how to use this service if it changes the options but not permanently. Maybe it makes sense to implement this functionality? I think this concept can be applied in many areas. Or is there a programmatic method to change the options permanently? I assume you suggested updating the helpers manually, but unfortunately, this is not an option in my case.

mib1185 commented 1 month ago

I find it difficult to imagine how to use this service if it changes the options but not permanently.

This is the current implementation of this service and I think there is no service at all, which changes any configurations, yet.

Maybe it makes sense to implement this functionality? I think this concept can be applied in many areas. Or is there a programmatic method to change the options permanently? I assume you suggested updating the helpers manually, but unfortunately, this is not an option in my case.

Please use the feature request section of our forum for this, thx! 👍