Skip to content

Instantly share code, notes, and snippets.

@shyney7
Forked from BerriJ/awtrix_spotifiy.yaml
Created October 9, 2023 18:38
Show Gist options
  • Save shyney7/26aa459f63060b4adc8ded1022321917 to your computer and use it in GitHub Desktop.
Save shyney7/26aa459f63060b4adc8ded1022321917 to your computer and use it in GitHub Desktop.
Awtrix Spotify
alias: pixelclock_spotify
description: ""
trigger:
- platform: state
entity_id: media_player.spotify_vistagamer
condition: []
action:
- choose:
- conditions:
- condition: state
entity_id: media_player.spotify_vistagamer
state: playing
sequence:
- service: mqtt.publish
data:
qos: 2
retain: false
payload: |-
{
"text": "{{ state_attr('media_player.spotify_vistagamer', 'media_artist') }} - {{ state_attr('media_player.spotify_vistagamer', 'media_title') }}",
"icon": "spotify",
"rainbow": false,
"duration": 10,
"pushIcon": 0,
"textCase": 2,
"progress": {{ ( states.media_player.spotify_vistagamer.attributes.media_position / states.media_player.spotify_vistagamer.attributes.media_duration * 100 ) | round() }},
"progressC": "18B04C"
}
topic: awtrix_ec/custom/spotify
- conditions:
- condition: template
value_template: >-
{{ not states.media_player.spotify_vistagamer.state == 'playing'
}}
sequence:
- service: mqtt.publish
data:
qos: 2
retain: false
topic: awtrix_ec/custom/spotify
mode: single
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment