Hi all,
Can someone please help me understand how to template the following correctly?
I’m trying too extract the attributes “media_title” and “media_artist” from media_player.bedroom into one template sensor to display: Song - Artist
I can “add” the two attributes together but I am struggling with inserting " - " between the attribute:
sensor:
#GET ARTIST AND SONG TITLE FROM BEDROOM SONOS MEDIA PLAYER
- platform: template
sensors:
bedroom_now_playing:
entity_id: media_player.bedroom
value_template: "{{ (state_attr('media_player.bedroom', 'media_title') + state_attr('media_player.bedroom', 'media_artist')) }}"
friendly_name: "Bedroom - Now Playing"
The above gives me: SongArtist
I need it to give me: Song - Artist
Appreciate any help
Thanks
Paul