Arrival and Departure Announcement Google TTS

Blue print to allow Google TTS announcements when a person in your HA arrives or departs from a zone you have defined.

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

blueprint:
  name: Arrival & Departure Announcements Google TTS
  description: Use Google TTS to announce when a person arrives or departed from a zone
  domain: automation

  input:
#person
    person_select:
      name: Person
      description: "Person to trigger TTS on"
      selector:
        entity:
          domain: person
#zone
    zone_select:
      name: Zone
      description: "Zone to trigger TTS on"
      selector:
        entity:
          domain: zone
#Speaker selector
    media_player:
      name: Device(s) to speak thru
      description: This uses google_translate to send a text message
      selector:
        entity:
          domain: media_player
#message arrival
    arrival_message:
      name: Arrival Message
      description: "Type your arrival message here:"
      default: Welcome Home
      selector:
        text:
          multiline: true
#message departure
    departure_message:
      name: Departure Message
      description: "Type your departure message here:"
      default:
      selector:
        text:
          multiline: true
#Automation Code
trigger:
  - platform: zone
    entity_id: !input person_select
    zone: !input zone_select
    event: enter
  - platform: zone
    entity_id: !input person_select
    zone: !input zone_select
    event: leave
condition: []
action:
  - choose:
      - conditions:
          - condition: zone
            entity_id: !input person_select
            zone: !input zone_select
        sequence:
          - service: tts.google_translate_say
            data:
              entity_id: !input media_player
              message: !input arrival_message
      - conditions:
          - condition: not
            conditions:
              - condition: zone
                entity_id: !input person_select
                zone: !input zone_select
        sequence:
          - service: tts.google_translate_say
            data:
              entity_id: media_player.kitchen
              message: !input departure_message
    default: []
    default: []
mode: queued
max: 10```
1 Like

Updated code in the thread to reflect updates made to the GitHub

GitHub

Made departure code more conditional rather than a default.
Made departure optional

Not sure what I am doing wrong but this is the error in the log:

Blueprint Arrival & Departure Announcements Google TTS generated invalid automation with inputs OrderedDict([(‘person_select’, ‘person.susan_duff’), (‘zone_select’, ‘zone.home’), (‘media_player’, ‘media_player.upstairs’), (‘arrival_message’, ‘Susan Duff is here’)]): Unexpected value for condition: ‘OrderedDict()’. Expected and, device, not, numeric_state, or, state, sun, template, time, trigger, zone @ data[‘action’][0][‘choose’][1][‘conditions’][0]. Got None required key not provided @ data[‘action’][0][‘choose’][1][‘sequence’]. Got None

Sorry to bump this but I’m having a problem with this as well:

My fault from the logs is:
2022-04-24 14:55:11 ERROR (MainThread) [homeassistant.components.automation] Blueprint Arrival & Departure Announcements Google TTS generated invalid automation with inputs OrderedDict([('person_select', 'person.duncan_morison'), ('zone_select', 'zone.home'), ('media_player', 'media_player.living_room_speaker'), ('arrival_message', '[Duncan will be home soon.]')]): Unexpected value for condition: 'OrderedDict()'. Expected and, device, not, numeric_state, or, state, sun, template, time, trigger, zone @ data['action'][0]['choose'][1]['conditions'][0]. Got None

My automation.yaml is:
image

also tried without the square brackets:
image

The blueprint is imported from here.

Any help would be much appreciated.

This is great. Would it be possible to add a feature to this blueprint so you can also send notifications to a phone using the home assistant notification system?

1 Like

Ever get it working?