"Welcome Home" Google Home Mini & Device Tracker - can't get it working!

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

- id: '1611874720423'
  alias: Welcome home
  description: ''
  trigger:
  - platform: device
    device_id: 0cb364362e78cde13a9fd0a540473e75
    domain: device_tracker
    entity_id: device_tracker.note_9
    type: enters
    zone: zone.home
  action:
  - service: tts.google_translate_say
    entity_id: media_player.hallway_speaker
    data: {}
    message: 'Welcome home'

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

There is an issue in your syntax. Try this

- 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.

This works fine. I can hear the Google Home device speak

Capture1

Please check with the execute button in automation. See if that works. If it works please share the state of the deice_tracker.

I’ve clicked execute and i hear nothing.

The first image below is when my phone is at home. When i click execute i don’t hear anything.

And when i spook my GPS so HA sees me as not home and then try to execute i still don’t hear anything. Below is the state when i spoof my GPS

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.

When i paste that in i get the following error

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.

Try adding this in UI and not the text editor. You can do this like this.

screen-capture

1 Like

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.

It seems to have broken again. I’ve checked the code and re-copied it exactly as you showed me and its not triggering the sound again. :expressionless:

Please check if it works when you hit execute button in automation.

When i hit the execute button i can hear the google device pairing sound but there is no voice output.

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.

You can download mp3s of tts from websites like this. https://ttsmp3.com/

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.

1 Like

Yes, that is working for me again. At least i am not at the mercy of when Google’s server does down. Thank you once again @sheminasalam

1 Like