Skip to content

Remove input initial#7

Open
patrickli wants to merge 2 commits into
daredoes:mainfrom
patrickli:remove-input-initial
Open

Remove input initial#7
patrickli wants to merge 2 commits into
daredoes:mainfrom
patrickli:remove-input-initial

Conversation

@patrickli

Copy link
Copy Markdown

Fixes #6

patrickli added 2 commits May 3, 2023 19:43
This way the selected values can be restored after HA restart.
@deviantintegral

Copy link
Copy Markdown

I tried this out and it doesn't seem to be working for me. When I restart the setting still flips back to lovelace. @patrickli can you confirm that if you log in with a private browsing session that you get redirected?

I forked the repo and merged this in for testing, in case anyone else wants to try: https://github.com/deviantintegral/default-dashboard

Also, the actions in this repo use the latest nodejs release, and it looks like builds are broken on node 18.

@patrickli

Copy link
Copy Markdown
Author

I actually can't reproduce this right now. Despite restarted HA a few times the redirection to set the default dashboard on the first login always works. It's annoying that you have to login a couple of times if "remember me" is not selected but that's a different issue.

@deviantintegral

deviantintegral commented Jul 3, 2023

Copy link
Copy Markdown

I figured out the issue. I didn't really understand this PR. If you start with the released version, create the input select, and then switch to this PR, the initial value isn't changed. You can either recreate the input_select, or edit config/.storage/input_select and remove initial.

I have a few tags now as I was debugging this. The best one for others to test is https://github.com/deviantintegral/default-dashboard/releases/tag/1.1.2-fix-builds.

@patrickli

Copy link
Copy Markdown
Author

Yes that's right. I probably have manually edited the input_select file so I can't reproduce this now.

But if you are on the release version this bug should be there.

@deviantintegral

Copy link
Copy Markdown

I have two HA installs, and was having real difficulty with the second one.

I noticed in the one that was working that .storage/input_select had the list of dashboards set as options. Yet, in the one that wasn’t, the only option was refresh. It’s as if calling input_select.set_options was only saving it in memory and not persistently. From looking at the docs, I see no reason to think that it shouldn’t be persistent: https://www.home-assistant.io/integrations/input_select/#services

@daredoes

daredoes commented Jul 6, 2023

Copy link
Copy Markdown
Owner

I just noticed this activity. I will look at this soon and get a new versions out there. Thanks for all the work!

@daredoes

daredoes commented Jul 6, 2023

Copy link
Copy Markdown
Owner

So I think the appropriate way to handle this is to modify the function that creates the input select and boolean toggle automatically for the user. Perhaps it is not effectively checking if these already exist, and thus resetting the existing input select instead of skipping the creation step.

https://github.com/daredoes/default-dashboard/blob/main/src/default-dashboard.ts#L75

@patrickli

Copy link
Copy Markdown
Author

So I think the appropriate way to handle this is to modify the function that creates the input select and boolean toggle automatically for the user. Perhaps it is not effectively checking if these already exist, and thus resetting the existing input select instead of skipping the creation step.

https://github.com/daredoes/default-dashboard/blob/main/src/default-dashboard.ts#L75

I didn't look too much into the creation process. But regardless, we need to remove the initial parameter so it won't get reset every time HA restarts.

@daredoes

daredoes commented Jul 6, 2023

Copy link
Copy Markdown
Owner

I see what you're saying. I'll test it out soon and give it a new release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dropdown helper not keeping state

3 participants