Correct, there’s no way to start playing a Spotify playlist “cold” without something like Spotcast (which is currently not working). You could look into something like Logitech Media Server and Spotty.
I worked around the problem by sending a sequence of button commands, get spotify to play the latest playlist, and then switch it with the one I wanted.
It seems to need a delay of 5s to make sure the interface is fully loaded on each press.
'1589881785488':
alias: Tv on the Radio
sequence:
- data: {}
entity_id: media_player.living_room_tv
service: media_player.turn_on
- data:
source: Spotify Music - Listen free on LG TV
entity_id: media_player.living_room_tv
service: media_player.select_source
- delay: 00:00:05
- data:
button: RIGHT
entity_id: media_player.living_room_tv
service: webostv.button
- delay: 00:00:05
- data:
button: ENTER
entity_id: media_player.living_room_tv
service: webostv.button
- delay: 00:00:05
- data:
button: ENTER
entity_id: media_player.living_room_tv
service: webostv.button
- delay: 00:00:05
- data:
button: ENTER
entity_id: media_player.living_room_tv
service: webostv.button
- delay: 00:00:05
- data:
button: ENTER
entity_id: media_player.living_room_tv
service: webostv.button
- delay: 00:00:05
- data:
media_content_id: spotify:playlist:0Rl855D2r6w4SYHyLfSPHh
media_content_type: playlist
entity_id: media_player.spotify_bruno_amaral
service: media_player.play_media
Logger: homeassistant.components.script.spotify_eco99_last_100
Source: components/media_player/__init__.py:626
Integration: Script (documentation, issues)
First occurred: 7:49:08 PM (2 occurrences)
Last logged: 8:01:02 PM
playing eco99 last 100 songs: Error executing script. Unexpected error for call_service at pos 1:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 254, in _async_step
await getattr(
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 464, in _async_call_service_step
await service_task
File "/usr/src/homeassistant/homeassistant/core.py", line 1445, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1480, in _execute_service
await handler.job.target(service_call)
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 204, in handle_service
await self.hass.helpers.service.entity_service_call(
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 593, in entity_service_call
future.result() # pop exception if have
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 664, in async_request_call
await coro
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 630, in _handle_entity_call
await result
File "/usr/src/homeassistant/homeassistant/components/media_player/__init__.py", line 630, in async_play_media
await self.hass.async_add_executor_job(
File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/homeassistant/homeassistant/components/media_player/__init__.py", line 626, in play_media
raise NotImplementedError()
NotImplementedError
I have tried to run it after spotify is already running but it didn’t helped.
And is spotify playing? There are some limitations with the API, that’s why I had to use that combination of sending key-strokes to make it start playing. Only then can you change the playlist.