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.81k stars 30.51k forks source link

If setting options via UI, input_selects will retain them over restarts - however they don't, when setting options via service #109820

Closed v1-valux closed 5 months ago

v1-valux commented 8 months ago

The problem

o/ Hey community!

I'm searching for an explanation and/or alternative solution for the following problem:

As stated here and here, the input_select helper-domain behaves differently on attributes (options) and states when it comes to restarts..

I could imagine, that only the state of an helper gets "permanently" saved.. E.g. if otherwise changing an UI-created input_text via service, the text (state) remains if rebooting (or reloading config).. Same as saving the text-state via UI of course..

However if setting options-attributes of an input_select via service, only the state (current option) remains after a reload... And if setting options via UI, it does indeed save the options aswell over reloads.. This was a little confusing and I wondered if there is any way to "fix" my initial problem:

Initially I wanted to save some items from my Picnic-Shopping List for later use.. but as I need to do that via service, I would need a way to permanently save multiple values somewhere.. Is there any best practice to store such data within entity(-attributes) permanently (at least until I manually reset it?)

Many thanks for your support

What version of Home Assistant Core has the issue?

core-2024.1.6

What was the last working version of Home Assistant Core?

core-2024.1.6

What type of installation are you running?

Home Assistant OS

Integration causing the issue

input_select

Link to integration documentation on our website

https://www.home-assistant.io/integrations/input_select/

Diagnostics information

No response

Example YAML snippet

service: input_select.set_options
metadata: {}
data:
  options: |
    {{ (state_attr('input_select.' ~ category_id,'options')) | list + [item] }}
target:
  entity_id: input_select.{{ category_id }}

Anything in the logs that might be useful for us?

No response

Additional information

I am aware that using a todo-list for storing those items would be an option.. But as I need to access them from my lovelace-dashboard, I would need to have them accessible via states or attributes - e.g. to use them in custom-cards like Auto-Entity-Card..

home-assistant[bot] commented 8 months 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)

issue-triage-workflows[bot] commented 5 months ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.