I have been interested in writing this up myself but haven’t had the time to actually dig into the code of home assistant and see how difficult it would be. So, I am opening this topic to see if anyone may be interested in doing it themselves.
I would love to be able to change the background of a dashboard to be the daily image from bing, as a bonus be able to get the title/information as well.
I can access this information from inside home assistant or create a sensor for it relatively easily, however I am unsure of how to actually turn it into the dashboards wallpaper.
I got something somewhat working using the following, but it probably needs a custom theme designed around it which I am not as familiar with, I may dive deeper into this to see if I can make a theme that looks alright. If I never get back to this I hope it can help someone else.
Inside your configuration.yaml place the following this will run a rest request for the bing api to grab the url path.
Finally I found a solution which I think is not all that bad. It’s a mix of your solution with some python script.
Sources:
downloader
Dynamic images
Python scripts
→ For the download service
Add folder “www” to the config path
Add folder “www/bing” to the config path
→ For python scripts
Add folder “python_scripts” to the config path
Add file “download_bing.py”
# get url from the sensor as attribute
url = 'http://www.bing.com' + hass.states.get('sensor.bing_daily_wallpaper').attributes['url']
# `logger` and `time` are available as builtin without the need of explicit import.
logger.info("Start download bing image {} at {}".format(url, time.time()))
# call the service to download the file
service_data = {"overwrite": True, "url": url, "subdir": "bing", "filename": "wallpaper.jpg"}
hass.services.call("downloader", "download_file", service_data, False)