Update
2023.2
Only a small update with a small bugfix right now
RESUME SCRIPT
Bug fixes
- Fix error in resume helper when no volume was stored
Only a small update with a small bugfix right now
Thanks for the great work, this is a game changer! (wife acceptance factor went up!!)
One small thing that does not work perfectly for me:
I use triggered automations to make certain announcements on my Google Minis:
announce: true
automation_enabled
is set, the â00 - Google Home Automatic Resumeâ will auto-triggerThe resume script works fine with multiple Spotify accounts (yay!), however:
I assume 1. is the buffer from the previous stream and 2. is the ârealâ resumption.
Can I avoid 1. entirely? It is too loud and as it gets interrupted again, itâs of no use. I would rather jump straight into 2. (Iâm fine with the 2-3 seconds of silence)
Thanks
Itâs better to let the script increase the volume, there is a setting for the automation for a default volume for announcements.
For the Spotify thing, the service call to resume it, is issued twice, I think thatâs causing it. I will have a look if I can remove it, or only issue it a second time if the first one failed
Yes, using the global volume solves one part of the issue, it does no longer continue to play the music too loudly after the announcement. Thanks for that.
Not ideal to having to stick to a single volume value for all announcements. But then again, I can just use the global one for everything that needs to resume music afterwards.
And for the critical ones, where I need volume=1.0 (fire alarm, water leakage), I probably donât need to resume music anywaysâŠ
Yes, if you are able to fix the double service call, that would be perfect!
I read and understood why you would not want to make it a blueprint. But how about a HACS addon? (Does that work for packages?) That would at least allow users to see available updates easily and to update with a simple click on a button.
With HACS it needs to be an integration written in python, which I canât
If you want to use different volume you can call the script yourself and donât use the automation
Ok got it, thanks.
What was the reason to implement the repeat
and count: 2
for resuming Spotify?
I can try to make it a single call in my setup and see how reliable that works.
Because in the previous version of Spotcast it would sometimes fail the first time.
But Iâll improve it somewhere next week
Can you please advise me what the problem is. When I run this my automation:
alias: Warning at 7 p.m
description: ""
trigger:
- platform: time
at: "19:00:00"
condition: []
action:
- service: media_player.play_media
target:
entity_id: media_player.indoor
data:
media_content_id: >-
media-source://tts/google_translate?message=it+will+be+7+clock
media_content_type: provider
metadata:
title: It will be 7 clock
thumbnail: https://brands.home-assistant.io/_/google_translate/logo.png
media_class: app
children_media_class: null
navigateIds:
- {}
- media_content_type: app
media_content_id: media-source://tts
- media_content_type: provider
media_content_id: >-
media-source://tts/google_translate?message=it+will+be+7+clock
mode: single
so your script doesnât work. Your automation 00 - Google Home Automatic Resume will not start at all.
Thank you
You didnât add announce: true
Thanks, donât be offended, Iâm a beginner. Where exactly should I put it announce: true
?
Under data. But why are you sending a cached TTS anyway, and not using the TTS service?
So the GUI generated the automation for me. So please send how it should be right. But I need it to speak the Czech language. Google NEST does not speak Czech.
It doesnât really matter which language Google Nest speaks, as long as the TTS integration can speak the language.
You are now sending a cached TTS which youâve sent earlier, and which will be gone at some point. You should just use the TTS integration (use call a service > tts.google_translate_say) and enter the right message there. In that case it will also automatically be sent as an announcement
Thanks, it seems to be working. I donât see announce: true anywhere, but it works.
action:
- service: tts.google_translate_say
data:
cache: false
entity_id: media_player.indoor
message: Za pĆŻl hodiny bude 7 hodin.
mode: single
No, thatâs because after HA receives the TTS message (an mp3) from the integration, it will do a similar service call as you did before, but with announce: true
Thatâs right with it announce: true ?
service: media_player.play_media
target:
entity_id: media_player.indoor
data:
media_content_id: media-source://media_source/local/zvon.wav
media_content_type: audio/x-wav
announce: true
metadata:
title: zvon.wav
thumbnail: null
media_class: music
children_media_class: null
navigateIds:
- {}
- media_content_type: app
media_content_id: media-source://media_source
Yes, looks fine
Unfortunately, sometimes there is a problem. For some unknown reason the music wonât play back. However, it only does it sometimes and I donât know why. However, the automation â00 - Google Home Automatic Resumeâ starts.
But I have this error in the log:
Logger: spotipy.client
Source: custom_components/spotcast/__init__.py:276
Integration: Spotcast ([documentation](https://github.com/fondberg/spotcast), [issues](https://github.com/fondberg/spotcast/issues))
First occurred: 22. Ășnora 2023 v 17:19:49 (2 occurrences)
Last logged: 09:07:10
* HTTP Error for PUT to https://api.spotify.com/v1/me/player/repeat?state=off&device_id=0becea5bee4ba4d68173b82cd6ff9942 with Params: {} returned 404 due to Device not found
* HTTP Error for PUT to https://api.spotify.com/v1/me/player/repeat?state=off&device_id=1574201b8d8f066213f217203d9567fc with Params: {} returned 404 due to Device not found
and
Logger: homeassistant.components.script.google_home_resume_helper
Source: custom_components/spotcast/__init__.py:276
Integration: Skript (documentation, issues)
First occurred: 22. Ășnora 2023 v 17:19:49 (12 occurrences)
Last logged: 09:07:10
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: 404, code:-1 - https://api.spotify.com/v1/me/player/repeat?state=off&device_id=1574201b8d8f066213f217203d9567fc: Device not found, reason: None
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: 404, code:-1 - https://api.spotify.com/v1/me/player/repeat?state=off&device_id=1574201b8d8f066213f217203d9567fc: Device not found, reason: None
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: 404, code:-1 - https://api.spotify.com/v1/me/player/repeat?state=off&device_id=1574201b8d8f066213f217203d9567fc: Device not found, reason: None
00 - Google Home Resume - Helper Script: If at step 2: Error executing script. Unexpected error for parallel at pos 1: http status: 404, code:-1 - https://api.spotify.com/v1/me/player/repeat?state=off&device_id=1574201b8d8f066213f217203d9567fc: Device not found, reason: None
00 - Google Home Resume - Helper Script: Error executing script. Unexpected error for if at pos 2: http status: 404, code:-1 - https://api.spotify.com/v1/me/player/repeat?state=off&device_id=1574201b8d8f066213f217203d9567fc: Device not found, reason: None
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: 404 Client Error: Not Found for url: https://api.spotify.com/v1/me/player/repeat?state=off&device_id=0becea5bee4ba4d68173b82cd6ff9942
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 1787, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1830, 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 276, in start_casting
client.repeat(state=repeat, device_id=spotify_device_id)
File "/usr/local/lib/python3.10/site-packages/spotipy/client.py", line 1875, in repeat
self._put(
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: 404, code:-1 - https://api.spotify.com/v1/me/player/repeat?state=off&device_id=0becea5bee4ba4d68173b82cd6ff9942:
Device not found, reason: None
spotcast.start
once, unless Spotify is not playing after 10 secondsPlease how do I update correctly if I installed from the package?