I can use a script downloading the entity_picture to a webserver for this. Kind of ugly but works. However still an issue with the cache. Not sure how to proceed with that.
#!/usr/bin/env python3
import homeassistant.remote as remote
import urllib.request
import time
def main():
while True:
media_picture_address = None
api = remote.API('127.0.0.1', 'password')
living_room = remote.get_state(api, 'media_player.living_room')
kitchen = remote.get_state(api, 'media_player.kitchen')
if living_room.state == 'playing':
media_picture_address = 'http://domain.se' + str(living_room.attributes['entity_picture'])
elif kitchen.state == 'playing':
media_picture_address = 'http://domain.se' + str(kitchen.attributes['entity_picture'])
if media_picture_address:
urllib.request.urlretrieve(media_picture_address, "/home/homeassistant/.homeassistant/www/media_picture")
time.sleep(1)
if __name__ == "__main__":
main()
i think we have to wait untill andrew comes up with a solution for the cashing problem.
i have a workaround for that but its dirty.
create a dashboard with only an image
then in the original dashboard create an iframe widget that loads that dashboard as url.
it forces a recompile and a reload.
remember that it will generate lots of entries in your log
and on my tablet i use it to change between 3 cameras, but it gets a bit slow sometimes. (i think my tablet is having trouble with it )
is the media_entity_picture dash working?
and probably you should lose the refreh there completely.
with these settings you try to download the pic every second and the dash every 10 seconds.
dont set them in the pic dash and set it to 15 or higher in the music dash.
I found a way around it.
You can force the browser to not use the cached image by adding “?random text/numbers” after the image url.
like so…
<img src="picture.jpg?1222259157.415" alt="">
So I edited the widget.
“appdaemon/widgets/baseiframe/baseiframe.js”
To …
else if ("img_list" in self.parameters)
{
var random = "?"+Math.random()
self.set_field(self, "img_src", "".concat(self.parameters.img_list[self.index],random));
size = self.parameters.img_list.length
}
Then rebuilt the docker image…
Now I don’t need to use another dashboard.
Instead this works now… I get a new image every time.
Okay now I started using acockburn/appdaemon from dockerhub and need to do the same change in here. Not sure how I do because if i change the baseiframe.js file the change wont bite. Any thoughts? @ReneTode@aimc
If I copy my changes into the baseiframe.js inside my docker container and restart the container its still like the dashboard is using an unchanged js file.