Automation calling spotcast.start fails when target device is sleeping. It seems to run fine when activated again moments later. Verified using a Harman Kardon Citation Oasis with CC built-in.
Troubleshooting
Make sure to validate all the elements before submitting the ticket (Exception to the steps marked as optional)
[X] Using latest version of spotcast
[X] Using latest stable version of Home Assistant
[X] I have setup the Spotify integration in Home Assistant
[X] I have renewed my sp_dc and sp_key values and restarted Home Assistant (see README)
[X] (optional) I have Spotify Premium
[ ] (optional) I am using multiple accounts
[ ] (optional) I'm attaching relevant logs with level debug for component spotcast (see README)
[ ] (optional) I'm using entity_id in the service call and have tried device_name but the issue remains
Environment
Installation type: HA_OS
HA version: 2024.1.3
spotcast version: 3.7.1
Configuration
# please remove any sensitive information like cookies and token keys
spotcast:
sp_dc: !secret sp_dc
sp_key: !secret sp_key
Service Call
alias: Good morning
description: ""
trigger:
- platform: time
at: input_datetime.wake_up_time
condition:
- condition: state
entity_id: calendar.sweden
state: "off"
for:
hours: 0
minutes: 0
seconds: 0
enabled: true
action:
- service: spotcast.start
metadata: {}
data:
limit: 20
repeat: "off"
offset: 0
entity_id: media_player.hk_citation_oasis_abc123
uri: spotify:playlist:<uri to my playlist>
random_song: true
start_volume: 22
mode: single
Logs
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/automation/__init__.py", line 669, in async_trigger
await self.action_script.async_run(
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1587, in async_run
return await asyncio.shield(run.async_run())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 426, in async_run
await self._async_step(log_exceptions=False)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 479, in _async_step
self._handle_exception(
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 502, in _handle_exception
raise exception
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 476, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 713, in _async_call_service_step
response_data = await self._async_run_long_action(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 675, in _async_run_long_action
return long_task.result()
^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2149, in async_call
response_data = await coro
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2193, in _execute_service
return await self._hass.async_add_executor_job(target, service_call)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/spotcast/__init__.py", line 221, in start_casting
spotify_device_id = spotcast_controller.get_spotify_device_id(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/spotcast/spotcast_controller.py", line 301, in get_spotify_device_id
spotify_cast_device.start_spotify_controller(access_token, expires)
File "/config/custom_components/spotcast/spotcast_controller.py", line 104, in start_spotify_controller
sp.launch_app()
File "/config/custom_components/spotcast/spotify_controller.py", line 110, in launch_app
raise LaunchError(
pychromecast.error.LaunchError: Timeout when waiting for status response from Spotify app
Bug Ticket
Describe the bug
Automation calling spotcast.start fails when target device is sleeping. It seems to run fine when activated again moments later. Verified using a Harman Kardon Citation Oasis with CC built-in.
Troubleshooting
Make sure to validate all the elements before submitting the ticket (Exception to the steps marked as optional)
sp_dc
andsp_key
values and restarted Home Assistant (see README)Environment
Configuration
Service Call
Logs
Additional context
N/A