Dropdown helper not keeping state
patrickli opened this issue · 3 comments
I've installed the latest version of the plugin (1.1.1) via HACS. It created the 2 helpers and loaded all my dashboards automatically. Then I selected the default with the dropdown helper and everything works as expected.
However when I restart HA, the value of the dropdown is reset to lovelace
. I tested creating a another dropdown and that kept its selection after restart, just not the one created by this plugin. The boolean toggle also behaves the same, ie, if I turn it off, then restart HA, it will be come on again.
I have checked the core.restore_state
file and it does store the selected value after you change it, but somehow it will be reset after HA restart.
A unreleated question if you can answer. How can I re-refresh the list of panels if I add/remove some?
Did a test by removing this plugin and restart HA. The value is still reset. This doesn't make any sense.
OK. There is an initial
value set in the definition of the inputs. That's whats caused the issue. Can we remove this line? https://github.com/daredoes/default-dashboard/blob/main/src/controller.ts#L39
Should probably do the same for the boolean input.
I created an automation as a workaround until the fixed version:
alias: "After Start: Set Default Dashboard"
description: ""
trigger:
- platform: homeassistant
event: start
condition: []
action:
- service: input_select.set_options
data:
options: dashboard-minimalis
target:
entity_id: input_select.default_dashboard
- service: input_select.select_option
data:
option: YOUR-DASHBOARD-NAME
target:
entity_id: input_select.default_dashboard
mode: single
That will skip the reset to refresh
and will set the given dashboard name.
For me that is working for now.