Store media state of cast devices on event (e.g. leaving home) and resume later

Background

I’ve created the Google Home Resume script last year, to resume a Google Cast device after it has been interrupted. One of the users asked if it would be possible to also resume on eg leaving the house, and restoring the state when you return, and this script is the result.

As of version 2022.12 this script is included into the total Google Home Resume package


Latest changes

2022.12 Happy Holidays; let’s bring the family together

:red_circle: BREAKING

  • Integrated into the Google Home Resume package, update according to the instructions

:star2: Improvements

  • Template improvements

  • More use of YAML anchors

Older changes can be found here


How to install and use the package

As of version 2022.12 the instructions how to install the package are moved to my GitHub repository, so it is easier for me to keep them up to date.


Buy me a coffee

If you like this script, please feel free to buy me a coffee (I might spend it on another beverage though).
In case you decide to do so, thanks a lot!

Buy Me A Coffee

1 Like

Update

Version 0.4.0 - 21 March 2022

:stop_sign:: Breaking change

:sparkles:: Improvements

  • No need to maintain speaker_groups in this script anymore, this will be handled by the Google Home Resume script now

Update

Version 0.4.2 - 22 March 2022

:star2: Improvements

  • Added a update of Spotify entities before data is stored, so the most recent data is used
  • Only relevant data of entities is stored (depending on state and playing app)

:bug: Bug fixes

  • (0.4.2) Template fix

Update

Version 0.5.0 - 4 May 2022

:red_circle: BREAKING

  • Due to implemented changes introduced in 2022.5 this version is now required for the script

Version 0.6.0 - 16 May 2022

:sparkles:: New features

  • Added an optional setting ignore which can be used to prevent entities/devices/areas from being resumed.
  • Additional setting also_stop to provide media players which should also be stopped when the date is stored. Useful if you use the script when you eg leave home, and want to turn off the TV and soundbar as well.

Update

Version 0.6.1 - 12 July 2022

:bug: Bug fixes

  • Template fix to prevent errors on missing attributes when creating the data variables

Wondering if modification of this script could be used to store the state of ‘media_player.spotify_userid’ (Spotcast) with an event (arrive home) and then resuming the state on a different Google Cast device (home speakers) upon a different event (open front door) to effectively hand off music or podcasts from a smart phone (playing music or podcasts on the drive to the house) to the home speakers to continue listening.

In this case, one would need to separate the target field:

  • store target
  • resume target

Thanks for sharing your scripts!

Update

Version 2022.11.0 - 21 November 2022

:red_circle: BREAKING

  • Combined the script and template sensor in a package, see the setup instructions for more information
  • This version requires version 2022.11.0 of the Google Home Resume script or higher

:star2: Improvements

  • Changed version number to YYYY.MM.version
  • Configuration variables are removed, the script uses the name of the binary sensor as defined in the template sensor configuration (binary_sensor.resume_data_google_home_event)
  • Used improved templates to store data
  • Removed file integration for long term storage as trigger based templates restore their state after restart or reload

:bug: Bug fixes

  • (2022.11.1) Fixed a template error

Version 2022.11.2 - 23 November 2022

:red_circle: BREAKING

  • You will need to update the Google Home Resume script to 2022.11.3 as well if you update to this version

:star2: Improvements

  • The script makes use of the settings of the Google Home Resume script so it can immediately store all data, and no further processing in the Google Home Resume script is needed.

Update

Version 2022.11.3 - 24 November 2022

:bug: Bug fixes

  • Better handling of empty settings

Update

Version 2022.11.4 - 26 November 2022

:bug: Bug fixes

  • Fix template copy/paste error causing variable store to fail

Update

2022.12 Happy Holidays; let’s bring the family together

:red_circle: BREAKING

  • Integrated into the Google Home Resume package, update according to the instructions

:star2: Improvements

  • Template improvements

  • More use of YAML anchors