Hi,
I have one small issue on my android tablet, just curious if anyone else had similar problems.
I have automation that changes between light and dark themes 2x per day (on sunset/sunrise), and most cards change colors completely, however some stay inbetween- some colors are changed, some are not. I can resolve the issue if I manually switch to another dashboard and then back (apparently it does some refresh), or by homeassistant.restart service. Since neither is particularly great solution, I’m wondering if there’s a simpler way to “refresh” active dashboard?
HA core 2021.12.10, Companion app 2022.1.1
Thanks!
UPDATE: forgot to write that same behaviour is on Android 10 phone but not on PC.Tomorrow will check also on iPhone.
[Maybe this will be useful to somebody else: I have tablet running Android 8 that doesn’t support automatic light/dark change in the system. So by playing around I found a bypass - on tablet I keep theme on Backend-selected and dark, and with automation via frontend.set_theme service I change themes but for light mode. Sounds silly, but somehow works.]
I was actually able to use this solution for my problem: [SOLVED] How can I get my dashboard to refresh automatically, instead of showing the "Refresh?" prompt? - #2 by ndbroadbent . It’s not the cleanest solution, but it works. Refresh button does not produce any event, however there is an event when Lovelace is updated. So I implemented the above code (that triggers on Lovelace update), and I just force the same event when I need Lovelace refresh.
And it refreshes my tablet and resolves initial problem!
Hopefully it’ll be useful to somebody down the line…
This is great, I also need this as my wall tablet doesn’t switch the theme from light to dark and reverse at sunset/sunrise without me manually refreshing the page. I was wondering how you manually forced the same event to occur? Could this be done with an automation, or perhaps in node red with the sunrise/sunset and trigger event functions? Specifically how to fire that exact event is what is confusing me. Thanks for your efforts!
At the bottom you can see where the event is called; this event then triggers the custom.js which refreshes the Lovelace - “lovelace_tablet” is the name of the dashboard that is running on my tablet (I only call it in the afternoon as tablet turns on after sunrise so it’s not necessary in the morning)
-I added a small delay in between as it seems to work better with it
You can go to Developer tools → Events and listen to lovelace_updated then manually make a change on the lovelace that is on tablet and save it and then check which event has been triggered.