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

Remove input initial

Open patrickli opened this issue 2 years ago • 9 comments

Fixes #6

patrickli avatar May 03 '23 07:05 patrickli

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.

deviantintegral avatar Jul 03 '23 19:07 deviantintegral

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.

patrickli avatar Jul 03 '23 21:07 patrickli

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.

deviantintegral avatar Jul 03 '23 21:07 deviantintegral

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.

patrickli avatar Jul 03 '23 21:07 patrickli

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

deviantintegral avatar Jul 04 '23 01:07 deviantintegral

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

daredoes avatar Jul 06 '23 21:07 daredoes

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

daredoes avatar Jul 06 '23 21:07 daredoes

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.

patrickli avatar Jul 06 '23 21:07 patrickli

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

daredoes avatar Jul 06 '23 21:07 daredoes