As the latest Spotcast stable release is still version 4.x, the script is still based on that Spotcast version.
You can try the version from this branch
As I wrote above, I have script 22025.1. Unfortunately, it doesnât work.
Sorry, I missed that.
Looking better at the error messages it states that spotcast.transfer_playback is not found.
That action was introduced in Spotcast 5, and according to te docs also still works in v6
https://github.com/fondberg/spotcast/tree/dev?tab=readme-ov-file#setup
So, if you donât have that action, either Spotcast isnât properly starting/configured, or you are still using Spotcast v4.
Please check in devtools > actions which Spotcast actions are available to you.
Yes, i have spotcast.transfer_playback in the devtools > actions.
I currently have other errors:
Rejestrator: homeassistant.components.script.google_home_resume_helper
ĆčrĂłdĆo: helpers/script.py:2067
integracja: Skrypt (dokumentacja, Problemy)
Pierwsze zdarzenie: 19:05:51 (5 wystÄ
pieĆ)
Ostatnio zalogowany: 19:05:51
- Google Home Resume - Helper Script: If at step 2: Parallel action at step 1: parallel 1: Resume needed?: Resume playing: Spotify?: Error executing script. Invalid data for call_service at pos 2: extra keys not allowed @ data[âentity_idâ]
- Google Home Resume - Helper Script: If at step 2: Parallel action at step 1: parallel 1: Resume needed?: Error executing script. Invalid data for choose at pos 2: extra keys not allowed @ data[âentity_idâ]
- Google Home Resume - Helper Script: If at step 2: Parallel action at step 1: parallel 1: Error executing script. Invalid data for if at pos 10: extra keys not allowed @ data[âentity_idâ]
- Google Home Resume - Helper Script: If at step 2: Error executing script. Invalid data for parallel at pos 1: extra keys not allowed @ data[âentity_idâ]
- Google Home Resume - Helper Script: Error executing script. Invalid data for if at pos 2: extra keys not allowed @ data[âentity_idâ]
Can you share the full trace?
Hi, this is the current trace.
Iâd need the trace from the Google Home Resume script, and the helper script. Could you also share those?
Google home resume - dpaste: H577VCHCT
Helper script - dpaste: HADHFA9NA
I sent you the script logs a few days ago. Could you tell me if you were able to determine why the script wasnât working?
Sorry, Iâve been rather busy with other things.
Now the links are not valid anymore. Can you share them again?
I am sharing the tracks again.
Google home resume - dpaste/7N20o (YAML)
Helper script - dpaste/djkmz (YAML)
You are using âversionâ: â2024.9.0â.
The branch I pointed you to is â2025.1.0â
Try again with this version:
https://github.com/TheFes/Google-Home-Resume/blob/714bc8251ffc5be1806b7c47ef98910d6be57db0/google_home_resume.yaml
Unfortunately, I messed it up myself. The helper script was saved in two places, in the scripts and packages directories. I cleaned it up, and the script is now working properly. Thank you very much for helping me solve the problem.
Hi,
Iâve edited the script to make it work with Music Assistant, as with the original version I wasnât able to resume music/podcasts from where they were interrupted.
Thank you very much!
--- google_home_resume_original.yaml
+++ google_home_resume_modified.yaml
@@ -12,48 +12,23 @@
homeassistant:
customize:
script.google_home_resume:
# enter settings for the script here, all settings are optional, you can remove sections if you don't need them
# always leave the line with "settings: &settings" in!
settings: &settings
- primary_spotcast: "pepijn"
- radio_data:
- NPO Radio 2:
- picture: "http://192.168.2.3:8123/local/pictures/radio/npo_radio_2.png"
- title: "Er is maar één NPO Radio 2"
- Radio Veronica:
- picture: "http://192.168.2.3:8123/local/pictures/radio/radio_veronica.png"
- title: "WE. LOVE. MUSIC."
- Willy:
- picture: "http://192.168.2.3:8123/local/pictures/radio/willy.png"
- title: "MUSIC MATTERS"
- KINK:
- picture: "http://192.168.2.3:8123/local/pictures/radio/kink.jpg"
- title: "NO ALTERNATIVE"
- speaker_groups:
- media_player.huis_groep:
- - media_player.keuken_hub
- - media_player.slaapkamer_hub
- - media_player.pepijn_mini
- - media_player.woonkamer_home
- - media_player.werkamer_marleen_minini
- - media_player.zolder_werkkamer_stereo
- - media_player.floris_mini
- media_player.boven_groep:
- - media_player.pepijn_mini
- - media_player.slaapkamer_hub
- - media_player.werkamer_marleen_mini
- - media_player.zolder_werkkamer_stereo
- - media_player.floris_mini
- media_player.beneden_groep:
- - media_player.keuken_hub
- - media_player.woonkamer_home
- media_player.zolder_groep:
- - media_player.slaapkamer_hub
- - media_player.zolder_werkkamer_stereo
default_volume_level: 0.25
dummy_player: media_player.vlc_telnet
default_resume_delay:
- seconds: 20
+ seconds: 1 #20 seconds
max_runtime:
minutes: 10
stop_before_action: false
# settings for automation
enable_automation: false
dashboard_cast: true
announce_volume_automation: 0.4
@@ -223,30 +198,43 @@
- variables:
players_to_resume: >
{%- set target_list = players_to_resume if players_to_resume is defined else target_list %}
- {# determine entities which are playing #}
- {%- set playing = player_data | selectattr('state', 'eq', 'playing') | map(attribute='entity_id') | list %}
- {# add members of playing groups (they are sometimes not shown as playing) #}
- {%- set playing = playing + player_data
- | selectattr('state', 'eq', 'playing')
- | selectattr('type', 'eq', 'group')
- | map(attribute='members')
- | sum(start=[])
- %}
- {# add members of groups in target_list to create checklist of entities #}
- {%- set checklist = target_list + player_data
- | selectattr('entity_id', 'in', target_list)
- | map(attribute='members')
- | sum(start=[])
- %}
- {# check which entities in checklist are playing #}
- {%- set checklist_playing = checklist | select('in', playing) | list %}
- {# check if entities in checklist are part af a group which is playing#}
- {%- set groups_playing = player_data
- | selectattr('state', 'eq', 'playing')
- | selectattr('type', 'eq', 'group')
- | selectattr('members', 'search', checklist_playing | join('|'))
- | map(attribute='entity_id')
- | list
- %}
- {# create lists of members of playing groups #}
- {%- set members_reject = player_data
- | selectattr('entity_id', 'in', groups_playing)
- | map(attribute='members')
- | sum(start=[])
- %}
- {# create list of playing members of groups in checlist #}
- {%- set members_playing = player_data
- | selectattr('entity_id', 'in', checklist)
- | selectattr('state', 'eq', 'playing')
- | map(attribute='entity_id')
- | list
- %}
- {# combine it all to determine which entities should be resumed #}
- {{ (checklist_playing + groups_playing + members_playing)
- | reject('in', members_reject + resume_active)
- | unique
- | list
- }}
+ {# determine entities which are playing OR buffering #}
+ {%- set playing = player_data
+ | selectattr('state', 'in', ['playing', 'buffering'])
+ | map(attribute='entity_id')
+ | list
+ %}
+ {# add members of playing groups (they are sometimes not shown as playing) #}
+ {%- set playing = playing + player_data
+ | selectattr('state', 'in', ['playing', 'buffering'])
+ | selectattr('type', 'eq', 'group')
+ | map(attribute='members')
+ | sum(start=[])
+ %}
+ {# add members of groups in target_list to create checklist of entities #}
+ {%- set checklist = target_list + player_data
+ | selectattr('entity_id', 'in', target_list)
+ | map(attribute='members')
+ | sum(start=[])
+ %}
+ {# check which entities in checklist are playing/buffering #}
+ {%- set checklist_playing = checklist | select('in', playing) | list %}
+ {# check if entities in checklist are part of a group which is playing/buffering #}
+ {%- set groups_playing = player_data
+ | selectattr('state', 'in', ['playing', 'buffering'])
+ | selectattr('type', 'eq', 'group')
+ | selectattr('members', 'search', checklist_playing | join('|'))
+ | map(attribute='entity_id')
+ | list
+ %}
+ {# create lists of members of playing groups #}
+ {%- set members_reject = player_data
+ | selectattr('entity_id', 'in', groups_playing)
+ | map(attribute='members')
+ | sum(start=[])
+ %}
+ {# create list of playing/buffering members of groups in checklist #}
+ {%- set members_playing = player_data
+ | selectattr('entity_id', 'in', checklist)
+ | selectattr('state', 'in', ['playing', 'buffering'])
+ | map(attribute='entity_id')
+ | list
+ %}
+ {# additionally, include any targeted entity that has a media_content_id (e.g. Music Assistant) #}
+ {%- set extra_targets = player_data
+ | selectattr('entity_id', 'in', target_list)
+ | selectattr('media_content_id', 'defined')
+ | map(attribute='entity_id')
+ | list
+ %}
+ {# combine it all to determine which entities should be resumed #}
+ {{ (checklist_playing + groups_playing + members_playing + extra_targets)
+ | reject('in', members_reject + resume_active)
+ | unique
+ | list
+ }}
@@ -459,7 +447,7 @@
- alias: "Google Home with screen back to idle screen"
if: "{{ player.type == 'screen' and not resume }}"
then:
- alias: "Turn Google Home off to return to idle mode (photo display)"
service: media_player.turn_off
@@ -467,7 +455,7 @@
entity_id: "{{ player.entity_id }}"
- alias: "Resume needed?"
- if: "{{ ytube_resume or (state_changed and resume) }}"
+ if: "{{ ytube_resume or resume }}"
then:
- alias: "Set variables"
variables:
bbc: >
@@ -548,6 +536,17 @@
- alias: "Play the media to avoid long delays"
if: "{{ wait.completed }}"
then:
- alias: "Play (avoids long delay)"
service: media_player.media_play
target:
entity_id: "{{ player.entity_id }}"
+ - alias: "Seek back for on-demand streams (Music Assistant, etc.)"
+ if: >
+ {{ wait.completed
+ and player.media_position is defined
+ and pl
Any idea how to make it works with SpotifyPlus?
I had built in MA support before, but removed it as MA can handle that perfectly fine itself ![]()
Nice script @TheFes! Iâm wondering if this script is needed for my scenario:
- Audio is already playing on Google Home speakers
- Automation pauses current media, and plays a short audio (2m)
- Checks idle state, then resume previous audio.
Will HA automation be able to handle this natively, or this script is still required for the last step? Thanks
The script is not using any actions which a native HA automation also canât perform.
It will depend on what is playing how difficult it is to set this up in an automation.
If you want to resume Spotify, youâd need something like Spotcast to perform the resume. A simple radio stream can be resumed without any additional integrations.
Using a script makes it easier to perform the actions needed, so you donât have to add all the actions to each automation. Using this script prevents you from re-inventing the wheel, but it could also be that it is a bit too much for your use case.