I gave up since all the tips they gave me were not working , so my advice is to… give up,
at least we know where the problem is.
its in the configuration.yaml
the first thing now to check if the token changes with every picture and if you can view the picture without the token.
if you need the token to view the picture and/or its constantly changing its gonna be hard but not impossible.
first off all you have this:
still_image_url: http://192.168.1.203:8123/media_player_proxy/media_player.living_room?{{ states.media_player.living_room.attributes.token}}
as url. but that will never work because you dont set the token there.
it should at least be:
still_image_url: http://192.168.1.203:8123/media_player_proxy/media_player.living_room?token={{ states.media_player.living_room.attributes.token}}
that could get your cam to work in HA.
Thank you! I’ve gotten it working. I was missing 2 pieces:
I was missing:
?token= before the template
and my original still_image_url was missing the api from the path, ie the working url is:
still_image_url: http://192.168.1.203:8123/api/media_player_proxy/media_player.living_room?token={{ states.media_player.living_room.attributes.token }}
Then this is my dashboard item config, and it would indeed seem that appdaemon understands the templating
media_art:
widget_type: camera
entity_picture: http://192.168.1.203:8123/api/camera_proxy/camera.generic_camera?token={{ states.media_player.living_room.attributes.access_token }}&api_password=ImNotTellingYouThat
refresh: 10
For reference for anyone searching this later, I’m using a raspbian manual installation.
so after a whole lot of messing around with this, I finally got it working for my setup so I thought I’d share what I did.
I ended up completely bypassing the generic camera aspect and went directly from the dashboard to my media player entity. The only thing I needed to add was in the dashboard config itself, mine looks like this:
media_art:
widget_type: camera
entity_picture: https://xxx.xxx.xxx:8123/api/media_player_proxy/media_player.spotify?token={{ states.media_player.spotify.attributes.token }}&api_password=xxxxxx
Obviously this is for spotify, not entirely sure if it will work for other players
token={{ states.media_player.spotify.attributes.token }}&
this part you can lose because the dashboard doesnt know templates.
so it seems that you dont need the token.
Hey Guys,
Great thread!
Has anyone got the generic camera working with a iTunes media player?
I can browser the iTunes album art with the url but can’t get it to display in the HA.
Any thoughts?
Thanks,
Stu
Ok, figured out my problem and posting which hopefully can help others. I needed to add my HA password to the HA config string
camera:
- platform: generic
still_image_url: 'http://xx.xx.xx.xx:8123/api/media_player_proxy/media_player.itunes?=token{{ states.media_player.itunes.attributes.token }}&api_password=ivegotasecret'
Cheers,
Stu
Had the same problem. The problem was that some code posted here was missing the ’ before http://…
It was at the end of the url though so that was the reason it didnt’t work.
Maybe somebody copy pasted the code for the configuration.yaml and forgot to add that little ’ in front of the URL.
And btw the token is unnecessary. Just add your password in the .dash file.
Working code:
media_player_picture:
widget_type: iframe
refresh: 1
frame_style: “”
background-size: contain
img_list:
- https://ip-address/api/media_player_proxy/media_player.spotify ?api_password=yourpassword
It updates instant and no caching problems. The token is only necessary if you want to access the link without your password.
@chris1
In your code, between spotfiy and ?api(…) is there a space or something else?
And maybe it is a dumb question, but what is the api-password? The pw for home assistant or spotify?
no space or anything else should be there
api password is the password set in home assistant.
Unfortunately, i can’t get it working. Here is my config.
media_player_picture:
widget_type: iframe
refresh: 1
frame_style: “”
background-size: contain
img_list:
- https://192.168.0.130/api/media_player_proxy/media_player.spotify?api_password=myhttphomeassistantpw
Here is my appdaemon config, if needed
secrets: /config/secrets.yaml
log:
logfile: STDOUT
errorfile: STDERR
appdaemon:
threads: 10
app_dir: /config/appdaemon/apps
plugins:
HASS:
type: hass
ha_url: http://hassio/homeassistant
ha_key: a20cbe36943b43efa0e611b9f412885d
hadashboard:
dash_url: http://192.168.0.130:5050
dash_dir: /config/appdaemon/dashboards
If it is relevant, i’m using hassio and have the duckdns + letsencrypt-addon installed.
I tried the ha_url from the appdaemon.yaml in combination with the key and also changing https to http.
But every time i see the iframe, but no picture is displayed
does anyone know why it is not working? Thanks in advance!
first of all.
ha_key in appdaemon.yaml is you http homeassistant pasword.
so if that is your correct pw, then please remove and change.
secondly, in img_list you should use the same url as your ha_url
so
http://hassio/homeassistant/api/media_player_proxy/media_player.spotify?api_password=myhttphomeassistantpw
that is when you can use that url in your browser to go to HA. if you cant reach HA with:
http://hassio/homeassistant then your dashboard shouldnt be working at all.
Thanks for your fast reply!
Yes, it was my pw, but i changed several numbers before posting.
By trial and error i found out, that in my case this img_link is working
https://hassio.local:8123/api/media_player_proxy/media_player.spotify?api_password=my_ha_pw
Yes you forgot the port number. Remember that you always need the port number if you link something to home assistant.
Hello!
I’m trying to make the Spotify cover image appear in my Dashboard but I can’t seem to get it right. The api password is the one from Spotify? Or the one from HA?
ok, interesting stuff here
i use that URL in a cloud system
does the token change? otherwise i cant use it? right?
or can i make use of the bearer ? if token of the camera is not static?
Hi All,
Assuming the purpose is to get the image as a widget, why not use the entitypicture ?
mediapicture1:
widget_type: entitypicture
title: Some Title
base_url: http://192.168.x.x:8123 <-- this is your HA server IP
entity: media_player.rock64
any entity with an entity_picture will work; havent tried other attributes having image yet. The idea is to have the full url as (base_url+entity). this solves the token and cached image problems.
Bipin.
Thanks for this, I didn’t realize an entitypicture widget existed. Do you know if there is a way to remove the grey frame that shows up around the entity picture on the HA Dashboard? What I really want is the picture to be edge to edge with no grey frame.
Hi
I am trying to create a picture element that will display the entity picture from relevant media player.
But nothing appears and there are no error messages.
If I were to paste the image url into a browser (after expanding the {{states…entity_picture}} in the homeassistant template editor, then I will see the correct picture.
Any help will be appreciated.
I have the following code:
- image: https://xxx.xxx.xxx{{ states.media_player.roku_ultra_living_room.attributes.entity_picture }}
style:
left: 50%
top: 50%
width: 100%
#style: null
type: picture-elements
elements:
- type: image
```