Home Assistant
Smarthome
AWTRIX 3
Awtrix Spotify NowPlaying
Show the current artist/song title and progress bar.
Built by Hank_the_Tank
Published 28 July 2023 · updated 20 August 2023 · 3 downloads
For this to work you need the Spotify Integration in HomeAssistant.
You can use other media_player entity_id´s (eg.media_player_sonos) but than the progress bar will not function correctly.
Lametric Icon ID:18207
PepJd5xeAjWN.yaml · 1.5 KB
alias: Awtrix Spotify NowPlaying 🎹
description:
trigger:
- platform: state
entity_id: media_player.spotify
action:
- choose:
- conditions:
- condition: state
entity_id: media_player.spotify
state: playing
- condition: state
entity_id: media_player.spotify
attribute: media_content_type
state: music
sequence:
- service: mqtt.publish
data:
qos: 0
retain: false
payload: |-
{
"text": "{{ state_attr('media_player.spotify', 'media_artist') }} - {{ state_attr('media_player.spotify', 'media_title') }}",
"icon": "18207",
"rainbow": true,
"repeat": 2,
"pushIcon": 0,
"textCase": 0,
"textOffset": 15,
"progress": {{ ( states.media_player.spotify.attributes.media_position / states.media_player.spotify.attributes.media_duration * 100 ) | round() }},
"progressC": "18B04C"
}
topic: awtrix_a8ba90/custom/spotify
- conditions:
- condition: template
value_template: >-
{{ not states.media_player.spotify.state ==
'playing' }}
sequence:
- service: mqtt.publish
data:
qos: 0
retain: false
topic: awtrix_a8ba90/custom/spotify