I’m trying to automate a process where when I come home spotify is casted to my denon amplifier. The amplifier exists in the spotify APP permanently even when the denon is in standby and I can trigger it to turn on via the spotify app. However when I try to automate this via hassio it’s intermittently failing. I’ve tried running it via services in the front-end and get an API token expired error. It seems to run fine when spotify has recently been played/playing.
Is there a way to force hassio to request a new token as when I trigger it via the app the code works fine.
Code extract:
action:
- service: input_boolean.turn_on
entity_id: input_boolean.come_home_status
- service: media_player.select_source
data:
entity_id: media_player.spotify
source: "Denon Amplifier"
- delay: '00:00:02'
- service: media_player.volume_set
data:
entity_id: media_player.denon_amplifier
volume_level: 0.5
- service: media_player.media_play
data:
entity_id: media_player.spotify