Google Home voice announcements for entering and leaving zones

Hi,

Here is my automation for voice announcements, it may be useful for others.
It doesn’t announce leaving or entering home by design.

Change person1 and 2 to your users names.
Change kitchen_speaker to whatever your google home is called.

# V1.2 Fix multiple announcements for same zone exit.
# V1.1 Fix multiple announcements for same zone arrival.
# V1.0 Initial release
alias: Zone announcement
description: ""
trigger:
  - platform: state
    entity_id:
      - person.person1
      - person.person2
action:
  - choose:
      - conditions:
          - condition: template
            value_template: "{{trigger.from_state.state not in trigger.to_state.state and trigger.to_state.state not in ['home', 'not_home']}}"
        sequence:
          - service: tts.google_translate_say
            data:
              cache: false
              entity_id: media_player.kitchen_speaker
              message: >-
                {{trigger.to_state.name}} has arrived at
                {{trigger.to_state.state}}
      - conditions:
          - condition: template
            value_template: >-
              {{trigger.from_state.state not in ['not_home',
              trigger.to_state.state] and trigger.to_state.state not in 'home'}}
        sequence:
          - service: tts.google_translate_say
            data:
              cache: false
              entity_id: media_player.kitchen_speaker
              message: "{{trigger.to_state.name}} has left {{trigger.from_state.state}}"
    default: []
mode: parallel

3 Likes

James,

I cant get this to work. Could that be because of the change to tts.speak?