media_player.template
media_player.template copied to clipboard
album_art doesn't exist-is it actually entity_picture_tempate ?
I had some time and was checking all your templates. album_art is the only one (I think) that I can't make work. I went to HA's media_player component and the template component and looked also at the sonos integration and a couple of others; album_art doesn't show as a possibility anywhere, but entity_picture_template does. I'm going to guess they're synonymous; when I check my sonos, it looks like the album art appears under entity_picture in attributes.
You have both in the media_player_template under Schema, but entity_picture_template doesn't appear just above it in the list of your templates starting on line 66. I didn't want to change it without your permission, since I could be wrong or I'm making a mistake in trying to get it display.
ETA: or is album art equal to media_image_url? Sonos seemed to be using entity when music plays, but that doesn't mean it's universal.
Hey it's something strange how to do this. It depends if the url is publicly accessible or not. If you look at the following code https://github.com/home-assistant/core/blob/dev/homeassistant/components/media_player/init.py#L791 you see that if it's publicly accessible it takes the url otherwise it takes local. I only implemented the public url
Oh, that's a relief; I was worried I somehow managed to do it wrong when it wouldn't pick anything up. Thank you!
I'm also having trouble getting the album art working.
This is my code
`
- platform: media_player_template media_players: template_group_home_speakers: friendly_name: Template Group Home Speakers device_class: speaker value_template: > {% set ns = namespace( final_entity = "" )%} {% for media_player in states.media_player %} {% if "plex" in media_player.entity_id %} {% set entity = media_player.entity_id %} {% set media_title = state_attr( entity, 'media_title') %} {% if state_attr( 'media_player.group_home_speakers', 'media_title') %} {% if ( media_title | string ) in state_attr( 'media_player.group_home_speakers', 'media_title') %} {% set ns.final_entity = entity %} {% endif %} {% endif %} {% endif %} {% endfor %} {% if ns.final_entity != "" %} {{states(ns.final_entity)}} {% else %} off {% endif %} next: service: media_player.media_seek data_template: entity_id: media_player.group_home_speakers seek_position: 56000 turn_on: service: media_player.turn_on data_template: entity_id: media_player.group_home_speakers stop: service: media_player.media_stop data_template: entity_id: media_player.group_home_speakers turn_off: service: media_player.turn_off data_template: entity_id: media_player.group_home_speakers volume_up: service: media_player.volume_up data_template: entity_id: media_player.group_home_speakers volume_down: service: media_player.volume_down data_template: entity_id: media_player.group_home_speakers mute: service: media_player.volume_mute data_template: entity_id: media_player.group_home_speakers set_volume: service: media_player.volume_set data_template: entity_id: media_player.group_home_speakers volume_level: "{{ volume }}" current_is_muted_template: "{{state_attr( 'media_player.group_home_speakers', 'is_volume_muted') }}" album_art_template: > {% set ns = namespace( final_entity = "" )%} {% for media_player in states.media_player %} {% if "plex" in media_player.entity_id %} {% set entity = media_player.entity_id %} {% set media_title = state_attr( entity, 'media_title') %} {% if state_attr( 'media_player.group_home_speakers', 'media_title') %} {% if ( media_title | string ) in state_attr( 'media_player.group_home_speakers', 'media_title') %} {% set ns.final_entity = entity %} {% endif %} {% endif %} {% endif %} {% endfor %} {% if ns.final_entity != "" %} 192.168.0.15:8123{{state_attr(ns.final_entity, 'entity_picture')}} {% else %} {% endif %} title_template: "{{state_attr( 'media_player.group_home_speakers', 'media_title') }}" album_template: "{{ state_attr( 'media_player.group_home_speakers', 'media_album_name')}}" artist_template: "{{ state_attr( 'media_player.group_home_speakers', 'media_album_artist') }}" unique_id: template_group_home_speakers media_content_type_template: music
`
Thanks for the component!