Hi everyone, I just revisited this topic since Iām setting up a Amazon Fire Tablet (with the Fully Kiosk app.)
I updated the JS to handle the changed notification message and itās working again:
function refreshOnLovelaceChange() {
const urlSearchParams = new URLSearchParams(window.location.search)
if (urlSearchParams.get('kiosk') !== 'true') { return }
const ha = document.querySelector("home-assistant")
if (!ha || !ha.shadowRoot) return
const nm = ha.shadowRoot.querySelector('notification-manager')
if (!nm || !nm.shadowRoot) return
const haToast = nm.shadowRoot.querySelector('ha-toast')
if (!haToast) return
if (haToast.text.includes('dashboard was updated')) {
console.log("Refreshing page...")
location.reload()
}
};
setInterval(refreshOnLovelaceChange, 500);
I also added a check for the ?kiosk=true query param since I only want auto-refresh to happen in kiosk mode.
@RayLation Thanks for the tip, thatās a great idea! Home Assistant has a really nice FullyKioskBrowser app integration as well, which calls the remote API:
It has a load_start_url button that you can press to reload the initial URL. So Iāve set this up with an HA automation:
alias: Reload Home Assistant on Fire Tablet when Lovelace is updated
description: ""
trigger:
- platform: event
event_type: lovelace_updated
condition: []
action:
- service: button.press
data: {}
target:
entity_id: button.fire_tablet_load_start_url
mode: single
This works really well and reloads the page instantly, instead of waiting for a few seconds. Thanks!
