This is my Script, which is calling an automation
alias: Where is Person X
sequence:
- service: automation.trigger
data: {}
target:
entity_id: automation.personX_location_to_google_home_v6
mode: single
This is my Script, which is calling an automation
alias: Where is Person X
sequence:
- service: automation.trigger
data: {}
target:
entity_id: automation.personX_location_to_google_home_v6
mode: single
Thatâs a comprehensive write up, however I will need the YAML code of the automation as well, and changes in your script will be required.
I also donât understand why you trigger an automation in your script, it makes more sense to turn on a script to me.
UPDATE:
Please ignore this post and jump to my next post to get the final version of my script.
Well the only way I found is by creating the automation that was called by the script. The YMAL code of my script is given just above in my previous post and the YMAL code of my automation is at the end of my PDF. But I give it just below:
You can change my script ofcourse.
Initialy I have done this document keeping in mind that some user donât want to go and check the YAML code so I gave the easiest way to do it and just at the end when it was not possible to do it without using the code I gave the instructions to go and edit the code
After reading you message I have changed my code. Now instead of using a Script + Automation, I have intégrated all in the One Script. Please consider the below given Script as my new program and ignore my previous post.
Many thanks.
alias: PersonX Location Script to Google Home v1
sequence:
- if:
- condition: state
entity_id: person.personx
state: not_home
then:
- service: tts.cloud_say
data:
entity_id: media_player.nest_hub
message: The Person X is out of known zones, but I will cast you a map withing few seconds
- delay:
hours: 0
minutes: 0
seconds: 6
milliseconds: 0
- service: cast.show_lovelace_view
data:
entity_id: media_player.nest_hub
dashboard_path: lovelace
view_path: psxmap
- delay:
hours: 0
minutes: 1
seconds: 10
milliseconds: 0
- service: media_player.turn_off
data: {}
target:
device_id: 82c4023ee17f86bf5177ab8ce2f6aXXX
else:
- service: tts.cloud_say
data:
entity_id: media_player.nest_hub
message: The Person X is nearby {{ states('person.personx')}}
- delay:
hours: 0
minutes: 0
seconds: 6
milliseconds: 0
- service: cast.show_lovelace_view
data:
entity_id: media_player.nest_hub
dashboard_path: lovelace
view_path: psxmap
- delay:
hours: 0
minutes: 1
seconds: 10
milliseconds: 0
- service: media_player.turn_off
data: {}
target:
device_id: 82c4023ee17f86bf5177ab8ce2f6aXXX
mode: single
This could work, but I donât have time to look into it today or tomorrow. I will come back to you on Thursday with some suggestions.
I assume you already have the Google Home Voice script set up?
No problem take your time
If you mean the communication between Google Assistant and HA by connecting to the script, the answer is âYESâ. Everything is working perfectly. When I say: âHey Goggle where is Person Xâ, It is replying to me with what I have written in the script. Ths only thing now is to have this program sent to the Nesthub Iâm talking with.
No, I mean the script which is mentioned in the first post of this community post. Did you already add that script to your configuration?
No I didnât, to be honnest, I was as I said before lost with all the modifications, updates and other posts. So thatâs why I wanted you to help me. When reading in the middle of these posts, I red somewhere that we donât need to add that script etc⊠So If you can just guide me with the latest update it will really help me.
Again thanks a lot and I really appreciate your help
scripts.yaml
or wherever you place your scripts.media_title
attribute contents, it should be something like White Noise
or another title representing the ambient sound which is playing variables:
check_for_title: "White Noise" #or whatever title you got from the media_player entity
use_resume: false #unless you also set up the Google Home Resume script to resume what was playing afterwards
person_x_locator_voice:
alias: Locate person X by voice command
sequence:
- alias: "TTS for speaker voice command"
service: script.google_home_voice
data:
target_variable: true
action:
- alias: "Trigger Person X locator cast script"
service: script.person_x_location # this should be the script you posted above
alias: PersonX Location Script to Google Home v1
sequence:
- if:
- condition: state
entity_id: person.personx
state: not_home
then:
- service: tts.cloud_say
data:
entity_id: "{{ voice_target }}"
message: The Person X is out of known zones, but I will cast you a map withing few seconds
- delay:
hours: 0
minutes: 0
seconds: 6
milliseconds: 0
- service: cast.show_lovelace_view
data:
entity_id: "{{ voice_target }}"
dashboard_path: lovelace
view_path: psxmap
- delay:
hours: 0
minutes: 1
seconds: 10
milliseconds: 0
- service: media_player.turn_off
data: {}
target:
entity_id: "{{ voice_target }}"
else:
- service: tts.cloud_say
data:
entity_id: "{{ voice_target }}"
message: The Person X is nearby {{ states('person.personx')}}
- delay:
hours: 0
minutes: 0
seconds: 6
milliseconds: 0
- service: cast.show_lovelace_view
data:
entity_id: "{{ voice_target }}"
dashboard_path: lovelace
view_path: psxmap
- delay:
hours: 0
minutes: 1
seconds: 10
milliseconds: 0
- service: media_player.turn_off
data: {}
target:
entity_id: "{{ voice_target }}"
mode: single
Thank you very much I will try this this weekend and comeback to you.
Sorry as Iâm a new user in Home Assistant can you just give little more info about step 1 & 2:
1/ Step 1: When you say copy the script, are you talking about this one: Link
2/ Step 2: is not clear. Do you want me to creat a script in HA that will play a sound in Google Home when I call it fromt the Nest Hub for example ?
Thank you for your help
Thanks; I was busy this afternoon, I will try to check this tomorrow. Iâll let you know ASAP.
I am so many versions behiind, really need to update at this point! Thanks again for this.
Absolutely brilliant idea. I just wrote a briefing/home status script and realized the need to solve the problem of playing to the evoked speaker. Looking forward to implementation when I can get Resume up and running again.
I tried to use it with Sonos and Google Assistant but unfortunately Sonos doesnât report playing ambient noises (e.g. white noise). Itâs not visible in the Sonos app as well. What I tried is to play a song from Spotify instead, but the problem is that Google Assistant announces the song with âAll right, playing Dancing Queen on Spotifyâ. Then the played song is visible in the Home Assistant media player state, but it takes sometimes over 10 seconds to trigger.
Wondering if you have any other ideas when ambient sounds are not detected by Home Assistant media player?
Waiting for Dancing Queen to start
google_home_voice:
alias: 00 - Google Home Voice
variables:
check_for_title: Dancing Queen
Thereâs one thing that I found could be used for the speaker identification which is the speaker volume. The Google Home routine can change the assistant volume by 1%. This is almost immediately visible in the Home Assistant state debugger - in this case from 0.4 to 0.39.
I tested this with a voice command like Decrease the volume by 1% and it also is immediately visible. Wondering if the script could be modified to detect this kind of change? E.g. when the script starts it would record all the volumes and detect which one dropped by 1 percentage point?
Before
group_members:
- media_player.salon_speakers
volume_level: 0.4
After
group_members:
- media_player.salon_speakers
volume_level: 0.39
Changes for Google Home Voice script