I have a sensor where the Attributes is a JSON list.
My end goal is to create multiple picture-entity cards that look like this:
Please note, these will change over time, so I can’t just hard code them.
From my (limited) understanding, I need to create new sensors template as I have for other items. EG:
- platform: template
sensors:
discogs_random_label:
friendly_name: 'Label'
value_template: "{{ state_attr('sensor.discogs_random_record', 'label') }}"
icon_template: mdi:tag-text-outline
The problem I have though is that the Attribute is a JSON list, not simply defined attributes. I am new, and just can’t seem to find a solution.
Here are some specifics:
Entity: sensor.spotifyplaylist
State: 20
The State is the max number of playlists returned, but could be less.
Attributes:
Have a nice Day!: {
"name": "Have a nice Day!",
"image": "https://mosaic.scdn.co/640/7db1407da1e265072b519ce816b743e4026c9b1180a1ff1574dbbd1d5a722b03395df8e5b9d41ab4dae8ad17a47a3563b770beb3a1b85fce0e7b6089eb669772a583cba3fac0a9d5368bcdf3cb6a6fff",
"uri": "spotify:playlist:1YjGrJLxSUBCPlDkuq7Il1",
"id": 0
}
Ashtons Favourites: {
"name": "Ashtons Favourites",
"image": "https://mosaic.scdn.co/640/03bcf9d313e2f4c9eb331b6d6ae812c7602833f0bc1fb3236c8f9f88bf83063a03447b2e2b9b5528d2aad28ac0748c98424bf2978edc831adcc69117e84239e07a597daad130bc9d4a6bd84e994a22d0",
"uri": "spotify:playlist:1pZkysYdjVrHjGp8nEFo6N",
"id": 1
}
Your Time Capsule: {
"name": "Your Time Capsule",
"image": "https://lineup-images.scdn.co/time-capsule_DEFAULT-en.jpg",
"uri": "spotify:playlist:37i9dQZF1E4ZQbd48I4yBG",
"id": 2
}
Our Wedding Songs: {
"name": "Our Wedding Songs",
"image": "https://pl.scdn.co/images/pl/default/f5155633b43a1394fb4da2851df38cc35ac5a8dc",
"uri": "spotify:playlist:4VA0a7W8CUXSZ3BzewWYEI",
"id": 3
}
Discover Weekly: {
"name": "Discover Weekly",
"image": "https://pl.scdn.co/images/pl/default/d4999304de229a1795efe3f87638ec56e3cd3dd0",
"uri": "spotify:playlist:37i9dQZEVXcJay8PkejUec",
"id": 4
}
Covers: Upbeat: {
"name": "Covers: Upbeat",
"image": "https://mosaic.scdn.co/640/25c85bf20c80a867fd06a5d1dfcba7d1f6b0ffb1a33989fb7bda76d58f6fea39fb10d575b893310bbb4a00627743eee54cd5800015bb2ec98208f7fabd28d922bf92212116c9870161b3876f43f5550b",
"uri": "spotify:playlist:4KavIwXiyfmGEM4EcwWbzZ",
"id": 5
}
Covers: Easy Listening: {
"name": "Covers: Easy Listening",
"image": "https://mosaic.scdn.co/640/02a418214b1f4b6dfeea559c80d8c52e534090835d76d3e0d86599ad60600f11647335ef65239ea78cab04a83bd4f866b5b0132996a5577d13226625d697053ca89058889da2ddfff6b61566be4c97c8",
"uri": "spotify:playlist:3Ge8E6bhNUPssxgUPTiRg9",
"id": 6
}
Starred: {
"name": "Starred",
"image": "https://i.scdn.co/image/4460bf377e42ca2b223f86d7dd4a8f70d896f662",
"uri": "spotify:playlist:6I6MQz0Qo34lro623EDd8r",
"id": 7
}
Acoustic Covers: {
"name": "Acoustic Covers",
"image": "https://pl.scdn.co/images/pl/default/5464712275c214038ec6ce063075c77539270e1f",
"uri": "spotify:playlist:37i9dQZF1DWXmlLSKkfdAk",
"id": 8
}
friendly_name: SpotifyPlaylist
icon: mdi:spotify
Ideally, it would be great if I could somehow create the correct amount of sensors as per the JSON file using the JSON id. However, I would be happy with manually creating a sensor for a set amount. I imagine my new sensors would be named: sensor.spotifyplaylist_0 sensor.spotifyplaylist_1 sensor.spotifyplaylist_2 …
I hope this makes sense. I am sorry if this is an easy question, but my searches have come up empty, and I just can’t get my head around documentation.