For my HA dashboard I am using .dash and .yaml files everything is linked and working (main.dash - floor 1, 2, 3, 4 and each floor breaks up into the single rooms)
The only thing missing which I try to accomplish is having a unique background image for the main dash, the same background image for floor 1, 2, 3, and 4 and again a unique background image for the single rooms.
A big thanks goes to “renetode” who guided me towards the right direction.
I searched around and figured I need a javascript which adds the function to change the background image for each dashboard.
I wanna be honest, I don’t have a d… glue how to write that. I can tune and tweak code but I am not able to write code.
Is anybody out here who has a similar problem or an idea how to realize this?
I found some example code pieces but don’t know if they’re the right ones and where to put them. using Jquery
first you need to create a custom skin. (how to is in the docs)
in the custom skin there are 2 files:
dashboard.css and variables.yaml
in the variables.yaml you need to find this section
#
# Custom head includes - should be a YAML List, e.g.:
#
#head_includes:
# - some include
# - some other include
#
# Text will be included verbatim in the head section of the doc, use for styles,
# javascript or 3rd party css etc. etc.
#
# It is your responsibility to ensure the HTML is correct
#
here you can put a piece of code like you found to change the background on every reload.
when you get that far and have that working you can adapt the code to change the background based on the dashboard name.
This code needs to be placed under " head_includes: " in your variables.yaml file.
You just need to make sure that dashboard name and image name are the same like ( main.dash = main.jpg ).
Also, you need to adjust the line : “var Image = ‘/custom_css/blur_light/img/’ + filename + ‘.jpg’” to your file system. For example (’/custom_css/other_skin/img/’) or (’/custom_css/day_light/img/’).
this also finds the skinname.
so the code can be copy pasted into any skin and will work without changing anything.
all it needs is an img directoty in the skin dir with the images.
This worked perfectly and I am totally new to html and css code and tags. Spent a few hours trying to edit individual dash filed and adding background-image tags directly, but was having no luck and then found this and this worked like a charm. Thanks for providing the solution @ino and for editing the code to make it universally applicable @ReneTode.