Your issue us caused by Spotcast. Are you on the latest version there?
To update replace everything below the settings part with the same section from my package file
Your issue us caused by Spotcast. Are you on the latest version there?
To update replace everything below the settings part with the same section from my package file
Iâm using 3.7.0 via HACS
Iâd like to use your script as well. Is this also working for a sonos one running google assistant or is this not possible in this case?
I try to execute your script, but unfortunately it is not working.
I am running a spotify song on media_player.wohnzimmer
Then I execute the following in the ui services window:
alias: "Play sound when there is someone at the door"
service: script.google_home_resume
data:
action:
- service: media_player.play_media
target:
area_id: 'Wohnzimmer'
entity_id:
- media_player.wohnzimmer
data:
media_content_type: music
media_content_id: "media-source://media_source/local/audio/JingleBells.mp
And I get the following error.
Fehler beim Aufrufen des Diensts script.google_home_resume. invalid slug resume_script_active_ghresume_01GTWKF5H26E258B5RFJABH3TA (try resume_script_active_ghresume_01gtwkf5h26e258b5rfjabh3ta) for dictionary value @ data['object_id']. Got None
I also tried it with a call I found in this topic:
alias: Play sound when there is someone at the door
service: script.google_home_resume
data:
action:
- service: tts.google_say
data:
cache: false
entity_id: media_player.wohnzimmer
message: Za pĹŻl hodiny bude 7 hodin.
mode: single
But there is the same output.
Am I anything doing wrong?
For Sonos you can use the snapshot service provided by the Sonos integration.
I can also have a look at whatâs going wrong with the script if you send me a trace of the script
I just tried it with my Google Home mini
This worked for the google Home mini
service: script.google_home_resume
data:
action:
- service: tts.google_say
data:
message: Das ist ein Test
language: de
entity_id: media_player.studio
On Sonos it is not resuming:
service: script.google_home_resume
data:
action:
- service: tts.google_say
data:
message: Das ist ein Test
language: de
entity_id: media_player.wohnzimmer
I added the trace here: dpaste/Tz97r (JSON)
The helper is not called with my sonos. So it seems to be stuck before.
Maybe it is a simple fix but nevertheless in the meantime I will chec k the snapshot service.
The script only works for media players under the cast integration.
Ok thank you for your response. I checked the sonos implementation and this was not working for spotify but the hacs plugin sonos cloud was very helpful. So it is working now with both types of speaker. Thank you.
Since the new version of Spotcast was recently released, continuing to play from Spotify stopped working. Your automation will start, but Spotify will no longer play. In the log is this:
Tato chyba pochĂĄzĂ z vlastnĂ integrace.
Logger: spotipy.client
Source: custom_components/spotcast/__init__.py:232
Integration: Spotcast (documentation, issues)
First occurred: 18:30:17 (1 occurrences)
Last logged: 18:30:17
HTTP Error for PUT to https://api.spotify.com/v1/me/player with Params: {} returned 403 due to Player command failed: Restriction violated
and
Logger: homeassistant.components.script.google_home_resume_helper
Source: custom_components/spotcast/__init__.py:232
Integration: Skript (documentation, issues)
First occurred: 18:30:17 (6 occurrences)
Last logged: 18:30:17
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. Unexpected error for repeat at pos 2: http status: 403, code:-1 - https://api.spotify.com/v1/me/player: Player command failed: Restriction violated, reason: UNKNOWN
00 - Google Home Resume - Helper Script: If at step 2: Parallel action at step 1: parallel 1: Resume needed?: Error executing script. Unexpected error for choose at pos 2: http status: 403, code:-1 - https://api.spotify.com/v1/me/player: Player command failed: Restriction violated, reason: UNKNOWN
00 - Google Home Resume - Helper Script: If at step 2: Parallel action at step 1: parallel 1: Error executing script. Unexpected error for if at pos 9: http status: 403, code:-1 - https://api.spotify.com/v1/me/player: Player command failed: Restriction violated, reason: UNKNOWN
00 - Google Home Resume - Helper Script: If at step 2: Error executing script. Unexpected error for parallel at pos 1: http status: 403, code:-1 - https://api.spotify.com/v1/me/player: Player command failed: Restriction violated, reason: UNKNOWN
00 - Google Home Resume - Helper Script: Error executing script. Unexpected error for if at pos 2: http status: 403, code:-1 - https://api.spotify.com/v1/me/player: Player command failed: Restriction violated, reason: UNKNOWN
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/spotipy/client.py", line 269, in _internal_call
response.raise_for_status()
File "/usr/local/lib/python3.10/site-packages/requests/models.py", line 1021, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://api.spotify.com/v1/me/player
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 451, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 684, in _async_call_service_step
await service_task
File "/usr/src/homeassistant/homeassistant/core.py", line 1808, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1851, in _execute_service
await self._hass.async_add_executor_job(
File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/spotcast/__init__.py", line 232, in start_casting
client.transfer_playback(
File "/usr/local/lib/python3.10/site-packages/spotipy/client.py", line 1778, in transfer_playback
return self._put("me/player", payload=data)
File "/usr/local/lib/python3.10/site-packages/spotipy/client.py", line 336, in _put
return self._internal_call("PUT", url, payload, kwargs)
File "/usr/local/lib/python3.10/site-packages/spotipy/client.py", line 291, in _internal_call
raise SpotifyException(
spotipy.exceptions.SpotifyException: http status: 403, code:-1 - https://api.spotify.com/v1/me/player:
Player command failed: Restriction violated, reason: UNKNOWN
and
Tato chyba pochĂĄzĂ z vlastnĂ integrace.
Logger: homeassistant
Source: custom_components/spotcast/__init__.py:232
Integration: Spotcast (documentation, issues)
First occurred: 18:30:17 (1 occurrences)
Last logged: 18:30:17
Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/spotipy/client.py", line 269, in _internal_call
response.raise_for_status()
File "/usr/local/lib/python3.10/site-packages/requests/models.py", line 1021, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://api.spotify.com/v1/me/player
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/script/__init__.py", line 463, in _async_run
return await self.script.async_run(script_vars, context)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1524, in async_run
await asyncio.shield(run.async_run())
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 409, in async_run
await self._async_step(log_exceptions=False)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 453, in _async_step
self._handle_exception(
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 476, in _handle_exception
raise exception
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 451, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 923, in _async_if_step
await self._async_run_script(if_data["if_then"])
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1029, in _async_run_script
await self._async_run_long_action(
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 648, in _async_run_long_action
long_task.result()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1524, in async_run
await asyncio.shield(run.async_run())
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 409, in async_run
await self._async_step(log_exceptions=False)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 453, in _async_step
self._handle_exception(
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 476, in _handle_exception
raise exception
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 451, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/trace.py", line 252, in async_wrapper
await func(*args)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1025, in _async_parallel_step
raise result
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1017, in async_run_with_trace
await self._async_run_script(script)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1029, in _async_run_script
await self._async_run_long_action(
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 648, in _async_run_long_action
long_task.result()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1524, in async_run
await asyncio.shield(run.async_run())
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 409, in async_run
await self._async_step(log_exceptions=False)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 453, in _async_step
self._handle_exception(
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 476, in _handle_exception
raise exception
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 451, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 923, in _async_if_step
await self._async_run_script(if_data["if_then"])
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1029, in _async_run_script
await self._async_run_long_action(
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 648, in _async_run_long_action
long_task.result()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1524, in async_run
await asyncio.shield(run.async_run())
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 409, in async_run
await self._async_step(log_exceptions=False)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 453, in _async_step
self._handle_exception(
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 476, in _handle_exception
raise exception
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 451, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 896, in _async_choose_step
await self._async_run_script(script)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1029, in _async_run_script
await self._async_run_long_action(
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 648, in _async_run_long_action
long_task.result()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1524, in async_run
await asyncio.shield(run.async_run())
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 409, in async_run
await self._async_step(log_exceptions=False)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 453, in _async_step
self._handle_exception(
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 476, in _handle_exception
raise exception
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 451, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/trace.py", line 252, in async_wrapper
await func(*args)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 813, in _async_repeat_step
await async_run_sequence(iteration, extra_msg)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 795, in async_run_sequence
await self._async_run_script(script)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1029, in _async_run_script
await self._async_run_long_action(
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 648, in _async_run_long_action
long_task.result()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1524, in async_run
await asyncio.shield(run.async_run())
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 409, in async_run
await self._async_step(log_exceptions=False)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 453, in _async_step
self._handle_exception(
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 476, in _handle_exception
raise exception
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 451, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 684, in _async_call_service_step
await service_task
File "/usr/src/homeassistant/homeassistant/core.py", line 1808, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1851, in _execute_service
await self._hass.async_add_executor_job(
File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/spotcast/__init__.py", line 232, in start_casting
client.transfer_playback(
File "/usr/local/lib/python3.10/site-packages/spotipy/client.py", line 1778, in transfer_playback
return self._put("me/player", payload=data)
File "/usr/local/lib/python3.10/site-packages/spotipy/client.py", line 336, in _put
return self._internal_call("PUT", url, payload, kwargs)
File "/usr/local/lib/python3.10/site-packages/spotipy/client.py", line 291, in _internal_call
raise SpotifyException(
spotipy.exceptions.SpotifyException: http status: 403, code:-1 - https://api.spotify.com/v1/me/player:
Player command failed: Restriction violated, reason: UNKNOWN
For example, if I listen to internet radio, everything works fine. It only does this when Iâm playing Spotify
Thatâs out of my hands, you need to log that as an issue on the Spotcast repository
Ah, I thought there was a problem in connecting your script to the new version of spotcast.
The automation to start the resume is intended to be used as a backup. If you already know you are going to send (like a TTS or mp3) and know you want to resume what was playing afterwards, I strongly advice to start the script yourself, and not rely on the automation, as it is a bit flaky.
See here for instructions how to do that.
speaker_groups
setting.Iâm having some issues where it fails to resume and was about to follow these instructions but iâm unable to use the link. Not sure if this an issue on my side or the link is broken.
Which link do you mean exactly?
Wait, my bad. I copied the readme from GitHub, but forgot to fix the links
You can follow the link to the GitHub repo at the bottom, there the links will work. I will also correct them here.
The links are fixed now
The link is still broken for me. Just to confirm, Iâm referring to the âhereâ link where it says 'See here for instructions how to do that.â It works at top of the page however.
Yes, that one should work, you probably need to reload the page.
Otherwise go the linked GitHub page where the same information is posted
When creating the script to not rely on the automation, where would this script go? would this be within the script I use to start everything (like below):
alias: gate announce
sequence:
- service: script.google_home_resume
data:
target:
entity_id: >-
media_player.main_bedroom_room_speaker,media_player.living_room_speaker,media_player.grace_bedroom_speaker,media_player.kitchen_display
action:
- service: tts.cloud_say
data:
entity_id: >-
media_player.main_bedroom_room_speaker,media_player.living_room_speaker,media_player.grace_bedroom_speaker,media_player.kitchen_display
message: The gate has been opened
mode: single
Yes, this should work, although I would suggest to provide the target entity idâs as a list.
You also donât need to provide the target, as you already supply it in the service call
alias: gate announce
sequence:
- service: script.google_home_resume
data:
action:
- service: tts.cloud_say
data:
entity_id:
- media_player.main_bedroom_room_speaker
- media_player.living_room_speaker
- media_player.grace_bedroom_speaker
- media_player.kitchen_display
message: The gate has been opened
mode: single
hi, will this work the same for local piper tts.speak
on Google devices? thanks
Yes, this will work with any TTS service