daredoes / default-dashboard

Automatically set the default dashboard for all devices for Home Assistant
MIT License
42 stars 2 forks source link

Dropdown helper not keeping state #6

Open patrickli opened 1 year ago

patrickli commented 1 year ago

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 commented 1 year ago

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

patrickli commented 1 year ago

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.

hellomarb commented 10 months ago

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.