Flow Details
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
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
-- Flow first published on July 28, 2023, last updated on August 20, 2023 at 14:12.