Created
December 26, 2023 14:42
-
-
Save stefanstranger/3db0f116ef5a87641266310bc73c18ab to your computer and use it in GitHub Desktop.
Toon huidige top 2000 number op Ulanzi Pixel clock
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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