Howto: change HA lovelace tab in Android wallpanel app without reload

I just want to share something what took me some time to find out.

Usecase:
When someone presses my doorbell, I want my wall mounted Android tablet to show a picture of the person who pressed the bell.
I’m using the Android Wallpanel app.

Howto wake up the tablet:
Easy with the Wallpanel app MQTT interface send a wake command.

Howto change the active TAB:
Option 1: send a url reload with MQTT to the tablet. A complete reload is not fast enough.
Option 2: browser_mod: navigate option. Overkill I think.
Option 3:
Send a MQTT eval javascript to the Wallpanel android app:

Use this Javascript:
history.pushState(null, "", "/lovelace/frontdoor-picture"); window.cardTools.fireEvent("location-changed", {}, document.querySelector("home-assistant"));

You need card-tools for this to work:
https://github.com/thomasloven/lovelace-card-tools

Why not just use browser_mod?
I think it’s a little overkill if you only need to navigate. And my wallpanel tablet is not the fasted, so less JS is better.
And browser_mod is generating JS errors in Android WebView. At least in my Android emulator running the Wallpanel app.

1 Like