Nezz / homeassistant-visionos-theme

Theme inspired by visionOS for Home Assistant
MIT License
55 stars 4 forks source link

Change Background Image #5

Closed myk3y55 closed 2 months ago

myk3y55 commented 3 months ago

Firstly, thank you for the great work you have put into this custom component! The issue i have is that i cannot seem to be able to change the background image when using visionos theme. The default ha background image feature does not work, neither is changing the actual images in the theme folder (with the same name night.jpg or day.jpg). I should mention that i restarted ha after each change and the default visionos theme image still persists.. I've set visionos theme for each dashboard view individually and not from the user settings. Running ha 2024.8.2

Nezz commented 3 months ago

You can set a custom dashboard background from the UI.

If you want to fix the root cause of the problem, note that the theme uses images served by HACS. There a couple ways to fix this:

  1. Install the theme using HACS if your home installation supports it
  2. Disable experimental mode in HACS from Settings > Devices & services > HACS > Configure. In experimental mode themes can't serve images.
  3. If the above does not help our you cannot use HACS, follow the steps here and change the URL in visionos.yaml from /hacsfiles/themes to /local/themes
myk3y55 commented 3 months ago

Thanks for the quick reply! I tried all of the above and didn't work for me. Changing the bg image from the ui does nothing, the default theme image still persists. Experimental mode was ticked off and changing the file location from /hacsfiles/themes to /local/themes and even /config/themes only resulted in no bg image at all (even when changing bg image from the ui). I did a ha restart after every change as well just to be sure. Checked on both computer browser and ios ha app with same results. Maybe this is due to some changes in the latest ha updates? I will try various other things and report back if i find anything

Nezz commented 3 months ago

If changing the background image from the UI doesn't do anything then there is probably something specific in your HA installation causing this that you'd need to debug yourself. You should be able to see from your browser's inspector what happens to the network request that tries to retrieve the background image.

rohankapoorcom commented 3 months ago

Since HACS 2.0 has gone out today (this releases experimental mode and there is no longer a way to turn it off), I would recommend loading the background images through base64 instead as that's the best path forward for themes to ship their own images. You can see my example of how to do this here: https://github.com/basnijholt/lovelace-ios-themes/pull/70

Nezz commented 3 months ago

Thanks for the heads-up @rohankapoorcom. My main reservation was that images can be cached, but if we serve it in the theme then I think we always need to transfer a megabyte worth of image when loading the dashboard. It might be better to put the image on an external site to keep dashboard loading quick.

rohankapoorcom commented 2 months ago

I agree that it's a downside, but removing support within HACS is an intentional architectural decision (https://github.com/hacs/integration/issues/3751#issuecomment-2144327287).

Personally, I wouldn't want to manage backgrounds independently of the theme and I don't like the idea that a theme doesn't ship completely ready to go from HACS. And I would rather have the slightly slower page load compared to downloading from an external CDN (defeats the purpose of serving everything locally).

Nezz commented 2 months ago

Version 1.2 has been released that supports HACS 2.0.