I made the update at home, I started the script…again nothing, so I executed the code you gave me in the developer mode: Imgur: The magic of the Internet
It popups an error from the bottom which is unknown.
Is there a way to add in your code like a tracing variable or like a try & catch, so we can take this error and see what is it? Some sort of debugs…
Any error while running the script, will be logged in the Home Assistant log
But as you can clearly see, the error is not caused by the sript, it is caused by spotcast. I can’t help you with that. You can create an issue on the Spotcast GitHub repository.
Well… there is something that needs to be checked…
No resuming Spotify…
2022-12-03 17:00:45.188 ERROR (SyncWorker_4) [custom_components.spotcast.spotcast_controller] No device with id "6a498c3ad44ebe4eec27648c02813098" known by Spotify
2022-12-03 17:00:45.198 ERROR (SyncWorker_4) [custom_components.spotcast.spotcast_controller] Known devices: [{'id': '59a3d3a1bce5662ba535971fb10fa84db39cbd83', 'is_active': False, 'is_private_session': False, 'is_restricted': False, 'name': 'S21 používateľa Martin', 'type': 'Smartphone', 'volume_percent': 100}]
2022-12-03 17:00:45.201 ERROR (MainThread) [homeassistant.components.script.google_home_resume_helper] 00 - Google Home Resume - Helper Script: If at step 2: Parallel action at step 1: parallel 1: Resume needed?: Resume playing: Spotify?: Repeat at step 2: Error executing script. Error for call_service at pos 1: Failed to get device id from Spotify
2022-12-03 17:00:45.203 ERROR (MainThread) [homeassistant.components.script.google_home_resume_helper] 00 - Google Home Resume - Helper Script: If at step 2: Parallel action at step 1: parallel 1: Resume needed?: Resume playing: Spotify?: Error executing script. Error for repeat at pos 2: Failed to get device id from Spotify
2022-12-03 17:00:45.206 ERROR (MainThread) [homeassistant.components.script.google_home_resume_helper] 00 - Google Home Resume - Helper Script: If at step 2: Parallel action at step 1: parallel 1: Resume needed?: Error executing script. Error for choose at pos 2: Failed to get device id from Spotify
2022-12-03 17:00:45.211 ERROR (MainThread) [homeassistant.components.script.google_home_resume_helper] 00 - Google Home Resume - Helper Script: If at step 2: Parallel action at step 1: parallel 1: Error executing script. Error for if at pos 9: Failed to get device id from Spotify
2022-12-03 17:00:45.213 ERROR (MainThread) [homeassistant.components.script.google_home_resume_helper] 00 - Google Home Resume - Helper Script: If at step 2: Error executing script. Error for parallel at pos 1: Failed to get device id from Spotify
2022-12-03 17:00:45.216 ERROR (MainThread) [homeassistant.components.script.google_home_resume_helper] 00 - Google Home Resume - Helper Script: Error executing script. Error for if at pos 2: Failed to get device id from Spotify
2022-12-03 17:00:45.221 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
I just upgraded from an older version (2.8.6) of this script to the latest package version (2022.12.1). Two questions:
Was the player’s screen setting retired? It was an aspect of my older configuration not seemingly included in the packages version. I never understood that setting, but I always assumed it was for media players with screens (ie Google Hub).
I’m having difficulty with the Spotify resume function of the scripts. I’m assuming I have @Manazer problem based on similar errors concerning “Failed to get device id from Spotify”. I attempted to employ the spotcast error fix @TheFes mentioned above, however I have persistent issues that I do not understand.
Contextually:
Spotcast_controller.py was modified as such
def startSpotifyController(self, access_token: str, expires: int) -> None:
sp = SpotifyController(access_token, expires)
self.castDevice.register_handler(sp)
sp.launch_app()
if not sp.is_launched and not sp.credential_error:
# raise HomeAssistantError(
# "Failed to launch spotify controller due to timeout"
# )
_LOGGER.warning("Spotify controller did not launch properly before timeout, this might not be a problem")
if not sp.is_launched and sp.credential_error:
raise HomeAssistantError(
"Failed to launch spotify controller due to credentials error"
)
And spotify_controller.py was modified as such:
counter = 0
while counter < (timeout + 1):
if self.is_launched:
return
self.waiting.wait(1)
counter += 1
if not self.is_launched:
# raise LaunchError(
# "Timeout when waiting for status response from Spotify app"
# )
self.logger.warning("Timeout when waiting for status response from Spotify app")
# pylint: disable=too-many-locals
def quick_play(self, **kwargs):
"""
Launches the spotify controller and returns when it's ready.
To actually play media, another application using spotify connect is required.
"""
self.access_token = kwargs["access_token"]
self.expires = kwargs["expires"]
Did I implement the fix incorrectly or is there another issue?
It seems I indeed forgot to mention that players_screen is no longer needed.
It was mainly used for two reasons:
To make sure they were turned off after the TTS or other action if nothing was playing before, to prevent the Home Assistant media player screen showing on the screen when it was not needed.
If YouTube Music was started by voice command or by casting it from the YouTube Music app, the only way I found to resume it, is by using the YouTube cast method, which only works on screens.
The setting is no longer needed because I noticed the devices with a screen don’t have device_class: speaker, so I now use this to determine the device type.
Regarding the Spotcast issues, the changes you made look fine. I assume you did a restart after applying them?
As I’m not involved in Spotcast itself, I just use it, there is really nothing I can do here
You messed up your settings.
All the settings are now under voice_settings, where only the settings specifically for the Voice script should be under that key.
Looks like your automation is still on an old version, I think you only reloaded scripts, but not automations.
Please reload automations in Developer tools > YAML
BTW, your setting for primary_spotcast is wrong, that should be bennett_campbell. Not that it really matters as you only have one Spotify account set up.
These traces don’t help me, as they are not related to the script.
They will trigger the automation, but they don’t show anything I can work on.
BTW your automation fails because you are using mode: single and it was triggered a second time while it was still completing the first run. But that has nothing to do with my script.
I need:
a trace of the automation (one that actually triggers the script, so use the arrows to go through them and pick the last one which doesn’t fail on the conditions).
a trace of the main Google Home Resume script
a trace of the Google Home Resume helper script which tried to resume the player which was playing Spotify