default-dashboard icon indicating copy to clipboard operation
default-dashboard copied to clipboard

Dropdown helper not keeping state

Open patrickli opened this issue 2 years ago • 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?

patrickli avatar May 03 '23 00:05 patrickli

Did a test by removing this plugin and restart HA. The value is still reset. This doesn't make any sense.

patrickli avatar May 03 '23 02:05 patrickli

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.

patrickli avatar May 03 '23 04:05 patrickli

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.

hellomarb avatar Oct 31 '23 01:10 hellomarb