Im having trouble getting this to trigger. Basically when my phone is detected as being at home i want a specific Google Home Mini device to speak “Welcome Home”. I’m testing it on a Samsung Note 9 with a fake GPS app to spoof my location so HA thinks i am home/away. I’m getting no speech when i “come home” and i can’t figure out what i am doing wrong. Any advice welcome
Hi…please Try this. Instead of device, I used state.
alias: Welcome home
description: ''
mode: single
trigger:
- platform: state
entity_id: device_tracker.note_9
to: home
condition: []
action:
- service: tts.google_translate_say
data:
entity_id: media_player.hallway_speaker
message: Welcome home
I had to adjust it slightly for HA to accept the code but no, that is not working either
- id: '1611874720423'
alias: Welcome home
description:
mode: single
trigger:
- platform: state
entity_id: device_tracker.note_9
to: home
condition: []
action:
- service: tts.google_translate_say
data:
entity_id: media_player.hallway_speaker
message: Welcome home
- id: '1611874720423'
alias: Welcome home
description:
mode: single
trigger:
- platform: state
entity_id: device_tracker.note_9
to: home
condition: []
action:
- service: tts.google_translate_say
data:
entity_id: media_player.hallway_speaker
message: Welcome home
No, still nothing. Is there a command to turn on the media player device first? On my main overview page i can see my Chromecast devices and when i go into their settings there is a power icon toggle i need to set and then my chromecast makes a pairing sound if i try do a speech output test. So im presuming there is a further line in action that pairs the device before speech output works?
Can you check if the tts service is working fine in the developer console. If it is working fine, come back to automations and click execute and see if this is triggered.
Ok, that means there is some issue with the automation.yaml. Go to this automation and in the right top corner there is settings click on that and select edit as yaml. when it comes. Delete the entire yaml and paste this.
alias: Welcome home
description: ''
trigger:
- platform: state
entity_id: device_tracker.note_9
to: home
condition: []
action:
- service: tts.google_translate_say
data:
entity_id: media_player.hallway_speaker
message: Welcome home
mode: single
Save try execute gain. Hopefully this should eliminate all sytax issues.
end of the stream or a document separator is expected at line 39, column 1:
alias: Welcome home
To “fix” it i’ve added spaces before some words until the file editor is happy and shows a green tick. Below is the “fixed” code.
alias: Welcome home
description: ''
mode: single
trigger:
- platform: state
entity_id: device_tracker.note_9
to: home
condition: []
action:
- service: tts.google_translate_say
data:
entity_id: media_player.hallway_speaker
message: Welcome home
With that saved i click “execute” on either device.tracker states and i still don’t hear anything.
Yes that worked, the automation executes and i can confirm that when i fake my GPS location and “come home” it is triggering the automation and the voice output is working. Thank you for your help.
google tts is having some issues for me too. Maybe its something from the side of google. Heard there are some outages. For me it takes some time to play things. There is another way. We can make an mp3 and ask google home to play it.
Then place it in /config/www/ and then edit the automation like this.
alias: Welcome home
description: ''
mode: single
trigger:
- platform: state
entity_id: device_tracker.note_9
to: home
condition: []
action:
- service: media_player.play_media
data:
entity_id: media_player.hallway_speaker
media_content_id: http://<ha_ip>:8123/local/welcome.mp3
media_content_type: music
Make sure that you edit the media_content_id to the url of the mp3.