Advertisement
Guest User

Home Assistant Facebox Google TTS Automation

a guest
Sep 10th, 2020
368
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 1.33 KB | None | 0 0
  1. - id: 'cast_TTS_front_door_to_speakers_if_face_detected'
  2.   alias: "cast TTS front door to speakers if face detected"
  3.   trigger:
  4.   - entity_id: input_boolean.front_door_motion_sensor_face_detect_this_pass
  5.     from: 'off'
  6.     platform: state
  7.     to: 'on'
  8.   condition:
  9.     condition: or
  10.     conditions:
  11.     - condition: state
  12.       entity_id: media_player.kjokkenet
  13.       state: 'off'
  14.     - condition: state
  15.       entity_id: media_player.kjokkenet
  16.       state: 'idle'
  17.   action:
  18.   - service: media_player.volume_set
  19.     data:
  20.       entity_id:
  21.       - media_player.kjokkenet
  22.       volume_level: .5
  23.   - service_template: tts.google_translate_say
  24.     data_template:
  25.       entity_id: media_player.kjokkenet
  26.       message: 'At the front door:
  27.      {% for face in states.image_processing.facebox_front_door.attributes.faces -%}
  28.         {% if not face.name == None %}
  29.           {{ face.name }}
  30.           {% if not loop.last %}, {% endif -%}
  31.         {% endif -%}
  32.       {%- endfor %}
  33.       {% if states.image_processing.facebox_front_door.attributes.total_faces > states.image_processing.facebox_front_door.attributes.total_matched_faces %}
  34.         + {{ states.image_processing.facebox_front_door.attributes.total_faces - states.image_processing.facebox_front_door.attributes.total_matched_faces }} unrecognised person(s)
  35.       {% endif -%}'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement