How to turn off caching a panel in home assistant?

Hi!

I’m working on creating a custom dashboard in home assistant and so far it’s working great on desktop.

And I was able to integrate it directly into a custom home assistant panel pretty easily by adding this to my configuration.yaml and copying my build to the www folder.

panel_custom:
  - name: react-panel
    sidebar_title: Dashboard
    sidebar_icon: mdi:home-assistant
    url_path: react-panel
    js_url: /local/react-panel/assets/index.js
    embed_iframe: true
    config:
      name: World

However I noticed when using home assistant it caches my build files… So if I make a new build and copy over the files, and refresh the browser it doesn’t update.

On desktop I can force update it by restarting my home assistant (which isn’t ideal but at least it works).

However when using the home assistant app on my iPhone and iPad, even a restart of home assistant doesn’t clear the cache and let me see / use a newer version of my dashboard.

The only way I have found to get home assistant to show the latest files has been to remove the app from my device entirely and re-install home assistant, and then log in again, which is a huge pain as I’m actively trying to use this while I’m working on it.

Is there any way to turn off these strict cache policies or at least lower them to only be cached for e.g. 1 hour?

You should also be able to do this by refreshing the page with the web browser inspector open (assuming you have enabled the setting - cache disabled when the inspector is open - in the inspector).

For the mobile apps you can go to Settings > Companion App > Debugging > Reset Frontend Cache. Then go back to the dashboard and pull down to refresh.

3 Likes

@tom_l Hmm I did try the “disabled cache” on my browser while developing it, but it doesn’t seem to be enough to get home assistant to refresh it.

On the app though, so happy to see there’s a reset cache button in there. Thank you! :pray: Much more reasonable than deleting the app and reinstalling every time I want to use the latest version.

You have to have the inspector open and refresh the page while it is open. Sometimes more than once.

@tom_l
I am using companion app on android and I don’t see the debugging and Reset Frontend Cache option.

Can you please help?

.

Regards,
Vaibhav

you probably need to click your user in home assistant and enable advanced settings first.

Advanced mode is already enabled.

Do you have an android phone?
Do you mind sharing screenshots of the setting on your phone?

Thanks,
Vaibhav

I have the same problem - no “Companion App->Debugging” option on Samsung S22. Here are some screen shots



Same issue here. 2022 model Fire 7 tablet.

I’ve been able to clear the cache using the following steps:

  1. Enable remote WebView debugging in the app settings
  2. Enable USB debugging in the Android settings
  3. Connect with a USB to PC
  4. Download and install Chrome web browser on the PC
  5. Navigate to chrome://inspect URL
  6. Open the companion app on the phone again
  7. Connect (aka inspect) to the webpage
  8. In the Application tabs of the chrome Dev tools find the Service Worker and unregister it
  9. Refresh the webpage using the refresh button in the top left corner of Chrome
  10. Uninstall and delete the Chrome web browser (optional)
4 Likes

Shame that ther is no clear cache for android app as it is using browser in the backend.

1 Like

I woud expect the usual Android app cache is used that is managed through settings:
settings → Apps → Home Assistant → Storage → Clear cache

Tried that, didn’t work. The images are still in cache.

Same issue here. No debugging option in app on Android.

It worked by clearing app cache from Android app settings.