Need to refresh my iPad companion app / reconnect it to browser_mod when HA restarts

Hello! I don’t much understand about frontend stuff, and I need a bit of help.

I’m trying to get Home Assistant Companion to basically reload the page, so that browser_mod kicks in. Every time I restart Home Assistant (upgrade, YAML config change, system update and reboot), the Companion app continues to work just fine, but all browser_mod entities show as unavailable. This is only remedied by manually gesturing on the iPad display to refresh the Companion screen.

Obviously this is not what I want to be doing, with multiple screens around the home. It’s also not very fun when I change from Wi-Fi to 4G on my phone, and then browser_mod just stops working, as none of the features of browser_mod will work then.

So my goal is to write a bit of JavaScript that detects Home Assistant has restarted — I imagine by using some sort of either polling or looking into a WebSocket bus event — and then orders an automatic refresh of the current view across all registered mobile devices. Perhaps it could even be triggered by a notification sent by the server (one of those that displays a popup like "Your dashboard has been updated [REFRESH?]") and my JavaScript bit would see that, then call location.refresh() or something like that. (Even better, perhaps I can tell browser_mod itself to just reconnect — saving me the refresh altogether!)

Can anyone please me point to code that does anything similar, or interacts with any of these components in any way, so that I may then write a HACS extension which does this automatically? I’ve seen other threads¹ but nobody seems to have a solution to this issue. The closest anyone has gotten has been to tell people “install fully kiosk”… which obviously won’t work on an iPad, won’t work on an x86 tablet running Linux either², and I also don’t want to do on my phone because, well, it’s not a kiosk to begin with.

Thank you.

¹ [SOLVED] How can I get my dashboard to refresh automatically, instead of showing the "Refresh?" prompt? - #15 by jasonhk
² For Linux users — I gotcha buddies! I will soon be writing a complement to Control your Linux media players from Home Assistant! which will let you remotely control a Linux desktop (inject keystrokes / select foreground app / stuff like that), so you can e.g. fire up a Firefox / Chromium refresh remotely from Home Assistant.

Hi

Were you able to solve it?

With the hackiest hack. Using an ESP device as a BLE keyboard to send keystrokes to the iPad when HA restarts.