Found it, fixed in 1.6.0
Update
Version 1.6.0 - 7 March 2022
BREAKING
- Iâve added YAML anchors to copy the variables set in the main resume script to the helper scripts, this means you need to keep the scripts in one yaml file, otherwise the anchors will not work.
- The variable
group_id
whichis used for the group creation is moved to the config variables, because it was also used in the helper scripts
Improvements
- Other changes to make the script work with the new Google Home Event script which I will publish soon.
Bug fixes
- Fix for volume restore of group members
Seems substantially more broken now, sorry - doesnât even work for single speakers. Different error:
Think this was my fault - its working after a restart! Thanks so much
Ah, solved already.
I did see you only changed the primary_spotcast
variable, and left the rest unchanged, but you changed it to jeremy.herbison
instead of jeremy_herbison
.
The error was coming from Spotcast, since there is no account for jeremy_herbison
set up (as it is your primary, non named, account).
My music resumes great and the camera feed also works. The only thing missing is the meta data. So the music starts playing but the screen is black. Below is what I initially send to the cast device.
media_content_type: music
media_content_id: http://icecast.vrtcdn.be/mnm-high.mp3
extra:
metadata:
metadataType: 3
title: Music and More
artist: VRT MNM
images:
- url: https://cdn-profiles.tunein.com/s10861/images/logoq.png?t=161772
UPDATE
Version 1.6.1 - 9 March 2022
Improvements
- Changed service call to resume audio streams so it will display the image on players with a screen as suggested by @thecobra666
Excellent suggestion, I have been searching how to achieve this (showing the picture on a Google Nest Hub screen) but never found a working solution.
As you can see, I immediately implemented this
Hi, I have noticed recently that the volume is low on the announcements (2.5), Iâve edited the script to a volume of 6 but Iâm still finding some of my players going back to 2.5. Is there something Iâm missing? itâs strange as some media players remain at the volume they were set at while others revert back to 2.5 and will only play announcements at 2.5
2.5 and 6 are a bit strange values, it should be either 0.25
and 0.6
or 25
(%) and 60
(%)
If you enter 2.5 as volume, or 6 for that matter, that will result in 0.025
or 0.06
which is the same as 2.5%
or 6%
Basically, TTS is no longer part of this script, as you can send any service call now, but Iâm happy to help if I can, could you send the yaml code of how you now send the TTS and apply the TTS volume?
Sorry, I typed it incorrectly on here it was originally 0.25 and changed to 0.6 (default_volume_level: 0.6) Iâm going to update the script in case Iâm running an older version and update HA and see if that resolves it. If that doesnât work I will post the yaml code, thanks.
The default_volume_level
is not used for sending TTS, it is only used in case the script could not determine the volume of your speaker before it was interrupted (by the TTS, or something else) and will then be used as the volume after the interruption is over.
Example:
- Player was
off
- Script was started, but could not retrieve the volume of the player
- TTS was played on volume level
0.4
- TTS is finished
- Volume is set to
default_volume_level
setting, because volume before TTS was unknown
Update
Version 1.6.1 - 14 March 2022
Improvements
- Do not store unnecessary data of non playing devices
Iâm not sure default_volume_level is working right. Two issues:
If i use your script to send a TTS to a speaker thatâs âoffâ (isnât otherwise playing Spotify et al.) but has a volume of 50%, the volume level changes to 25%. Why? I didnât do anything to change the volume.
If i set default_volume_level: 0.5 it still seems to change it to 25%. Shouldnât it at least default to 50%? i mean, ideally it wouldnât change it at all.
Could you upload a trace (json) to codepile.net (or a similar code upload site)
I can then see whatâs happening.
Basically, it should change the volume back to the old volume, and if it is not known it should use the default_volume_level
set.
CodePile | Easily Share Piles of Code | Pile
It appears this only occurs if the speaker is off when your script is called - i set the volume to 50%, turn it off, then called this âtestâ automation. The volume is now at 25%.
Tried again with the speaker on, and it stayed at 50%.
Sorry, I need a trace of the Google Home Resume script, not of the automation in which you call it.
And of course from when it doesnât work properly, so when the speaker is off
.
Basically the script should turn the speaker on first, and then retrieve the volume. And if that is not working, it should at least use the default_volume_level
youâve set.
Right, of course - duh.
I just realized the restore non-playing script also needs variables defined, so thatâs where the 0.25 is coming from. So the bug is just that it canât read the volume out of an âoffâ speaker, i guess.
CodePile | Easily Share Piles of Code | Pile
CodePile | Easily Share Piles of Code | Pile
Are you using different files per script? Because the default_volume_level
setting should be the same as for the main script as YAML anchors are used.
But I think you gave me a push in the right direction, I have to check, but I think I can solve this quite easily.
Hi @TheFes, I have a question.
Iâm succefull add your script Resume to my HA. But I have some confuse on the way script working, can you find out my issue for me.
I have script with multi TTS and media play queued and I make automation to play this script.
The problem is that. After play first service ( a script to play media with delay ).
It resume media before activate automation and after that continue play media on script.
After finsish script nothing was resume.
The length of TTS is about 100 seconds
I donât know why the Resume script activated while my script have still not finished yet
I donât find out any error and all script finished successful
P/s: My script play_audio very simple. Itâs just play message and add delay, timeout same as in example
On script part:
- choose:
- conditions: .....
default:
- service: script.play_audio
data:
message: !include speech/notify.yaml
- service: media_player.play_media
data:
entity_id: media_player.loa
media_content_id: ' {{ [
"http://local/media/ringtone/A.mp3",
"http://local/media/ringtone/B.mp3",
] | random}} '
media_content_type: music
- delay: 00:00:05
- timeout: "{{ state_attr('media_player.loa','media_duration') |float + 5 | round(0)}}"
wait_template: '{{ not is_state ( "media_player.loa", "playing")}}'
On automation part:
- service: script.google_home_resume
data:
action:
- service: script.turn_on
target:
entity_id: script.my_script
target:
entity_id: media_player.loa
Donât use script.turn_on
, but use service: script.my_script
.
With script.turn_on
the resume_script will go to the next step immediately. When you call the script directly, the resume script will wait until it is finished to go to the next step.