Skip to content

Instantly share code, notes, and snippets.

@BerriJ
Created August 29, 2023 07:16
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save BerriJ/51333094064a6565fec004502512e96c to your computer and use it in GitHub Desktop.
Save BerriJ/51333094064a6565fec004502512e96c 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