Skip to content

Instantly share code, notes, and snippets.

@stefanstranger
Created December 26, 2023 14:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stefanstranger/3db0f116ef5a87641266310bc73c18ab to your computer and use it in GitHub Desktop.
Save stefanstranger/3db0f116ef5a87641266310bc73c18ab to your computer and use it in GitHub Desktop.
Toon huidige top 2000 number op Ulanzi Pixel clock
# Create a new sensor met de volgende inhoud.
# Top 2000 huidige song
- platform: rest
scan_interval: 60
name: Top 2000 huidige song
method: GET
headers:
User-Agent: Home Assistant
Content-Type: application/json
resource: https://www.nporadio2.nl/api/miniplayer/info?channel=npo-radio-2
json_attributes_path: "$.data.radioTrackPlays.data[0]"
json_attributes:
- artist
- song
value_template: "OK"
# Maak de volgende Automation Action
- id: top2000songawtrix
alias: Huidige Top 2000 song
trigger:
- platform: time_pattern
minutes: "/3"
action:
- service: homeassistant.update_entity
entity_id: sensor.top_2000_huidige_song
- service: mqtt.publish
data:
qos: 0
retain: false
topic: awtrix_3d5e63/notify
payload: |-
{
"icon": "12345",
"text": [
{
"t": "{{ state_attr('sensor.top_2000_huidige_song','artist')}} - ",
"c": "FF0000"
},
{
"t": "{{ state_attr('sensor.top_2000_huidige_song','song')}}",
"c": "00FF00"
}
],
"pushIcon": 2,
"repeat": 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment