2019-04-17 22:46:06 +00:00
|
|
|
###############################################################################
|
|
|
|
# @author : Mahasri Kalavala
|
|
|
|
# @date : 07/16/2017
|
|
|
|
# @package : Cameras
|
|
|
|
# @description : Cameras and the automations
|
|
|
|
# @Comment : USE AT YOUR RISK!!! I CAN'T GUARANTEE IF IT DOESN'T
|
|
|
|
# WORK IN YOUR ENVIRONMENT!
|
|
|
|
###############################################################################
|
|
|
|
homeassistant:
|
|
|
|
|
|
|
|
#
|
2019-08-19 00:21:05 +00:00
|
|
|
# The camera url format in secrets.yaml would look like this:
|
2019-04-17 22:46:06 +00:00
|
|
|
# frontdoor_camera_url: http://username:password@192.168.xxx.xxx/ISAPI/Streaming/channels/101/picture
|
|
|
|
#
|
|
|
|
camera:
|
|
|
|
- platform: generic
|
|
|
|
name: Frontdoor Camera
|
|
|
|
still_image_url: !secret frontdoor_camera_url
|
|
|
|
verify_ssl: false
|
|
|
|
authentication: digest
|
|
|
|
username: !secret camera_username
|
|
|
|
password: !secret camera_password
|
|
|
|
|
|
|
|
- platform: generic
|
|
|
|
name: Driveway Camera
|
|
|
|
still_image_url: !secret driveway_camera_url
|
|
|
|
verify_ssl: false
|
|
|
|
authentication: digest
|
|
|
|
username: !secret camera_username
|
|
|
|
password: !secret camera_password
|
|
|
|
|
|
|
|
- platform: generic
|
|
|
|
name: Patio Camera
|
|
|
|
still_image_url: !secret patio_camera_url
|
|
|
|
verify_ssl: false
|
|
|
|
authentication: digest
|
|
|
|
username: !secret camera_username
|
|
|
|
password: !secret camera_password
|
|
|
|
|
|
|
|
- platform: generic
|
|
|
|
name: Playarea Camera
|
|
|
|
still_image_url: !secret playarea_camera_url
|
|
|
|
verify_ssl: false
|
|
|
|
authentication: digest
|
|
|
|
username: !secret camera_username
|
|
|
|
password: !secret camera_password
|
|
|
|
|
2021-01-10 20:03:52 +00:00
|
|
|
- platform: generic
|
|
|
|
name: Porch Camera
|
|
|
|
still_image_url: !secret porch_camera_url
|
|
|
|
stream_source: porch_camera_rtsp_url
|
|
|
|
verify_ssl: false
|
|
|
|
authentication: basic
|
|
|
|
username: !secret porch_camera_username
|
|
|
|
password: !secret porch_camera_password
|
|
|
|
|
|
|
|
# - platform: ffmpeg
|
|
|
|
# input: porch_camera_rtsp_url
|
|
|
|
# name: Porch Camera
|
|
|
|
|
2019-04-17 22:46:06 +00:00
|
|
|
- platform: mjpeg
|
|
|
|
mjpeg_url: !secret garage_camera_url
|
|
|
|
name: Garage Camera
|
|
|
|
|
|
|
|
- platform: local_file
|
|
|
|
name: Frontdoor Latest Scan
|
2021-01-10 20:03:52 +00:00
|
|
|
file_path: "/config/www/downloads/camera/frontdoor/frontdoor_latest.jpg"
|
2019-04-17 22:46:06 +00:00
|
|
|
- platform: local_file
|
|
|
|
name: Driveway Latest Scan
|
2021-01-10 20:03:52 +00:00
|
|
|
file_path: "/config/www/downloads/camera/driveway/driveway_latest.jpg"
|
2019-04-17 22:46:06 +00:00
|
|
|
- platform: local_file
|
|
|
|
name: Patio Latest Scan
|
2021-01-10 20:03:52 +00:00
|
|
|
file_path: "/config/www/downloads/camera/patio/patio_latest.jpg"
|
2019-04-17 22:46:06 +00:00
|
|
|
- platform: local_file
|
|
|
|
name: Playarea Latest Scan
|
2021-01-10 20:03:52 +00:00
|
|
|
file_path: "/config/www/downloads/camera/playarea/playarea_latest.jpg"
|
2019-04-17 22:46:06 +00:00
|
|
|
- platform: local_file
|
|
|
|
name: Garage Latest Scan
|
2021-01-10 20:03:52 +00:00
|
|
|
file_path: "/config/www/downloads/camera/garage/garage_latest.jpg"
|
2020-09-13 18:44:14 +00:00
|
|
|
- platform: local_file
|
|
|
|
name: 3dPrinter Latest Scan
|
2021-01-10 20:03:52 +00:00
|
|
|
file_path: "/config/www/downloads/camera/3d/3d_latest.jpg"
|
|
|
|
- platform: local_file
|
|
|
|
name: Porch Latest Scan
|
|
|
|
file_path: "/config/www/downloads/camera/porch/porch_latest.jpg"
|
2019-04-17 22:46:06 +00:00
|
|
|
|
2021-01-10 20:03:52 +00:00
|
|
|
shell_command:
|
|
|
|
reset_camera_stream: !secret camera_stream_restart_docker_url
|
|
|
|
|
|
|
|
switch:
|
|
|
|
- platform: rest
|
|
|
|
resource: !secret camera_stream_docker_url
|
|
|
|
name: Camera Stream
|
|
|
|
body_on: '{"state": "start"}'
|
|
|
|
body_off: '{"state": "stop"}'
|
|
|
|
is_on_template: '{{ value_json is not none and value_json.state == "running" }}'
|
|
|
|
|
2019-04-17 22:46:06 +00:00
|
|
|
binary_sensor:
|
|
|
|
- platform: hikvision
|
|
|
|
name: Frontdoor Camera
|
|
|
|
ssl: false
|
|
|
|
host: !secret frontdoor_camera_ip
|
|
|
|
username: !secret camera_username
|
|
|
|
password: !secret camera_password
|
2019-08-19 00:21:05 +00:00
|
|
|
|
2019-04-17 22:46:06 +00:00
|
|
|
- platform: hikvision
|
|
|
|
name: Driveway Camera
|
|
|
|
ssl: false
|
|
|
|
host: !secret driveway_camera_ip
|
|
|
|
username: !secret camera_username
|
|
|
|
password: !secret camera_password
|
|
|
|
|
|
|
|
- platform: hikvision
|
|
|
|
name: Patio Camera
|
|
|
|
ssl: false
|
|
|
|
host: !secret patio_camera_ip
|
|
|
|
username: !secret camera_username
|
|
|
|
password: !secret camera_password
|
|
|
|
|
|
|
|
- platform: hikvision
|
|
|
|
name: Playarea Camera
|
|
|
|
ssl: false
|
|
|
|
host: !secret playarea_camera_ip
|
|
|
|
username: !secret camera_username
|
|
|
|
password: !secret camera_password
|
|
|
|
|
2021-01-10 20:03:52 +00:00
|
|
|
- platform: mqtt
|
|
|
|
state_topic: "myhome/dafang_1/motion"
|
|
|
|
name: "Porch Motion"
|
|
|
|
device_class: motion
|
|
|
|
payload_on: "ON"
|
|
|
|
payload_off: "OFF"
|
|
|
|
value_template: "{{ value }}"
|
|
|
|
|
2019-04-17 22:46:06 +00:00
|
|
|
image_processing:
|
|
|
|
- platform: tensorflow
|
|
|
|
scan_interval: 10000
|
|
|
|
source:
|
|
|
|
- entity_id: camera.frontdoor_camera
|
|
|
|
- entity_id: camera.driveway_camera
|
|
|
|
- entity_id: camera.patio_camera
|
|
|
|
- entity_id: camera.playarea_camera
|
|
|
|
- entity_id: camera.garage_camera
|
2020-09-13 18:44:14 +00:00
|
|
|
- entity_id: camera.3d_printer_camera
|
2021-01-10 20:03:52 +00:00
|
|
|
- entity_id: camera.porch_camera
|
2019-04-17 22:46:06 +00:00
|
|
|
file_out:
|
2021-01-10 20:03:52 +00:00
|
|
|
- "/config/www/downloads/camera/{{- camera_entity.split('.')[1].split('_')[0] -}}/{{ camera_entity.split('.')[1].split('_')[0] }}_latest.jpg"
|
|
|
|
- "/config/www/downloads/camera/{{- camera_entity.split('.')[1].split('_')[0] -}}/{{ camera_entity.split('.')[1].split('_')[0] }}_{{ now().strftime('%Y%m%d_%H%M%S') }}.jpg"
|
2019-04-17 22:46:06 +00:00
|
|
|
model:
|
2021-01-10 20:03:52 +00:00
|
|
|
graph: /config/tensorflow/models/efficientdet_d0_coco17_tpu-32/
|
2019-04-17 22:46:06 +00:00
|
|
|
|
|
|
|
input_label:
|
|
|
|
current_stream:
|
|
|
|
name: Current Stream
|
|
|
|
|
|
|
|
# frontdoor_camera_text_overlay_url: http://192.168.xxx.xxx/Video/inputs/channels/1/overlays/text/1
|
|
|
|
rest_command:
|
2019-05-18 20:06:14 +00:00
|
|
|
set_frontdoor_camera_text_left_bottom:
|
2019-04-17 22:46:06 +00:00
|
|
|
url: !secret frontdoor_camera_text_overlay_url
|
|
|
|
username: !secret camera_username
|
|
|
|
password: !secret camera_password
|
|
|
|
method: PUT
|
2019-08-19 00:21:05 +00:00
|
|
|
content_type: "text/xml"
|
2019-04-17 22:46:06 +00:00
|
|
|
payload: >-
|
|
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
|
|
<TextOverlay version="1.0" xmlns="http://www.hikvision.com/ver10/XMLSchema">
|
|
|
|
<id>1</id><enabled>true</enabled>
|
|
|
|
<posX>45</posX><posY>520</posY>
|
|
|
|
<message>{{ message }} </message>
|
|
|
|
</TextOverlay>
|
|
|
|
|
2019-05-18 20:06:14 +00:00
|
|
|
set_driveway_camera_text_left_bottom:
|
|
|
|
url: !secret driveway_camera_text_overlay_url
|
|
|
|
username: !secret camera_username
|
|
|
|
password: !secret camera_password
|
|
|
|
method: PUT
|
2019-08-19 00:21:05 +00:00
|
|
|
content_type: "text/xml"
|
2019-05-18 20:06:14 +00:00
|
|
|
payload: >-
|
|
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
|
|
<TextOverlay version="1.0" xmlns="http://www.hikvision.com/ver10/XMLSchema">
|
|
|
|
<id>1</id><enabled>true</enabled>
|
|
|
|
<posX>45</posX><posY>520</posY>
|
|
|
|
<message>{{ message }} </message>
|
|
|
|
</TextOverlay>
|
|
|
|
|
|
|
|
set_patio_camera_text_left_bottom:
|
|
|
|
url: !secret patio_camera_text_overlay_url
|
|
|
|
username: !secret camera_username
|
|
|
|
password: !secret camera_password
|
|
|
|
method: PUT
|
2019-08-19 00:21:05 +00:00
|
|
|
content_type: "text/xml"
|
2019-05-18 20:06:14 +00:00
|
|
|
payload: >-
|
|
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
|
|
<TextOverlay version="1.0" xmlns="http://www.hikvision.com/ver10/XMLSchema">
|
|
|
|
<id>1</id><enabled>true</enabled>
|
|
|
|
<posX>45</posX><posY>520</posY>
|
|
|
|
<message>{{ message }} </message>
|
|
|
|
</TextOverlay>
|
|
|
|
|
|
|
|
set_playarea_camera_text_left_bottom:
|
|
|
|
url: !secret playarea_camera_text_overlay_url
|
|
|
|
username: !secret camera_username
|
|
|
|
password: !secret camera_password
|
|
|
|
method: PUT
|
2019-08-19 00:21:05 +00:00
|
|
|
content_type: "text/xml"
|
2019-05-18 20:06:14 +00:00
|
|
|
payload: >-
|
|
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
|
|
<TextOverlay version="1.0" xmlns="http://www.hikvision.com/ver10/XMLSchema">
|
|
|
|
<id>1</id><enabled>true</enabled>
|
|
|
|
<posX>45</posX><posY>520</posY>
|
|
|
|
<message>{{ message }} </message>
|
|
|
|
</TextOverlay>
|
|
|
|
|
2019-04-17 22:46:06 +00:00
|
|
|
###############################################################################
|
2019-08-19 00:21:05 +00:00
|
|
|
# _ _ _
|
|
|
|
# /\ | | | | (_)
|
|
|
|
# / \ _ _| |_ ___ _ __ ___ __ _| |_ _ ___ _ __ ___
|
2019-04-17 22:46:06 +00:00
|
|
|
# / /\ \| | | | __/ _ \| '_ ` _ \ / _` | __| |/ _ \| '_ \/ __|
|
|
|
|
# / ____ \ |_| | || (_) | | | | | | (_| | |_| | (_) | | | \__ \
|
|
|
|
# /_/ \_\__,_|\__\___/|_| |_| |_|\__,_|\__|_|\___/|_| |_|___/
|
2019-08-19 00:21:05 +00:00
|
|
|
#
|
2019-04-17 22:46:06 +00:00
|
|
|
###############################################################################
|
|
|
|
|
|
|
|
automation:
|
2021-01-10 20:03:52 +00:00
|
|
|
|
|
|
|
- alias: Scan Porch Camera On Motion
|
|
|
|
initial_state: true
|
|
|
|
trigger:
|
|
|
|
- platform: state
|
|
|
|
entity_id: binary_sensor.porch_motion
|
|
|
|
from: "off"
|
|
|
|
to: "on"
|
|
|
|
action:
|
|
|
|
- service: camera.snapshot
|
|
|
|
data_template:
|
|
|
|
entity_id: "camera.porch_camera"
|
|
|
|
filename:
|
|
|
|
"{{ '/config/www/downloads/camera/porch/porch_' ~
|
|
|
|
(states.binary_sensor.porch_motion.last_updated ~ '').replace('-','_')
|
|
|
|
.replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg' }}"
|
|
|
|
- service: image_processing.scan
|
|
|
|
data_template:
|
|
|
|
entity_id: image_processing.tensorflow_porch_camera
|
|
|
|
|
2019-08-19 00:21:05 +00:00
|
|
|
#
|
|
|
|
# Scan front door and driveway cameras when motion detected
|
|
|
|
# if the garage doors are open, scan garage cameras as well
|
|
|
|
#
|
2019-04-17 22:46:06 +00:00
|
|
|
- alias: Scan Frontdoor Camera On Motion
|
|
|
|
initial_state: true
|
|
|
|
trigger:
|
2019-08-19 00:21:05 +00:00
|
|
|
- platform: state
|
|
|
|
entity_id:
|
|
|
|
- binary_sensor.motion_sensor_158d00024ee084
|
|
|
|
to: "on"
|
2019-04-17 22:46:06 +00:00
|
|
|
action:
|
2019-07-09 23:30:44 +00:00
|
|
|
- condition: template
|
|
|
|
value_template: "{{ states('input_boolean.notify_camera_alerts') == 'on' }}"
|
2020-09-30 02:36:02 +00:00
|
|
|
- service: script.frontdoor_cam # change to front door camera stream on chromecast
|
2019-04-17 22:46:06 +00:00
|
|
|
- condition: template
|
2020-02-05 23:28:38 +00:00
|
|
|
value_template: "{{ states('alarm_control_panel.home') == 'armed_home' or states('alarm_control_panel.home') == 'armed_away' }}"
|
2019-04-17 22:46:06 +00:00
|
|
|
- service: image_processing.scan
|
|
|
|
data_template:
|
|
|
|
entity_id: image_processing.tensorflow_frontdoor_camera
|
|
|
|
- service: image_processing.scan
|
|
|
|
data_template:
|
|
|
|
entity_id: image_processing.tensorflow_driveway_camera
|
|
|
|
- condition: template
|
|
|
|
value_template: >-
|
|
|
|
{% if state_attr('image_processing.tensorflow_frontdoor_camera', 'summary') != None %}
|
|
|
|
{% if state_attr('image_processing.tensorflow_frontdoor_camera', 'summary') |count > 0 %}
|
|
|
|
true
|
|
|
|
{% else %}
|
|
|
|
false
|
|
|
|
{% endif %}
|
|
|
|
{% else %}
|
|
|
|
false
|
|
|
|
{% endif %}
|
2020-09-30 02:36:02 +00:00
|
|
|
|
2019-04-17 22:46:06 +00:00
|
|
|
- service: script.voice_notify
|
|
|
|
data_template:
|
|
|
|
message: >-
|
|
|
|
{%- set e_id = "image_processing.tensorflow_frontdoor_camera" -%}
|
|
|
|
{%- if state_attr(e_id, 'summary') -%}
|
|
|
|
{%- set count = state_attr(e_id, 'summary') | count -%}
|
|
|
|
{%- for x in state_attr(e_id, 'summary') | list -%}
|
|
|
|
{%- if loop.first %}{% elif loop.last %}, and {% else %}, {% endif -%}
|
|
|
|
{{- state_attr(e_id, 'summary')[x]}} {{ x ~ 's' if state_attr(e_id, 'summary')[x] > 1 else x }}
|
|
|
|
{%- endfor -%}
|
|
|
|
{{ " detected in the front yard." }}
|
|
|
|
{%- endif -%}
|
2019-08-19 00:21:05 +00:00
|
|
|
greeting: "no"
|
2020-09-30 02:36:02 +00:00
|
|
|
|
2019-04-17 22:46:06 +00:00
|
|
|
- service: notify.notify_smtp
|
|
|
|
data_template:
|
|
|
|
title: 'Front door motion {{ now().strftime("%d %h %Y, %I:%M:%S %p") }}'
|
2019-05-14 23:32:32 +00:00
|
|
|
message: >
|
|
|
|
{%- set e_id = "image_processing.tensorflow_frontdoor_camera" -%}
|
|
|
|
{%- if state_attr(e_id, 'summary') -%}
|
|
|
|
{%- set count = state_attr(e_id, 'summary') | count -%}
|
|
|
|
{%- for x in state_attr(e_id, 'summary') | list -%}
|
|
|
|
{%- if loop.first %}{% elif loop.last %}, and {% else %}, {% endif -%}
|
|
|
|
{{- state_attr(e_id, 'summary')[x]}} {{ x ~ 's' if state_attr(e_id, 'summary')[x] > 1 else x }}
|
|
|
|
{%- endfor -%}
|
|
|
|
{{ " detected in the front yard on " ~ now().strftime("%d %h %Y, at %I:%M:%S %p") ~ ". Please see the images below." }}
|
|
|
|
{% else %}
|
2020-09-30 02:36:02 +00:00
|
|
|
Motion detected at the front door on {{ now().strftime("%d %h %Y, at %I:%M:%S %p") }}. Please see the images below.
|
2019-05-14 23:32:32 +00:00
|
|
|
{%- endif -%}
|
2019-04-17 22:46:06 +00:00
|
|
|
data:
|
|
|
|
images:
|
2021-01-10 20:03:52 +00:00
|
|
|
- "/config/www/downloads/camera/frontdoor/frontdoor_latest.jpg"
|
2020-09-30 02:36:02 +00:00
|
|
|
|
|
|
|
- service: script.notify_me_with_picture
|
|
|
|
data_template:
|
|
|
|
title: "Front Door Motion"
|
|
|
|
message: >
|
|
|
|
{%- set e_id = "image_processing.tensorflow_frontdoor_camera" -%}
|
|
|
|
{%- if state_attr(e_id, 'summary') -%}
|
|
|
|
{%- set count = state_attr(e_id, 'summary') | count -%}
|
|
|
|
{%- for x in state_attr(e_id, 'summary') | list -%}
|
|
|
|
{%- if loop.first %}{% elif loop.last %}, and {% else %}, {% endif -%}
|
|
|
|
{{- state_attr(e_id, 'summary')[x]}} {{ x ~ 's' if state_attr(e_id, 'summary')[x] > 1 else x }}
|
|
|
|
{%- endfor -%}
|
|
|
|
{{ " detected in the front yard on " ~ now().strftime("%d %h %Y, at %I:%M:%S %p") ~ ". Please see the images below." }}
|
|
|
|
{% else %}
|
|
|
|
Motion detected at the front door on {{ now().strftime("%d %h %Y, at %I:%M:%S %p") }}. Please see the images below.
|
|
|
|
{%- endif %}
|
2021-01-10 20:03:52 +00:00
|
|
|
file: "/config/www/downloads/camera/frontdoor/frontdoor_latest.jpg"
|
2020-09-30 02:36:02 +00:00
|
|
|
caption: "Front Door Motion"
|
|
|
|
|
2019-04-17 22:46:06 +00:00
|
|
|
- condition: template
|
|
|
|
value_template: >
|
2020-09-28 01:29:23 +00:00
|
|
|
{% if states('binary_sensor.door_window_sensor_158d0004248d5b') == "on" or
|
|
|
|
states('binary_sensor.door_window_sensor_158d0004231f7b') == "on" %}
|
2019-04-17 22:46:06 +00:00
|
|
|
True
|
|
|
|
{% else %}
|
|
|
|
False
|
|
|
|
{% endif %}
|
|
|
|
- service: image_processing.scan
|
|
|
|
data_template:
|
|
|
|
entity_id: image_processing.tensorflow_garage_camera
|
2019-08-19 00:21:05 +00:00
|
|
|
#
|
|
|
|
# Scan driveway and frontdoor cameras when motion detected
|
|
|
|
# if the garage doors are open, scan garage cameras as well
|
|
|
|
#
|
2019-04-17 22:46:06 +00:00
|
|
|
- alias: Scan Driveway Camera When Motion
|
|
|
|
initial_state: true
|
|
|
|
trigger:
|
2019-08-19 00:21:05 +00:00
|
|
|
- platform: state
|
|
|
|
entity_id:
|
|
|
|
- binary_sensor.motion_sensor_158d00024e57fb
|
|
|
|
to: "on"
|
2019-04-17 22:46:06 +00:00
|
|
|
action:
|
2019-07-09 23:30:44 +00:00
|
|
|
- condition: template
|
|
|
|
value_template: "{{ states('input_boolean.notify_camera_alerts') == 'on' }}"
|
2019-04-17 22:46:06 +00:00
|
|
|
- service: script.stream2chromecast
|
|
|
|
data_template:
|
|
|
|
url: !secret driveway_camera_stream_url
|
2019-08-19 00:21:05 +00:00
|
|
|
name: "driveway"
|
2019-04-17 22:46:06 +00:00
|
|
|
- condition: template
|
2020-02-05 23:28:38 +00:00
|
|
|
value_template: "{{ states('alarm_control_panel.home') == 'armed_home' or states('alarm_control_panel.home') == 'armed_away' }}"
|
2019-04-17 22:46:06 +00:00
|
|
|
- service: image_processing.scan
|
|
|
|
data_template:
|
|
|
|
entity_id: image_processing.tensorflow_driveway_camera
|
|
|
|
- service: image_processing.scan
|
|
|
|
data_template:
|
|
|
|
entity_id: image_processing.tensorflow_frontdoor_camera
|
|
|
|
- condition: template
|
|
|
|
value_template: >-
|
|
|
|
{% if state_attr('image_processing.tensorflow_driveway_camera', 'summary') != None %}
|
|
|
|
{% if state_attr('image_processing.tensorflow_driveway_camera', 'summary') |count > 0 %}
|
|
|
|
true
|
|
|
|
{% else %}
|
|
|
|
false
|
|
|
|
{% endif %}
|
|
|
|
{% else %}
|
|
|
|
false
|
|
|
|
{% endif %}
|
2020-09-30 02:36:02 +00:00
|
|
|
|
2019-04-17 22:46:06 +00:00
|
|
|
- service: script.voice_notify
|
|
|
|
data_template:
|
|
|
|
message: >-
|
|
|
|
{%- set e_id = "image_processing.tensorflow_driveway_camera" -%}
|
|
|
|
{%- if state_attr(e_id, 'summary') -%}
|
|
|
|
{%- set count = state_attr(e_id, 'summary') | count -%}
|
|
|
|
{%- for x in state_attr(e_id, 'summary') | list -%}
|
|
|
|
{%- if loop.first %}{% elif loop.last %}, and {% else %}, {% endif -%}
|
|
|
|
{{- state_attr(e_id, 'summary')[x]}} {{ x ~ 's' if state_attr(e_id, 'summary')[x] > 1 else x }}
|
|
|
|
{%- endfor -%}
|
|
|
|
{{ " detected in the driveway" }}
|
|
|
|
{%- endif -%}
|
2020-09-30 02:36:02 +00:00
|
|
|
|
|
|
|
- service: script.notify_me_with_picture
|
|
|
|
data_template:
|
|
|
|
title: "Driveway Motion"
|
|
|
|
message: >
|
|
|
|
{%- set e_id = "image_processing.tensorflow_driveway_camera" -%}
|
|
|
|
{%- if state_attr(e_id, 'summary') -%}
|
|
|
|
{%- set count = state_attr(e_id, 'summary') | count -%}
|
|
|
|
{%- for x in state_attr(e_id, 'summary') | list -%}
|
|
|
|
{%- if loop.first %}{% elif loop.last %}, and {% else %}, {% endif -%}
|
|
|
|
{{- state_attr(e_id, 'summary')[x]}} {{ x ~ 's' if state_attr(e_id, 'summary')[x] > 1 else x }}
|
|
|
|
{%- endfor -%}
|
|
|
|
{{ " detected in the driveway on " ~ now().strftime("%d %h %Y, at %I:%M:%S %p") ~ ". Please see the images below." }}
|
|
|
|
{% else %}
|
|
|
|
Motion detected at the driveway on {{ now().strftime("%d %h %Y, at %I:%M:%S %p") }}. Please see the images below.
|
|
|
|
{%- endif -%}
|
2021-01-10 20:03:52 +00:00
|
|
|
file: "/config/www/downloads/camera/driveway/driveway_latest.jpg"
|
2020-09-30 02:36:02 +00:00
|
|
|
caption: "Driveway Motion"
|
|
|
|
|
2019-04-17 22:46:06 +00:00
|
|
|
- service: notify.notify_smtp
|
|
|
|
data_template:
|
|
|
|
title: 'Driveway motion {{ now().strftime("%d %h %Y, %I:%M:%S %p") }}'
|
2019-05-14 23:32:32 +00:00
|
|
|
message: >
|
|
|
|
{%- set e_id = "image_processing.tensorflow_driveway_camera" -%}
|
|
|
|
{%- if state_attr(e_id, 'summary') -%}
|
|
|
|
{%- set count = state_attr(e_id, 'summary') | count -%}
|
|
|
|
{%- for x in state_attr(e_id, 'summary') | list -%}
|
|
|
|
{%- if loop.first %}{% elif loop.last %}, and {% else %}, {% endif -%}
|
|
|
|
{{- state_attr(e_id, 'summary')[x]}} {{ x ~ 's' if state_attr(e_id, 'summary')[x] > 1 else x }}
|
|
|
|
{%- endfor -%}
|
|
|
|
{{ " detected in the driveway on " ~ now().strftime("%d %h %Y, at %I:%M:%S %p") ~ ". Please see the images below." }}
|
|
|
|
{% else %}
|
|
|
|
Motion detected at the driveway on {{ now().strftime("%d %h %Y, at %I:%M:%S %p") }}. Please see the images below.
|
|
|
|
{%- endif -%}
|
2019-04-17 22:46:06 +00:00
|
|
|
data:
|
|
|
|
images:
|
2021-01-10 20:03:52 +00:00
|
|
|
- "/config/www/downloads/camera/driveway/driveway_latest.jpg"
|
2020-09-30 02:36:02 +00:00
|
|
|
|
2019-04-17 22:46:06 +00:00
|
|
|
- condition: template
|
|
|
|
value_template: >
|
2020-09-28 01:29:23 +00:00
|
|
|
{% if states('binary_sensor.door_window_sensor_158d0004248d5b') == "on" or
|
|
|
|
states('binary_sensor.door_window_sensor_158d0004231f7b') == "on" %}
|
2019-04-17 22:46:06 +00:00
|
|
|
True
|
|
|
|
{% else %}
|
|
|
|
False
|
|
|
|
{% endif %}
|
2020-09-30 02:36:02 +00:00
|
|
|
|
2019-04-17 22:46:06 +00:00
|
|
|
- service: image_processing.scan
|
|
|
|
data_template:
|
|
|
|
entity_id: image_processing.tensorflow_garage_camera
|
|
|
|
|
2019-08-19 00:21:05 +00:00
|
|
|
#
|
|
|
|
# When motion detected in garage, scan garage camera
|
|
|
|
# If any of the garage doors are open, scan front door, driveway as well!
|
|
|
|
#
|
2019-04-17 22:46:06 +00:00
|
|
|
- alias: Scan Garage Camera When Motion
|
|
|
|
initial_state: true
|
|
|
|
trigger:
|
2019-08-19 00:21:05 +00:00
|
|
|
- platform: state
|
|
|
|
entity_id:
|
|
|
|
- binary_sensor.motion_sensor_158d000272bf48
|
|
|
|
to: "on"
|
2019-04-17 22:46:06 +00:00
|
|
|
condition:
|
|
|
|
- condition: template
|
|
|
|
value_template: "{{ states('input_boolean.notify_camera_alerts') == 'on' }}"
|
|
|
|
- condition: template
|
2020-02-05 23:28:38 +00:00
|
|
|
value_template: "{{ states('alarm_control_panel.home') == 'armed_home' or states('alarm_control_panel.home') == 'armed_away' }}"
|
2019-04-17 22:46:06 +00:00
|
|
|
action:
|
|
|
|
- service: image_processing.scan
|
|
|
|
data_template:
|
|
|
|
entity_id: image_processing.tensorflow_garage_camera
|
|
|
|
- condition: template
|
|
|
|
value_template: >
|
2020-09-28 01:29:23 +00:00
|
|
|
{% if states('binary_sensor.door_window_sensor_158d0004248d5b') == "on" or
|
|
|
|
states('binary_sensor.door_window_sensor_158d0004231f7b') == "on" %}
|
2019-04-17 22:46:06 +00:00
|
|
|
True
|
|
|
|
{% else %}
|
|
|
|
False
|
|
|
|
{% endif %}
|
|
|
|
- service: image_processing.scan
|
|
|
|
data_template:
|
|
|
|
entity_id: image_processing.tensorflow_driveway_camera
|
|
|
|
- service: image_processing.scan
|
|
|
|
data_template:
|
|
|
|
entity_id: image_processing.tensorflow_frontdoor_camera
|
|
|
|
- condition: template
|
|
|
|
value_template: >-
|
|
|
|
{% if state_attr('image_processing.tensorflow_garage_camera', 'summary') != None %}
|
|
|
|
{% if state_attr('image_processing.tensorflow_garage_camera', 'summary') |count > 0 %}
|
|
|
|
true
|
|
|
|
{% else %}
|
|
|
|
false
|
|
|
|
{% endif %}
|
|
|
|
{% else %}
|
|
|
|
false
|
2019-08-19 00:21:05 +00:00
|
|
|
{% endif %}
|
2020-09-30 02:36:02 +00:00
|
|
|
|
2019-04-17 22:46:06 +00:00
|
|
|
- service: script.voice_notify
|
|
|
|
data_template:
|
|
|
|
message: >-
|
|
|
|
{%- set e_id = "image_processing.tensorflow_garage_camera" -%}
|
|
|
|
{%- if state_attr(e_id, 'summary') -%}
|
|
|
|
{%- set count = state_attr(e_id, 'summary') | count -%}
|
|
|
|
{%- for x in state_attr(e_id, 'summary') | list -%}
|
|
|
|
{%- if loop.first %}{% elif loop.last %}, and {% else %}, {% endif -%}
|
|
|
|
{{- state_attr(e_id, 'summary')[x]}} {{ x ~ 's' if state_attr(e_id, 'summary')[x] > 1 else x }}
|
|
|
|
{%- endfor -%}
|
|
|
|
{{ " detected in the garage." }}
|
|
|
|
{%- endif -%}
|
2020-09-30 02:36:02 +00:00
|
|
|
|
|
|
|
- service: script.notify_me_with_picture
|
|
|
|
data_template:
|
|
|
|
title: "Garage Motion"
|
|
|
|
message: >
|
|
|
|
{%- set e_id = "image_processing.tensorflow_garage_camera" -%}
|
|
|
|
{%- if state_attr(e_id, 'summary') -%}
|
|
|
|
{%- set count = state_attr(e_id, 'summary') | count -%}
|
|
|
|
{%- for x in state_attr(e_id, 'summary') | list -%}
|
|
|
|
{%- if loop.first %}{% elif loop.last %}, and {% else %}, {% endif -%}
|
|
|
|
{{- state_attr(e_id, 'summary')[x]}} {{ x ~ 's' if state_attr(e_id, 'summary')[x] > 1 else x }}
|
|
|
|
{%- endfor -%}
|
|
|
|
{{ " detected in the garage on " ~ now().strftime("%d %h %Y, at %I:%M:%S %p") ~ ". Please see the images below." }}
|
|
|
|
{% else %}
|
|
|
|
Motion detected in the garage on {{ now().strftime("%d %h %Y, at %I:%M:%S %p") }}. Please see the images below.
|
|
|
|
{%- endif -%}
|
2021-01-10 20:03:52 +00:00
|
|
|
file: "/config/www/downloads/camera/garage/garage_latest.jpg"
|
2020-09-30 02:36:02 +00:00
|
|
|
caption: "Garage Motion"
|
|
|
|
|
2019-04-17 22:46:06 +00:00
|
|
|
- service: notify.notify_smtp
|
|
|
|
data_template:
|
|
|
|
title: 'Garage motion {{ now().strftime("%d %h %Y, %I:%M:%S %p") }}'
|
2019-05-14 23:32:32 +00:00
|
|
|
message: >
|
|
|
|
{%- set e_id = "image_processing.tensorflow_garage_camera" -%}
|
|
|
|
{%- if state_attr(e_id, 'summary') -%}
|
|
|
|
{%- set count = state_attr(e_id, 'summary') | count -%}
|
|
|
|
{%- for x in state_attr(e_id, 'summary') | list -%}
|
|
|
|
{%- if loop.first %}{% elif loop.last %}, and {% else %}, {% endif -%}
|
|
|
|
{{- state_attr(e_id, 'summary')[x]}} {{ x ~ 's' if state_attr(e_id, 'summary')[x] > 1 else x }}
|
|
|
|
{%- endfor -%}
|
|
|
|
{{ " detected in the garage on " ~ now().strftime("%d %h %Y, at %I:%M:%S %p") ~ ". Please see the images below." }}
|
|
|
|
{% else %}
|
|
|
|
Motion detected in the garage on {{ now().strftime("%d %h %Y, at %I:%M:%S %p") }}. Please see the images below.
|
|
|
|
{%- endif -%}
|
2019-04-17 22:46:06 +00:00
|
|
|
data:
|
|
|
|
images:
|
2021-01-10 20:03:52 +00:00
|
|
|
- "/config/www/downloads/camera/garage/garage_latest.jpg"
|
2019-08-19 00:21:05 +00:00
|
|
|
#
|
|
|
|
# When motion detected in the backyard, scan both cameras
|
|
|
|
#
|
2019-04-17 22:46:06 +00:00
|
|
|
- alias: Scan Backyard Camera When Motion
|
|
|
|
initial_state: true
|
|
|
|
trigger:
|
2019-08-19 00:21:05 +00:00
|
|
|
- platform: state
|
|
|
|
entity_id:
|
|
|
|
- binary_sensor.motion_sensor_158d00024e842c
|
|
|
|
to: "on"
|
2019-07-09 23:30:44 +00:00
|
|
|
action:
|
2019-04-17 22:46:06 +00:00
|
|
|
- condition: template
|
|
|
|
value_template: "{{ states('input_boolean.notify_camera_alerts') == 'on' }}"
|
|
|
|
- service: script.stream2chromecast
|
|
|
|
data_template:
|
|
|
|
url: !secret playarea_camera_stream_url
|
2019-08-19 00:21:05 +00:00
|
|
|
name: "backyard"
|
2019-04-17 22:46:06 +00:00
|
|
|
- condition: template
|
2020-02-05 23:28:38 +00:00
|
|
|
value_template: "{{ states('alarm_control_panel.home') == 'armed_home' or states('alarm_control_panel.home') == 'armed_away' }}"
|
2019-04-17 22:46:06 +00:00
|
|
|
- service: image_processing.scan
|
|
|
|
data_template:
|
|
|
|
entity_id: image_processing.tensorflow_patio_camera
|
|
|
|
- service: image_processing.scan
|
|
|
|
data_template:
|
|
|
|
entity_id: image_processing.tensorflow_playarea_camera
|
|
|
|
- condition: template
|
|
|
|
value_template: >-
|
|
|
|
{% if state_attr('image_processing.tensorflow_patio_camera', 'summary') != None %}
|
|
|
|
{% if state_attr('image_processing.tensorflow_patio_camera', 'summary') |count > 0 %}
|
|
|
|
true
|
|
|
|
{% else %}
|
|
|
|
false
|
|
|
|
{% endif %}
|
|
|
|
{% else %}
|
|
|
|
false
|
|
|
|
{% endif %}
|
2020-09-30 02:36:02 +00:00
|
|
|
|
2019-04-17 22:46:06 +00:00
|
|
|
- service: script.voice_notify
|
|
|
|
data_template:
|
|
|
|
message: >-
|
|
|
|
{%- set e_id = "image_processing.tensorflow_patio_camera" -%}
|
|
|
|
{%- if state_attr(e_id, 'summary') -%}
|
|
|
|
{%- set count = state_attr(e_id, 'summary') | count -%}
|
|
|
|
{%- for x in state_attr(e_id, 'summary') | list -%}
|
|
|
|
{%- if loop.first %}{% elif loop.last %}, and {% else %}, {% endif -%}
|
|
|
|
{{- state_attr(e_id, 'summary')[x]}} {{ x ~ 's' if state_attr(e_id, 'summary')[x] > 1 else x }}
|
|
|
|
{%- endfor -%}
|
|
|
|
{{ " detected in the backyard." }}
|
|
|
|
{%- endif -%}
|
2020-09-30 02:36:02 +00:00
|
|
|
|
|
|
|
- service: script.notify_me_with_picture
|
|
|
|
data_template:
|
|
|
|
title: "Backyardge Motion"
|
|
|
|
message: >
|
|
|
|
{%- set e_id = "image_processing.tensorflow_patio_camera" -%}
|
|
|
|
{%- if state_attr(e_id, 'summary') -%}
|
|
|
|
{%- set count = state_attr(e_id, 'summary') | count -%}
|
|
|
|
{%- for x in state_attr(e_id, 'summary') | list -%}
|
|
|
|
{%- if loop.first %}{% elif loop.last %}, and {% else %}, {% endif -%}
|
|
|
|
{{- state_attr(e_id, 'summary')[x]}} {{ x ~ 's' if state_attr(e_id, 'summary')[x] > 1 else x }}
|
|
|
|
{%- endfor -%}
|
|
|
|
{{ " detected in the backyard on " ~ now().strftime("%d %h %Y, at %I:%M:%S %p") ~ ". Please see the images below." }}
|
|
|
|
{% else %}
|
|
|
|
Motion detected in the backyard on {{ now().strftime("%d %h %Y, at %I:%M:%S %p") }}. Please see the images below.
|
|
|
|
{%- endif -%}
|
2021-01-10 20:03:52 +00:00
|
|
|
file: "/config/www/downloads/camera/patio/patio_latest.jpg"
|
2020-09-30 02:36:02 +00:00
|
|
|
caption: "Backyard Motion"
|
|
|
|
|
2019-04-17 22:46:06 +00:00
|
|
|
- service: notify.notify_smtp
|
|
|
|
data_template:
|
|
|
|
title: 'Backyard motion {{ now().strftime("%d %h %Y, %I:%M:%S %p") }}'
|
2019-05-14 23:32:32 +00:00
|
|
|
message: >
|
|
|
|
{%- set e_id = "image_processing.tensorflow_patio_camera" -%}
|
|
|
|
{%- if state_attr(e_id, 'summary') -%}
|
|
|
|
{%- set count = state_attr(e_id, 'summary') | count -%}
|
|
|
|
{%- for x in state_attr(e_id, 'summary') | list -%}
|
|
|
|
{%- if loop.first %}{% elif loop.last %}, and {% else %}, {% endif -%}
|
|
|
|
{{- state_attr(e_id, 'summary')[x]}} {{ x ~ 's' if state_attr(e_id, 'summary')[x] > 1 else x }}
|
|
|
|
{%- endfor -%}
|
|
|
|
{{ " detected in the backyard on " ~ now().strftime("%d %h %Y, at %I:%M:%S %p") ~ ". Please see the images below." }}
|
|
|
|
{% else %}
|
|
|
|
Motion detected in the backyard on {{ now().strftime("%d %h %Y, at %I:%M:%S %p") }}. Please see the images below.
|
|
|
|
{%- endif -%}
|
2019-04-17 22:46:06 +00:00
|
|
|
data:
|
|
|
|
images:
|
2021-01-10 20:03:52 +00:00
|
|
|
- "/config/www/downloads/camera/patio/patio_latest.jpg"
|
|
|
|
- "/config/www/downloads/camera/playarea/playarea_latest.jpg"
|
2019-04-17 22:46:06 +00:00
|
|
|
|
2019-08-19 00:21:05 +00:00
|
|
|
# Before you think this code is crazy, here is an explanation.
|
|
|
|
#
|
|
|
|
# I have a xiaomi aqara PIR motion sensor near the front door, and
|
|
|
|
# when it triggers, I capture photo from the camera, save it locally
|
|
|
|
# using last_triggered date and time as filename... then send that
|
|
|
|
# image to my email as an attacment.
|
|
|
|
#
|
|
|
|
# In the action, I have multiple services I am calling, and one service
|
|
|
|
# creates file, and I needed that file name in the second service.
|
|
|
|
# Since passing variables/info between the services within an action,
|
|
|
|
# is not possible, I generate the file name based on the automation's
|
|
|
|
# last_triggered date. Since that info is same across all the services
|
|
|
|
# within the automation, I now can access/use the same file name everywhere!
|
|
|
|
#
|
|
|
|
# I only send iOS notifications when I am home, as my HA is not exposed to
|
|
|
|
# Internet, & I can't see my camera unless I login to my vpn on my device.
|
|
|
|
# That's why you see the condition right above iOS notification service.
|
|
|
|
#
|
|
|
|
# Make sure you add the path to white_list in the configuration.yaml file.
|
|
|
|
# If front door is open, wait for a couple of seconds, before taking pic!
|
|
|
|
#
|
|
|
|
|
|
|
|
# I could have combined all the 3 automations into one, but if all the motion
|
|
|
|
# sensors are triggered at the same time, the automation would only fire once,
|
|
|
|
# and the code gets ugly big and unmanageable. 3 simple automations is better!
|
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
# ______ _ _
|
|
|
|
# | ____| | | | |
|
|
|
|
# | |__ _ __ ___ _ __ | |_ __| | ___ ___ _ __
|
|
|
|
# | __| '__/ _ \| '_ \| __/ _` |/ _ \ / _ \| '__|
|
|
|
|
# | | | | | (_) | | | | || (_| | (_) | (_) | |
|
|
|
|
# |_| |_| \___/|_| |_|\__\__,_|\___/ \___/|_|
|
2019-04-17 22:46:06 +00:00
|
|
|
|
|
|
|
- alias: Notify Frontdoor Camera Snapshots
|
|
|
|
initial_state: true
|
|
|
|
trigger:
|
|
|
|
platform: state
|
|
|
|
entity_id: binary_sensor.motion_sensor_158d00024ee084
|
2019-08-19 00:21:05 +00:00
|
|
|
to: "on"
|
2019-04-17 22:46:06 +00:00
|
|
|
condition:
|
|
|
|
- condition: template
|
|
|
|
value_template: "{{ states('input_boolean.notify_camera_alerts') == 'on' }}"
|
|
|
|
- condition: template
|
2020-02-05 23:28:38 +00:00
|
|
|
value_template: "{{ states('alarm_control_panel.home') == 'armed_home' or states('alarm_control_panel.home') == 'armed_away' }}"
|
2019-04-17 22:46:06 +00:00
|
|
|
action:
|
2020-09-28 01:29:23 +00:00
|
|
|
- delay: "{{ '00:00:08' if states('binary_sensor.door_window_sensor_158d000424a6d6') == 'on' else '0:0:0' }}"
|
2019-04-17 22:46:06 +00:00
|
|
|
- service: camera.snapshot
|
|
|
|
data_template:
|
|
|
|
entity_id: "camera.frontdoor_camera"
|
2019-08-19 00:21:05 +00:00
|
|
|
filename:
|
2021-01-10 20:03:52 +00:00
|
|
|
"{{ '/config/www/downloads/camera/frontdoor/frontdoor_' ~
|
|
|
|
(states.binary_sensor.motion_sensor_158d00024ee084.last_updated ~ '').replace('-','_')
|
|
|
|
.replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg' }}"
|
|
|
|
- service: camera.snapshot
|
|
|
|
data_template:
|
|
|
|
entity_id: "camera.porch_camera"
|
|
|
|
filename:
|
|
|
|
"{{ '/config/www/downloads/camera/porch/porch_' ~
|
2019-08-19 00:21:05 +00:00
|
|
|
(states.binary_sensor.motion_sensor_158d00024ee084.last_updated ~ '').replace('-','_')
|
|
|
|
.replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg' }}"
|
2019-04-17 22:46:06 +00:00
|
|
|
- service: camera.snapshot
|
|
|
|
data_template:
|
|
|
|
entity_id: "camera.driveway_camera"
|
2019-08-19 00:21:05 +00:00
|
|
|
filename:
|
2021-01-10 20:03:52 +00:00
|
|
|
"{{ '/config/www/downloads/camera/driveway/driveway_' ~
|
2019-08-19 00:21:05 +00:00
|
|
|
(states.binary_sensor.motion_sensor_158d00024ee084.last_updated ~ '').replace('-','_')
|
|
|
|
.replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg' }}"
|
2019-04-17 22:46:06 +00:00
|
|
|
- service: camera.snapshot
|
|
|
|
data_template:
|
|
|
|
entity_id: "camera.garage_camera"
|
2019-08-19 00:21:05 +00:00
|
|
|
filename:
|
2021-01-10 20:03:52 +00:00
|
|
|
"{{ '/config/www/downloads/camera/garage/garage_' ~
|
2019-08-19 00:21:05 +00:00
|
|
|
(states.binary_sensor.motion_sensor_158d00024ee084.last_updated ~ '').replace('-','_')
|
|
|
|
.replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg' }}"
|
2020-09-30 02:36:02 +00:00
|
|
|
|
|
|
|
- service: notify.telegram
|
|
|
|
data_template:
|
|
|
|
title: "Front Door Motion"
|
|
|
|
message: "Motion Detected At Front Door, Check images:"
|
|
|
|
data:
|
|
|
|
photo:
|
2021-01-10 20:03:52 +00:00
|
|
|
- file: "{{ '/config/www/downloads/camera/frontdoor/frontdoor_' ~
|
2020-09-30 02:36:02 +00:00
|
|
|
(states.binary_sensor.motion_sensor_158d00024ee084.last_updated ~ '').replace('-','_')
|
|
|
|
.replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg' }}"
|
|
|
|
caption: "Front Door"
|
2021-01-10 20:03:52 +00:00
|
|
|
- file: "{{ '/config/www/downloads/camera/driveway/driveway_' ~
|
2020-09-30 02:36:02 +00:00
|
|
|
(states.binary_sensor.motion_sensor_158d00024ee084.last_updated ~ '').replace('-','_')
|
|
|
|
.replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg' }}"
|
|
|
|
caption: "Driveway"
|
2021-01-10 20:03:52 +00:00
|
|
|
- file: "{{ '/config/www/downloads/camera/garage/garage_' ~
|
2020-09-30 02:36:02 +00:00
|
|
|
(states.binary_sensor.motion_sensor_158d00024ee084.last_updated ~ '').replace('-','_')
|
|
|
|
.replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg' }}"
|
|
|
|
caption: "Garage"
|
2021-08-31 02:07:33 +00:00
|
|
|
- file: "{{ '/config/www/downloads/camera/porch/porch_' ~
|
|
|
|
(states.binary_sensor.motion_sensor_158d00024ee084.last_updated ~ '').replace('-','_')
|
|
|
|
.replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg' }}"
|
|
|
|
caption: Porch
|
2020-09-30 02:36:02 +00:00
|
|
|
|
2019-04-17 22:46:06 +00:00
|
|
|
- service: notify.notify_smtp
|
|
|
|
data_template:
|
|
|
|
title: 'Front door motion {{ now().strftime("%d %h %Y, %I:%M:%S %p") }}'
|
|
|
|
message: 'Motion detected at the front door on {{ now().strftime("%d %h %Y, at %I:%M:%S %p") -}}. Please see the images below.'
|
|
|
|
data:
|
|
|
|
images:
|
2021-01-10 20:03:52 +00:00
|
|
|
- "{{ '/config/www/downloads/camera/frontdoor/frontdoor_' ~
|
2019-08-19 00:21:05 +00:00
|
|
|
(states.binary_sensor.motion_sensor_158d00024ee084.last_updated ~ '').replace('-','_')
|
|
|
|
.replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg' }}"
|
2021-01-10 20:03:52 +00:00
|
|
|
- "{{ '/config/www/downloads/camera/driveway/driveway_' ~
|
2019-08-19 00:21:05 +00:00
|
|
|
(states.binary_sensor.motion_sensor_158d00024ee084.last_updated ~ '').replace('-','_')
|
|
|
|
.replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg' }}"
|
2021-01-10 20:03:52 +00:00
|
|
|
- "{{ '/config/www/downloads/camera/garage/garage_' ~
|
2019-08-19 00:21:05 +00:00
|
|
|
(states.binary_sensor.motion_sensor_158d00024ee084.last_updated ~ '').replace('-','_')
|
|
|
|
.replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg' }}"
|
2021-08-31 02:07:33 +00:00
|
|
|
- "{{ '/config/www/downloads/camera/porch/porch_' ~
|
|
|
|
(states.binary_sensor.motion_sensor_158d00024ee084.last_updated ~ '').replace('-','_')
|
|
|
|
.replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg' }}"
|
2020-09-30 02:36:02 +00:00
|
|
|
|
2019-08-19 00:21:05 +00:00
|
|
|
- condition: template
|
2019-12-20 15:32:28 +00:00
|
|
|
value_template: "{{ states('device_tracker.life360_suresh') == 'home' }}"
|
2020-09-30 02:36:02 +00:00
|
|
|
|
2019-04-17 22:46:06 +00:00
|
|
|
- service: notify.ios_devices
|
|
|
|
data_template:
|
|
|
|
message: "Check Front Door camera!"
|
|
|
|
data:
|
|
|
|
push:
|
|
|
|
category: camera
|
|
|
|
entity_id: "camera.frontdoor_camera"
|
|
|
|
attachment:
|
|
|
|
url: "{{ states.camera.frontdoor_camera.attributes.entity_picture }}"
|
|
|
|
content-type: jpg
|
|
|
|
|
2019-08-19 00:21:05 +00:00
|
|
|
# ###############################################################################
|
|
|
|
# # _____ _
|
|
|
|
# # | __ \ (_)
|
|
|
|
# # | | | |_ __ ___ _______ ____ _ _ _
|
|
|
|
# # | | | | '__| \ \ / / _ \ \ /\ / / _` | | | |
|
|
|
|
# # | |__| | | | |\ V / __/\ V V / (_| | |_| |
|
|
|
|
# # |_____/|_| |_| \_/ \___| \_/\_/ \__,_|\__, |
|
|
|
|
# # __/ |
|
|
|
|
# # |___/
|
2019-04-17 22:46:06 +00:00
|
|
|
- alias: Notify Driveway Camera Snapshots
|
|
|
|
initial_state: true
|
|
|
|
trigger:
|
|
|
|
platform: state
|
|
|
|
entity_id: binary_sensor.motion_sensor_158d00024e57fb
|
2019-08-19 00:21:05 +00:00
|
|
|
to: "on"
|
2019-04-17 22:46:06 +00:00
|
|
|
condition:
|
|
|
|
- condition: template
|
|
|
|
value_template: "{{ states('input_boolean.notify_camera_alerts') == 'on' }}"
|
|
|
|
- condition: template
|
2020-02-05 23:28:38 +00:00
|
|
|
value_template: "{{ states('alarm_control_panel.home') == 'armed_home' or states('alarm_control_panel.home') == 'armed_away' }}"
|
2019-04-17 22:46:06 +00:00
|
|
|
action:
|
|
|
|
- service: camera.snapshot
|
|
|
|
data_template:
|
|
|
|
entity_id: "camera.frontdoor_camera"
|
2019-08-19 00:21:05 +00:00
|
|
|
filename:
|
2021-01-10 20:03:52 +00:00
|
|
|
"{{ '/config/www/downloads/camera/frontdoor/frontdoor_' ~
|
2019-08-19 00:21:05 +00:00
|
|
|
(states.binary_sensor.motion_sensor_158d00024e57fb.last_updated ~ '').replace('-','_')
|
|
|
|
.replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg' }}"
|
2019-04-17 22:46:06 +00:00
|
|
|
- service: camera.snapshot
|
|
|
|
data_template:
|
|
|
|
entity_id: "camera.driveway_camera"
|
2019-08-19 00:21:05 +00:00
|
|
|
filename:
|
2021-01-10 20:03:52 +00:00
|
|
|
"{{ '/config/www/downloads/camera/driveway/driveway_' ~
|
2019-08-19 00:21:05 +00:00
|
|
|
(states.binary_sensor.motion_sensor_158d00024e57fb.last_updated ~ '').replace('-','_')
|
|
|
|
.replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg' }}"
|
2019-04-17 22:46:06 +00:00
|
|
|
- service: camera.snapshot
|
|
|
|
data_template:
|
|
|
|
entity_id: "camera.garage_camera"
|
2019-08-19 00:21:05 +00:00
|
|
|
filename:
|
2021-01-10 20:03:52 +00:00
|
|
|
"{{ '/config/www/downloads/camera/garage/garage_' ~
|
2019-08-19 00:21:05 +00:00
|
|
|
(states.binary_sensor.motion_sensor_158d00024e57fb.last_updated ~ '').replace('-','_')
|
|
|
|
.replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg' }}"
|
2020-09-30 02:36:02 +00:00
|
|
|
|
|
|
|
- service: notify.telegram
|
|
|
|
data_template:
|
|
|
|
title: "Driveway Motion"
|
|
|
|
message: "Motion Detected At Driveway, Check images:"
|
|
|
|
data:
|
|
|
|
photo:
|
2021-01-10 20:03:52 +00:00
|
|
|
- file: "{{ '/config/www/downloads/camera/frontdoor/frontdoor_' ~
|
2020-09-30 02:36:02 +00:00
|
|
|
(states.binary_sensor.motion_sensor_158d00024e57fb.last_updated ~ '').replace('-','_')
|
|
|
|
.replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg' }}"
|
|
|
|
caption: "Front Door"
|
2021-01-10 20:03:52 +00:00
|
|
|
- file: "{{ '/config/www/downloads/camera/driveway/driveway_' ~
|
2020-09-30 02:36:02 +00:00
|
|
|
(states.binary_sensor.motion_sensor_158d00024e57fb.last_updated ~ '').replace('-','_')
|
|
|
|
.replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg' }}"
|
|
|
|
caption: "Driveway"
|
2021-01-10 20:03:52 +00:00
|
|
|
- file: "{{ '/config/www/downloads/camera/garage/garage_' ~
|
2020-09-30 02:36:02 +00:00
|
|
|
(states.binary_sensor.motion_sensor_158d00024e57fb.last_updated ~ '').replace('-','_')
|
|
|
|
.replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg' }}"
|
|
|
|
caption: "Garage"
|
|
|
|
|
2019-04-17 22:46:06 +00:00
|
|
|
- service: notify.notify_smtp
|
|
|
|
data_template:
|
|
|
|
title: 'Driveway motion {{ now().strftime("%d %h %Y, %I:%M:%S %p") }}'
|
|
|
|
message: 'Motion detected at the Driveway on {{ now().strftime("%d %h %Y, at %I:%M:%S %p") }}. Please see the images below.'
|
|
|
|
data:
|
|
|
|
images:
|
2021-01-10 20:03:52 +00:00
|
|
|
- "{{ '/config/www/downloads/camera/driveway/driveway_' ~
|
2019-08-19 00:21:05 +00:00
|
|
|
(states.binary_sensor.motion_sensor_158d00024e57fb.last_updated ~ '').replace('-','_')
|
|
|
|
.replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg' }}"
|
2021-01-10 20:03:52 +00:00
|
|
|
- "{{ '/config/www/downloads/camera/frontdoor/frontdoor_' ~
|
2019-08-19 00:21:05 +00:00
|
|
|
(states.binary_sensor.motion_sensor_158d00024e57fb.last_updated ~ '').replace('-','_')
|
|
|
|
.replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg' }}"
|
2021-01-10 20:03:52 +00:00
|
|
|
- "{{ '/config/www/downloads/camera/garage/garage_' ~
|
2019-08-19 00:21:05 +00:00
|
|
|
(states.binary_sensor.motion_sensor_158d00024e57fb.last_updated ~ '').replace('-','_')
|
|
|
|
.replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg' }}"
|
2020-09-30 02:36:02 +00:00
|
|
|
|
2019-08-19 00:21:05 +00:00
|
|
|
- condition: template
|
2019-12-20 15:32:28 +00:00
|
|
|
value_template: "{{ states('device_tracker.life360_suresh') == 'home' }}"
|
2019-04-17 22:46:06 +00:00
|
|
|
- service: notify.ios_devices
|
|
|
|
data_template:
|
|
|
|
message: "Check Driveway camera!"
|
|
|
|
data:
|
|
|
|
push:
|
|
|
|
category: camera
|
|
|
|
entity_id: "camera.driveway_camera"
|
|
|
|
attachment:
|
|
|
|
url: "{{ states.camera.driveway_camera.attributes.entity_picture }}"
|
|
|
|
content-type: jpg
|
|
|
|
|
2019-08-19 00:21:05 +00:00
|
|
|
# ###############################################################################
|
|
|
|
# # ____ _ _
|
|
|
|
# # | _ \ | | | |
|
|
|
|
# # | |_) | __ _ ___| | ___ _ __ _ _ __ __| |
|
|
|
|
# # | _ < / _` |/ __| |/ / | | |/ _` | '__/ _` |
|
|
|
|
# # | |_) | (_| | (__| <| |_| | (_| | | | (_| |
|
|
|
|
# # |____/ \__,_|\___|_|\_\\__, |\__,_|_| \__,_|
|
|
|
|
# # __/ |
|
|
|
|
# # |___/
|
2019-04-17 22:46:06 +00:00
|
|
|
- alias: Notify Backyard Camera Snapshots
|
|
|
|
initial_state: true
|
|
|
|
trigger:
|
|
|
|
platform: state
|
|
|
|
entity_id: binary_sensor.motion_sensor_158d00024e842c
|
2019-08-19 00:21:05 +00:00
|
|
|
to: "on"
|
2019-04-17 22:46:06 +00:00
|
|
|
condition:
|
|
|
|
- condition: template
|
|
|
|
value_template: "{{ states('input_boolean.notify_camera_alerts') == 'on' }}"
|
|
|
|
- condition: template
|
2020-02-05 23:28:38 +00:00
|
|
|
value_template: "{{ states('alarm_control_panel.home') == 'armed_home' or states('alarm_control_panel.home') == 'armed_away' }}"
|
2019-04-17 22:46:06 +00:00
|
|
|
action:
|
|
|
|
- condition: template
|
|
|
|
value_template: >-
|
|
|
|
{% if state_attr('image_processing.tensorflow_frontdoor_camera', 'summary') != None %}
|
|
|
|
{% if state_attr('image_processing.tensorflow_frontdoor_camera', 'summary') |count > 0 %}
|
|
|
|
true
|
|
|
|
{% else %}
|
|
|
|
false
|
|
|
|
{% endif %}
|
|
|
|
{% else %}
|
|
|
|
false
|
|
|
|
{% endif %}
|
2020-09-30 02:36:02 +00:00
|
|
|
|
2019-04-17 22:46:06 +00:00
|
|
|
- service: camera.snapshot
|
|
|
|
data_template:
|
|
|
|
entity_id: "camera.patio_camera"
|
2019-08-19 00:21:05 +00:00
|
|
|
filename:
|
2021-01-10 20:03:52 +00:00
|
|
|
"{{ '/config/www/downloads/camera/patio/patio_' ~
|
2019-08-19 00:21:05 +00:00
|
|
|
(states.binary_sensor.motion_sensor_158d00024e842c.last_updated ~ '').replace('-','_')
|
|
|
|
.replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg' }}"
|
2020-09-30 02:36:02 +00:00
|
|
|
|
2019-04-17 22:46:06 +00:00
|
|
|
- service: camera.snapshot
|
|
|
|
data_template:
|
|
|
|
entity_id: "camera.playarea_camera"
|
2019-08-19 00:21:05 +00:00
|
|
|
filename:
|
2021-01-10 20:03:52 +00:00
|
|
|
"{{ '/config/www/downloads/camera/playarea/playarea_' ~
|
2019-08-19 00:21:05 +00:00
|
|
|
(states.binary_sensor.motion_sensor_158d00024e842c.last_updated ~ '').replace('-','_')
|
|
|
|
.replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg' }}"
|
2020-09-30 02:36:02 +00:00
|
|
|
|
|
|
|
- service: notify.telegram
|
|
|
|
data_template:
|
|
|
|
title: "Backyard Motion"
|
|
|
|
message: "Motion Detected in the Backyard, Check images:"
|
|
|
|
data:
|
|
|
|
photo:
|
2021-01-10 20:03:52 +00:00
|
|
|
- file: "{{ '/config/www/downloads/camera/patio/patio_' ~
|
2020-09-30 02:36:02 +00:00
|
|
|
(states.binary_sensor.motion_sensor_158d00024e842c.last_updated ~ '').replace('-','_')
|
|
|
|
.replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg' }}"
|
|
|
|
caption: "Patio"
|
2021-01-10 20:03:52 +00:00
|
|
|
- file: "{{ '/config/www/downloads/camera/playarea/playarea_' ~
|
2020-09-30 02:36:02 +00:00
|
|
|
(states.binary_sensor.motion_sensor_158d00024e842c.last_updated ~ '').replace('-','_')
|
|
|
|
.replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg' }}"
|
|
|
|
caption: "Playarea"
|
|
|
|
|
2019-04-17 22:46:06 +00:00
|
|
|
- service: notify.notify_smtp
|
|
|
|
data_template:
|
|
|
|
title: 'Backyard motion {{ now().strftime("%d %h %Y, %I:%M:%S %p") }}'
|
|
|
|
message: 'Motion detected in the Backyard on {{ now().strftime("%d %h %Y, at %I:%M:%S %p") }}. Please see the images below.'
|
|
|
|
data:
|
|
|
|
images:
|
2021-01-10 20:03:52 +00:00
|
|
|
- "{{ '/config/www/downloads/camera/patio/patio_' ~
|
2019-08-19 00:21:05 +00:00
|
|
|
(states.binary_sensor.motion_sensor_158d00024e842c.last_updated ~ '').replace('-','_')
|
|
|
|
.replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg' }}"
|
2021-01-10 20:03:52 +00:00
|
|
|
- "{{ '/config/www/downloads/camera/playarea/playarea_' ~
|
2019-08-19 00:21:05 +00:00
|
|
|
(states.binary_sensor.motion_sensor_158d00024e842c.last_updated ~ '').replace('-','_')
|
|
|
|
.replace(' ', '_').replace(':','_').replace('.','_').replace('+','_') ~ '.jpg' }}"
|
2020-09-30 02:36:02 +00:00
|
|
|
|
2019-08-19 00:21:05 +00:00
|
|
|
- condition: template
|
2019-12-20 15:32:28 +00:00
|
|
|
value_template: "{{ states('device_tracker.life360_suresh') == 'home' }}"
|
2019-04-17 22:46:06 +00:00
|
|
|
- service: notify.ios_devices
|
|
|
|
data_template:
|
|
|
|
message: "Check Patio camera!"
|
|
|
|
data:
|
|
|
|
push:
|
|
|
|
category: camera
|
|
|
|
entity_id: "camera.patio_camera"
|
|
|
|
attachment:
|
|
|
|
url: "{{ states.camera.patio_camera.attributes.entity_picture }}"
|
|
|
|
content-type: jpg
|
|
|
|
|
2019-08-19 00:21:05 +00:00
|
|
|
###############################################################################
|
|
|
|
# _______ _ ____ _
|
|
|
|
# |__ __| | | / __ \ | |
|
|
|
|
# | | _____ _| |_ | | | |_ _____ _ __| | __ _ _ _
|
|
|
|
# | |/ _ \ \/ / __| | | | \ \ / / _ \ '__| |/ _` | | | |
|
|
|
|
# | | __/> <| |_ | |__| |\ V / __/ | | | (_| | |_| |
|
|
|
|
# |_|\___/_/\_\\__| \____/ \_/ \___|_| |_|\__,_|\__, |
|
|
|
|
# __/ |
|
|
|
|
# |___/
|
|
|
|
#
|
|
|
|
# Show latest weather information on camera (refresh every 2 minutes), but only
|
|
|
|
# do it if the last updated is more than 2 minutes; In case some other automation
|
|
|
|
# sets a new text overlay, make sure it stays for at least 2 minutes before
|
|
|
|
# replacing with the weather information
|
|
|
|
#
|
2019-04-17 22:46:06 +00:00
|
|
|
- alias: Show Outdoor Temperature on Camera
|
|
|
|
trigger:
|
|
|
|
- platform: time_pattern
|
2019-08-19 00:21:05 +00:00
|
|
|
minutes: "/2"
|
2019-04-17 22:46:06 +00:00
|
|
|
condition:
|
|
|
|
- condition: template
|
|
|
|
value_template: >
|
2019-05-18 20:06:14 +00:00
|
|
|
{% if state_attr('script.frontdoor_camera_text_overlay', 'last_triggered') != None %}
|
2019-04-17 22:46:06 +00:00
|
|
|
{{ (as_timestamp(now()) - as_timestamp(
|
2019-05-18 20:06:14 +00:00
|
|
|
state_attr('script.frontdoor_camera_text_overlay', 'last_triggered'))) | int > 120 }}
|
2019-04-17 22:46:06 +00:00
|
|
|
{% else %}
|
|
|
|
true
|
|
|
|
{% endif %}
|
|
|
|
action:
|
2019-08-19 00:21:05 +00:00
|
|
|
- service: script.frontdoor_camera_text_overlay
|
|
|
|
data_template:
|
|
|
|
text: >
|
2020-02-05 23:28:38 +00:00
|
|
|
{{ '* ' if states('alarm_control_panel.home') == 'armed_home' or
|
|
|
|
states('alarm_control_panel.home') == 'armed_away' -}}
|
2019-12-20 15:32:28 +00:00
|
|
|
{{- states('sensor.dark_sky_temperature')|int}} °F, Feels like
|
2019-08-19 00:21:05 +00:00
|
|
|
{{- ' ' ~ states('sensor.dark_sky_apparent_temperature') |int -}}
|
|
|
|
- service: script.driveway_camera_text_overlay
|
|
|
|
data_template:
|
|
|
|
text: >
|
2020-02-05 23:28:38 +00:00
|
|
|
{{ '* ' if states('alarm_control_panel.home') == 'armed_home' or
|
|
|
|
states('alarm_control_panel.home') == 'armed_away' -}}
|
2019-12-20 15:32:28 +00:00
|
|
|
{{- states('sensor.dark_sky_temperature')|int}} °F, Feels like
|
2019-08-19 00:21:05 +00:00
|
|
|
{{- ' ' ~ states('sensor.dark_sky_apparent_temperature') |int -}}
|
|
|
|
- service: script.playarea_camera_text_overlay
|
|
|
|
data_template:
|
|
|
|
text: >
|
2020-02-05 23:28:38 +00:00
|
|
|
{{ '* ' if states('alarm_control_panel.home') == 'armed_home' or
|
|
|
|
states('alarm_control_panel.home') == 'armed_away' -}}
|
2019-12-20 15:32:28 +00:00
|
|
|
{{- states('sensor.dark_sky_temperature')|int}} °F, Feels like
|
2019-08-19 00:21:05 +00:00
|
|
|
{{- ' ' ~ states('sensor.dark_sky_apparent_temperature') |int -}}
|
|
|
|
- service: script.patio_camera_text_overlay
|
|
|
|
data_template:
|
|
|
|
text: >
|
2020-02-05 23:28:38 +00:00
|
|
|
{{ '* ' if states('alarm_control_panel.home') == 'armed_home' or
|
|
|
|
states('alarm_control_panel.home') == 'armed_away' -}}
|
2019-12-20 15:32:28 +00:00
|
|
|
{{- states('sensor.dark_sky_temperature')|int}} °F, Feels like
|
2019-08-19 00:21:05 +00:00
|
|
|
{{- ' ' ~ states('sensor.dark_sky_apparent_temperature') |int -}}
|
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
# _____ _ _
|
|
|
|
# / ____| | | |
|
|
|
|
# | | | |__ _ __ ___ _ __ ___ ___ ___ __ _ ___| |_
|
|
|
|
# | | | '_ \| '__/ _ \| '_ ` _ \ / _ \/ __/ _` / __| __|
|
|
|
|
# | |____| | | | | | (_) | | | | | | __/ (_| (_| \__ \ |_
|
|
|
|
# \_____|_| |_|_| \___/|_| |_| |_|\___|\___\__,_|___/\__|
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# Automation to keep Chromecast ON always
|
|
|
|
# When chromecase goes into screen saver mode, the status becomes OFF
|
|
|
|
# This automation will turn it back on if it is OFF for more than 30 seconds
|
2019-04-17 22:46:06 +00:00
|
|
|
- alias: Keep Chromecast On
|
|
|
|
trigger:
|
|
|
|
- platform: state
|
|
|
|
entity_id: media_player.attic_tv
|
2019-08-19 00:21:05 +00:00
|
|
|
to: "off"
|
2019-04-17 22:46:06 +00:00
|
|
|
for:
|
|
|
|
seconds: 30
|
|
|
|
- platform: state
|
|
|
|
entity_id: media_player.attic_tv
|
2019-08-19 00:21:05 +00:00
|
|
|
to: "idle"
|
2019-04-17 22:46:06 +00:00
|
|
|
for:
|
|
|
|
seconds: 30
|
|
|
|
action:
|
|
|
|
- service: media_player.turn_on
|
|
|
|
entity_id: media_player.attic_tv
|
|
|
|
- service: media_player.play_media
|
|
|
|
data:
|
|
|
|
entity_id: media_player.attic_tv
|
|
|
|
media_content_id: !secret frontdoor_camera_stream_url
|
|
|
|
media_content_type: video
|
|
|
|
- service: input_label.set_value
|
|
|
|
data_template:
|
|
|
|
entity_id: input_label.current_stream
|
|
|
|
value: "frontyard"
|
|
|
|
|
2019-08-19 00:21:05 +00:00
|
|
|
# Motion can be detected anywhere around the house, but the main focus is "Frontyard".
|
|
|
|
# By default, the "frontyard" camera stream is played on Chromecast, but when motion
|
|
|
|
# detected anywhere else, it changes the stream to that corresponding camera.
|
|
|
|
# This automation restores back to "default" (frontyard) after 15 seconds!
|
|
|
|
#
|
2019-04-17 22:46:06 +00:00
|
|
|
- alias: Restore Frontyard Stream
|
|
|
|
trigger:
|
|
|
|
- platform: time_pattern
|
2019-08-19 00:21:05 +00:00
|
|
|
seconds: "/5"
|
2019-04-17 22:46:06 +00:00
|
|
|
condition:
|
|
|
|
- condition: template
|
|
|
|
value_template: "{{ states('input_label.current_stream') != 'frontyard' }}"
|
|
|
|
- condition: template
|
2019-08-19 00:21:05 +00:00
|
|
|
value_template: "{{ (as_timestamp(now()) -
|
|
|
|
as_timestamp(states.input_label.current_stream.last_updated))
|
|
|
|
| int > 15 }}"
|
2019-04-17 22:46:06 +00:00
|
|
|
action:
|
2020-07-17 01:15:43 +00:00
|
|
|
- service: script.frontdoor_cam
|
2020-03-21 01:25:56 +00:00
|
|
|
|
|
|
|
#
|
2020-04-12 17:48:04 +00:00
|
|
|
# Every 15 minutes, change stream to alternate view with random cameras
|
2020-03-21 01:25:56 +00:00
|
|
|
#
|
|
|
|
- alias: Reset Stream On Chromecast
|
|
|
|
trigger:
|
|
|
|
- platform: time_pattern
|
|
|
|
minutes: "/15"
|
|
|
|
action:
|
2021-01-10 23:15:03 +00:00
|
|
|
- service_template: "script.{{- ['driveway', 'patio', 'playarea', 'porch'] | random -}}_cam"
|
2020-04-12 17:48:04 +00:00
|
|
|
|
|
|
|
script:
|
2020-07-17 01:15:43 +00:00
|
|
|
frontdoor_cam:
|
|
|
|
sequence:
|
|
|
|
- service: script.stream2chromecast
|
|
|
|
data_template:
|
|
|
|
url: !secret frontdoor_camera_stream_url
|
|
|
|
name: "frontyard"
|
2020-04-12 17:48:04 +00:00
|
|
|
driveway_cam:
|
|
|
|
sequence:
|
2020-03-21 01:25:56 +00:00
|
|
|
- service: script.stream2chromecast
|
|
|
|
data_template:
|
|
|
|
url: !secret driveway_camera_stream_url
|
|
|
|
name: "driveway"
|
2020-04-12 17:48:04 +00:00
|
|
|
patio_cam:
|
|
|
|
sequence:
|
|
|
|
- service: script.stream2chromecast
|
|
|
|
data_template:
|
|
|
|
url: !secret patio_camera_stream_url
|
|
|
|
name: "patio"
|
|
|
|
playarea_cam:
|
|
|
|
sequence:
|
|
|
|
- service: script.stream2chromecast
|
|
|
|
data_template:
|
|
|
|
url: !secret playarea_camera_stream_url
|
|
|
|
name: "playarea"
|
2021-01-10 23:15:03 +00:00
|
|
|
porch_cam:
|
|
|
|
sequence:
|
|
|
|
- service: script.stream2chromecast
|
|
|
|
data_template:
|
|
|
|
url: !secret porch_camera_stream_url
|
|
|
|
name: "porch"
|
|
|
|
|
2021-01-10 20:03:52 +00:00
|
|
|
reset_camera_stream:
|
|
|
|
alias: Reset Camera Stream
|
|
|
|
sequence:
|
|
|
|
- service: shell_command.reset_camera_stream
|
|
|
|
- service_template: "script.{{- ['frontdoor', 'driveway', 'patio', 'playarea'] | random -}}_cam"
|
2021-01-10 23:15:03 +00:00
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
# On-Demand camera stream to chromecast scripts
|
|
|
|
#
|
|
|
|
stream_frontdoor_camera_to_chromecast:
|
|
|
|
sequence:
|
|
|
|
- condition: template
|
|
|
|
value_template: "{{ states('input_boolean.stream_camera2chromecast') == 'on' }}"
|
|
|
|
- service: script.stream2chromecast
|
|
|
|
data_template:
|
|
|
|
url: !secret frontdoor_camera_stream_url
|
|
|
|
name: "frontyard"
|
|
|
|
|
|
|
|
stream_driveway_camera_to_chromecast:
|
|
|
|
sequence:
|
|
|
|
- condition: template
|
|
|
|
value_template: "{{ states('input_boolean.stream_camera2chromecast') == 'on' }}"
|
|
|
|
- service: script.stream2chromecast
|
|
|
|
data_template:
|
|
|
|
url: !secret driveway_camera_stream_url
|
|
|
|
name: "driveway"
|
|
|
|
|
|
|
|
stream_patio_camera_to_chromecast:
|
|
|
|
sequence:
|
|
|
|
- condition: template
|
|
|
|
value_template: "{{ states('input_boolean.stream_camera2chromecast') == 'on' }}"
|
|
|
|
- service: script.stream2chromecast
|
|
|
|
data_template:
|
|
|
|
url: !secret patio_camera_stream_url
|
|
|
|
name: "patio"
|
|
|
|
|
|
|
|
stream_playarea_camera_to_chromecast:
|
|
|
|
sequence:
|
|
|
|
- condition: template
|
|
|
|
value_template: "{{ states('input_boolean.stream_camera2chromecast') == 'on' }}"
|
|
|
|
- service: script.stream2chromecast
|
|
|
|
data_template:
|
|
|
|
url: !secret playarea_camera_stream_url
|
|
|
|
name: "playarea"
|
|
|
|
|
|
|
|
stream_porch_camera_to_chromecast:
|
|
|
|
sequence:
|
|
|
|
- condition: template
|
|
|
|
value_template: "{{ states('input_boolean.stream_camera2chromecast') == 'on' }}"
|
|
|
|
- service: script.stream2chromecast
|
|
|
|
data_template:
|
|
|
|
url: !secret porch_camera_stream_url
|
|
|
|
name: "porch"
|
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
# _____ ____ _
|
|
|
|
# / ____| / __ \ | |
|
|
|
|
# | | __ _ _ __ ___ ___ _ __ __ _ | | | |_ _____ _ __| | __ _ _ _
|
|
|
|
# | | / _` | '_ ` _ \ / _ \ '__/ _` | | | | \ \ / / _ \ '__| |/ _` | | | |
|
|
|
|
# | |___| (_| | | | | | | __/ | | (_| | | |__| |\ V / __/ | | | (_| | |_| |
|
|
|
|
# \_____\__,_|_| |_| |_|\___|_| \__,_| \____/ \_/ \___|_| |_|\__,_|\__, |
|
|
|
|
# __/ |
|
|
|
|
# |___/
|
|
|
|
#
|
|
|
|
# Camera Text Overlay Script - sets a given text as an overlay on camera feed
|
|
|
|
###############################################################################
|
|
|
|
frontdoor_camera_text_overlay:
|
|
|
|
sequence:
|
|
|
|
- service: rest_command.set_frontdoor_camera_text_left_bottom
|
|
|
|
data_template:
|
|
|
|
message: "{{text}}"
|
|
|
|
|
|
|
|
driveway_camera_text_overlay:
|
|
|
|
sequence:
|
|
|
|
- service: rest_command.set_driveway_camera_text_left_bottom
|
|
|
|
data_template:
|
|
|
|
message: "{{text}}"
|
|
|
|
|
|
|
|
patio_camera_text_overlay:
|
|
|
|
sequence:
|
|
|
|
- service: rest_command.set_patio_camera_text_left_bottom
|
|
|
|
data_template:
|
|
|
|
message: "{{text}}"
|
|
|
|
|
|
|
|
playarea_camera_text_overlay:
|
|
|
|
sequence:
|
|
|
|
- service: rest_command.set_playarea_camera_text_left_bottom
|
|
|
|
data_template:
|
|
|
|
message: "{{text}}"
|
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
# Stream2Chromecast script streams a given URL to Chromecast
|
|
|
|
# But before it streams, it turns ON the media player if it is OFF, and after
|
|
|
|
# streaming the URL, it saves the current stream name
|
|
|
|
# BY calling media_player.turn_off, it forces Chromecast stream onto be active
|
|
|
|
# on TV as soon as it turns ON TV
|
|
|
|
stream2chromecast:
|
|
|
|
sequence:
|
|
|
|
- condition: template
|
|
|
|
value_template: "{{ states('input_label.current_stream') != name }}"
|
|
|
|
- service: media_player.play_media
|
|
|
|
data_template:
|
|
|
|
entity_id: media_player.attic_tv
|
|
|
|
media_content_id: "{{ url }}"
|
|
|
|
media_content_type: "video"
|
|
|
|
- service: input_label.set_value
|
|
|
|
data_template:
|
|
|
|
entity_id: input_label.current_stream
|
|
|
|
value: "{{ name }}"
|