Good to hear you got it resolved!
Update
Version 1.5.1 - 12 July 2022
Bug fixes
- Template fix to prevent errors on missing attributes when creating the data variables
Update
Version 1.5.2 - 21 July 2022
Bug fixes
- Template to define target was not working in case Music Assistant is installed. Both the normal entity and the MASS entity would be seen as playing the ambient sound. The template now only uses cast entities.
Hi @TheFes,
First of all thank you for the great Job you have done. I’m a little bit lost with all the updates and other posts. Could you please Help me for this:
I already have my Nesthub communicating via a script: when I ask a question from Google, such as: “where is person X”, it is seending me a tts as an answer and a MAP with a location of the person on the screen.
Now I want to use your screipt to make it respond to me on any Nesthub at home. Could you post here the latest way you found to do it please.
Many thanks for your greak work and help.
Could you show me how you create that notification. I can use that to show how to get in sent to the hub
Sure my full code is given at this post. You have to download the PDF.
Many thanks
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
- Copy the script from the GitHub page, and add it to your
scripts.yaml
or wherever you place your scripts. - Make sure your Google Nest Hub is playing an ambient sound, White Noise for example by giving it a voice command. Make sure that it is playing
- Go to Developer Tools > States and find your Google Nest Hub media player entity, copy the
media_title
attribute contents, it should be something likeWhite Noise
or another title representing the ambient sound which is playing - Edit the Google Home Voice script variables:
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
- Create a new script which sends the right commands to the Google Home Voice script, something like this:
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
- Change the script you posted, to use the variable created by the Google Home Voice script
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
- Create a routine in the Google Home app which triggers the script created in step 5, and ends with playing the ambient sound.
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
- No I’m talking about this one, which is linked to in the first post of this topic: Script to send actions to the right Google Home (based on voice commands)
- Just say: “Hey Google, play white noise” to your Google Home Device
Thanks; I was busy this afternoon, I will try to check this tomorrow. I’ll let you know ASAP.