I am not using Spotify anymore and move all my automations to Apple Music. What exactly are you Interessted in ?
Hey thanks for the quick reply. Actually this is exactly what I am looking for. Though probably not with a push button, but a tag that they can put on a tag reader. Did you get this to work at any point? I think the random album part might be trickyā¦
Okā¦ so what I did isā¦ Iāve created a short script which uses a list of available albums on spotify/apple music sorted by the artist.
alias: Play Random Album
icon: mdi:pirate
mode: single
max_exceeded: silent
variables:
uris:
paw_patrol:
- >-
https://music.apple.com/de/album/folge-225-der-erste-einsatz-der-moto-patrol/1618276153
fields:
media_player:
name: Media Player
description: Media player to be used for playback.
example: media_player.kueche
required: true
selector:
entity:
integration: sonos
domain: media_player
artist:
name: Artist
description: Artist for playback
example: paw_patrol
required: true
selector:
select:
options:
- paw_patrol
sequence:
- variables:
album_id: >
{%- set plists = uris[artist] -%} {% set pindex = (range(0, (plists |
length - 1 ) )|random) -%} {{ plists[pindex] }}
- service: media_player.clear_playlist
data:
entity_id: "{{ media_player }}"
- service: media_player.repeat_set
data:
entity_id: "{{ media_player }}"
repeat: all
- data:
entity_id: "{{ media_player }}"
media_content_type: music
media_content_id: "{{ album_id }}"
service: media_player.play_media
- delay: "2"
I update the list of available albums every know and then. With spotify is rather easy because you can leverage the official API. With Apple Music is actually not that straight forward.
Iām still getting that errorā¦
But Iām new with Home Assistant:
I donāt find the solutionā¦