I have several automations that send out text messages as voice to various media players. I have simplified this, by creating a script with fields (se below) that can be called from any automation, that simply needs to send a voice message to one or more media players.
It works, but I would also like to restore the state of the media player, when the message has been delivered by the media player.
In the automations that was done by calling the service: scene.create and saving the state using the snapshot_entities of the media_player.
Now here’s my problem:
I can’t figure out how I can use the field “speaker” in place of the entity_id: “media_player.hub_stue” in my script. I know that the “speaker” field resolves to “entity_id: media_player.hub_stue”, which is not accepted as a value by snapshot_entities.
Can any of you please give me some advise on this problem?
That makes total sense. I changed the other references accordingly, and they work as expected.
However, the state of the speaker (which was playing youtube music) is unfortunately still not restored.
If possible, could you please call the script, and verify that it works for you.
Thanks for your help.
That’s a separate issue from your original question. Restoring a media_player’s state depends on the capabilities of its underlying integration and the content it’s playing.
FWIW, I have Sonos speakers so I use sonos.snapshot instead of scene.create.
EDIT
I found one of my old posts that contains a script very similar to the one you’re using (although without variables) and the person who tested it reported even the volume level wasn’t restored. They said their media_player was using Google Cast.
I will continue experimenting. Apparently, Google Nest Hub and Nest Audio reacts differently on the snapshot_entities request.
I’ve just found out that it works on my Nest Hub Max.