Is there a way to find the source device for a google assistant command to activate a scene or anything else?
I have a couple of hubs and cast devices, and would like to be able just to say ‘activate cameras’, to show me an overview of my cameras on the device I’m closest too.
Not directly. There have been other posts on this subject and I’ve toyed with it in the past. If the spoken command runs a Google Assistant Routine, that routine can play silent music on the source device, and then HA can detect which device played that music. Pretty rubbish, but it works.
However, for cameras you should be able to expose them to the Google Home app and ask them to be shown, although this would be one at a time (but maybe you can set up a virtual camera that includes others?).
First you have to decide what media to play. For example, if you normally use Spotify, if you play something from there, it may turn it off on any other Google Home it’s currently playing on. I don’t imagine I will ever use Deezer, so I have set the first line of the Google routine to “play music on Deezer”. Then I have the following in Node Red:
This looks for state changes on all media devices (matching substring “media_player.” and turn off “Current state equals previous state”).
The test for Deezer is just looking for when the app name changes from not-Deezer to Deezer.
$not(data.old_state.attributes.app_name = 'Deezer') and
(data.new_state.attributes.app_name = 'Deezer')
Then I store off the “data.entity_id” and “data.new_state.attributes.volume_level” and set the volume to 0 so it doesn’t actually play anything. I found this better than trying to mute.
Then when responding to the correct Google Home, I reset the volume and use the entity that I stored. Using TTS to speak something then stops whatever music was silently playing.
If you instead have a paid account you don’t mind using, then you can play specific silent songs such as “1 Minute of Silence” on Spotify. Then you don’t have to worry about changing the volume.