uCtaudio

Untitled

Sep 9th, 2020
182
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #cast_TTS_front_door_to_speakers_if_face_detected
  2. - id: 'cast_TTS_front_door_to_speakers_if_face_detected'
  3.   alias: "cast TTS front door to speakers if face detected"
  4.   trigger:
  5.   - entity_id: input_boolean.front_door_motion_sensor_face_detect_this_pass
  6.     from: 'off'
  7.     platform: state
  8.     to: 'on'
  9.   condition:
  10.     condition: or
  11.     conditions:
  12.     - condition: state
  13.       entity_id: media_player.kjokkenet
  14.       state: 'on'
  15.     - condition: state
  16.       entity_id: media_player.kjokkenet
  17.       state: 'idle'
  18.   action:
  19.   - service: media_player.volume_set
  20.     data:
  21.       entity_id:
  22.       - media_player.kjokkenet
  23.       volume_level: .5
  24.   - service_template: tts.google_translate_say
  25.     data_template:
  26.       entity_id: >
  27.         {% if not is_state('media_player.kjokkenet', 'playing') and not is_state('media_player.eiriks_rom', 'playing') %}
  28.           media_player.kjokkenet, media_player.eiriks_rom
  29.         {%  elif not is_state('media_player.kjokkenet', 'playing') %}
  30.           media_player.kjokkenet
  31.         {%  elif not is_state('media_player.eiriks_rom', 'playing') %}
  32.           media_player.eiriks_rom
  33.         {% endif %}
  34.       message: 'At the front door:
  35.      {% for face in states.image_processing.facebox_front_door.attributes.faces -%}
  36.        {% if not face.name == None %}
  37.          {{ face.name }}
  38.          {% if not loop.last %}, {% endif -%}
  39.        {% endif -%}
  40.      {%- endfor %}
  41.      {% if states.image_processing.facebox_front_door.attributes.total_faces > states.image_processing.facebox_front_door.attributes.total_matched_faces %}
  42.        + {{ states.image_processing.facebox_front_door.attributes.total_faces - states.image_processing.facebox_front_door.attributes.total_matched_faces }} unrecognised person(s)
  43.      {% endif -%}'
  44.  
  45. #cast_front_door_to_living_room_tv_if_face_detected
  46. - id: 'cast_front_door_to_living_room_tv_if_face_detected'
  47.   alias: "cast front door to living room tv if face detected"
  48.   trigger:
  49.   - entity_id: input_boolean.front_door_motion_sensor_face_detect_this_pass
  50.     from: 'off'
  51.     platform: state
  52.     to: 'on'
  53.   condition:
  54.     condition: state
  55.     entity_id: media_player.chromecast
  56.     state: 'off'
  57.   action:
  58.   - service: media_player.play_media
  59.     data_template:
  60.       entity_id:
  61.       - media_player.chromecast
  62.       media_content_id: http://192.168.1.48:8084
  63.       media_content_type: image/jpg
  64.   - wait_template: '{{ is_state(''binary_sensor.front_door_motion_sensor'', ''off'') }}'
  65.   - service: media_player.turn_off
  66.     entity_id: media_player.chromecast
  67.  
RAW Paste Data