Change background of skin dynamically

Hello everyone!

I’m using the clear_sky skin with a photo as a background but I would love to have an automatic rotation in it by providing a list of URL’s to photos and it would change every day or week or so? Is this possible?

Looking forward to hearing from you!

JeBy

1 Like

it is possible.
you need to create a javascript that does that and include that script in the head (see upper part variables.yaml)
i think 1 of the included skins has something like that, so you might want to take a look at it.

Oh yeah why didn’t I think of that? :sweat_smile: Javascript rules! I’ll give it a go :grinning:

Do you think I can then link the action “change background” to a button on my dashboard if I want to change it manually?

Thanks a lot for the help Rene!

Also, I installed my skins through git but now when I try to add any of my own images in the img folder like where the original background image ‘background_1.jpg’ was, the file name turns up red and I can’t seem to link to them in the css? I’m using HASS Configurator to manage my files btw.

i never worked with hass configurator.
i can only tell you where your files should be and what to do with it.

in your configuration directory (where appdaemon.yaml is) you need to have a directory custom_css
in that directory you make a subdir for each skin.
those subdirs need to have 2 files, variables,yaml and dashboards.css

those files can be manipulated.

a button can be created with javascript, but not inside the dashboard (on the side top or bottom is possible)
in theory you could create a custom widget to change the background, but there is no existing 1 for that.

Actually, the latest AppDaemon beta included a JavaScript widget that should let you do exactly that - it lets you run an arbitrary javascript command when it is pressed. I can’t check now but I think it is in beta3, if not it will be in beta4.

its in the docs, so i guess the running version.
i didnt notice that one, but probably because of my english, i had/have no idea what to think by “arbitary javascript command”

i think we need to think about a little more explenation in the docs there. :wink: