Skip to content

Commit

Permalink
notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
dcmartin committed Dec 2, 2020
1 parent 5538f94 commit ca0b7cd
Show file tree
Hide file tree
Showing 6 changed files with 203 additions and 92 deletions.
16 changes: 11 additions & 5 deletions homeassistant/automation/motion/detected_animal_notify.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,17 @@
notification_id: >
motion_detected_animal-{{- states('sensor.motion_detected_animal_camera') -}}
message: >-
{{ '![]('
+ states('sensor.motion_base_url')
+ '/local/images/motion_detected_animal-'
+ states('sensor.motion_detected_animal_camera')
+ '.jpg?e='
{{ '[![]('
+ states('sensor.motion_base_url')
+ '/local/images/motion_detected_animal-'
+ states('sensor.motion_detected_animal_camera')
+ '.jpg?e='
+ states('sensor.motion_detected_animal_event_' + states('sensor.motion_detected_animal_camera'))
+ ')]('
+ states('sensor.motion_base_url')
+ '/local/images/motion_detected_animal_animated-'
+ states('sensor.motion_detected_animal_camera')
+ '.gif?e='
+ states('sensor.motion_detected_animal_event_' + states('sensor.motion_detected_animal_camera'))
+ ')' }}
Detected {{ states('sensor.motion_detected_animal_count') }} animal(s)
Expand Down
34 changes: 23 additions & 11 deletions homeassistant/automation/motion/detected_entity_notify.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,24 @@

- id: motion_detected_entity_notify
alias: motion_detected_entity_notify
initial_state: on
initial_state: 'on'
trigger:
- platform: state
entity_id: sensor.motion_detected_entity_when
entity_id: binary_sensor.motion_detected_entity
condition:
condition: and
conditions:
- condition: template
value_template: >-
value_template: >
{{ trigger.to_state.state != trigger.from_state.state }}
- condition: template
value_template: >
{{ is_state('binary_sensor.motion_detected_entity','on') }}
- condition: template
value_template: >
{{ is_state('input_boolean.motion_detected_entity_notify','on') }}
- condition: template
value_template: >-
value_template: >
{{ states('sensor.motion_detected_entity_count')|int > 0 }}
action:
- service: persistent_notification.create
Expand All @@ -24,15 +30,21 @@
Detected {{ states('sensor.motion_detected_entity_count') }} {{ states('sensor.motion_detect_entity') -}}(s)
from {{ states('sensor.motion_detected_entity_camera') }}
notification_id: >
detected_entity-{{- states('sensor.motion_event_detected_entity_camera') -}}
motion_detected_entity-{{- states('sensor.motion_detected_entity_camera') -}}
message: >-
{{ '![]('
+ states('sensor.motion_base_url')
+ '/local/images/motion_detected_entity-'
+ states('sensor.motion_detected_entity_camera')
+ '.jpg?v1'
{{ '[![]('
+ states('sensor.motion_base_url')
+ '/local/images/motion_detected_entity-'
+ states('sensor.motion_detected_entity_camera')
+ '.jpg?e='
+ states('sensor.motion_detected_entity_event_' + states('sensor.motion_detected_entity_camera'))
+ ')]('
+ states('sensor.motion_base_url')
+ '/local/images/motion_detected_entity_animated-'
+ states('sensor.motion_detected_entity_camera')
+ '.gif?e='
+ states('sensor.motion_detected_entity_event_' + states('sensor.motion_detected_entity_camera'))
+ ')' }}
Detected {{ states('sensor.motion_detected_entity_count') }} {{ states('sensor.motion_detect_entity') -}}(s)
from {{ states('sensor.motion_detected_entity_camera') }}
for {{ states('sensor.motion_detected_entity_elapsed') }} seconds
at {{ states('sensor.motion_detected_entity_when') }}
47 changes: 47 additions & 0 deletions homeassistant/automation/motion/detected_notify.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,50 @@
from {{ states('sensor.motion_detected_camera') }}
for {{ states('sensor.motion_detected_elapsed') }} seconds
at {{ states('sensor.motion_detected_when') }}
- id: motion_detected_notify
alias: motion_detected_notify
initial_state: 'on'
trigger:
- platform: state
entity_id: binary_sensor.motion_detected
condition:
condition: and
conditions:
- condition: template
value_template: >
{{ trigger.to_state.state != trigger.from_state.state }}
- condition: template
value_template: >
{{ is_state('binary_sensor.motion_detected','on') }}
- condition: template
value_template: >
{{ is_state('input_boolean.motion_detected_notify','on') }}
- condition: template
value_template: >
{{ states('sensor.motion_detected_count')|int > 0 }}
action:
- service: persistent_notification.create
data_template:
title: >-
Detected {{ states('sensor.motion_detected_count') }} entity(s)
from {{ states('sensor.motion_detected_camera') }}
notification_id: >
motion_detected-{{- states('sensor.motion_detected_camera') -}}
message: >-
{{ '[![]('
+ states('sensor.motion_base_url')
+ '/local/images/motion_detected-'
+ states('sensor.motion_detected_camera')
+ '.jpg?e='
+ states('sensor.motion_detected_event_' + states('sensor.motion_detected_camera'))
+ ')]('
+ states('sensor.motion_base_url')
+ '/local/images/motion_detected_animated-'
+ states('sensor.motion_detected_camera')
+ '.gif?e='
+ states('sensor.motion_detected_event_' + states('sensor.motion_detected_camera'))
+ ')' }}
Detected {{ states('sensor.motion_detected_count') -}}: {{ states('sensor.motion_detected_list') }}:
for {{ states('sensor.motion_detected_elapsed') }} seconds
at {{ states('sensor.motion_detected_when') }}
16 changes: 11 additions & 5 deletions homeassistant/automation/motion/detected_person_notify.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,17 @@
notification_id: >
motion_detected_person-{{- states('sensor.motion_detected_person_camera') -}}
message: >-
{{ '![]('
+ states('sensor.motion_base_url')
+ '/local/images/motion_detected_person-'
+ states('sensor.motion_detected_person_camera')
+ '.jpg?e='
{{ '[![]('
+ states('sensor.motion_base_url')
+ '/local/images/motion_detected_person-'
+ states('sensor.motion_detected_person_camera')
+ '.jpg?e='
+ states('sensor.motion_detected_person_event_' + states('sensor.motion_detected_person_camera'))
+ ')]('
+ states('sensor.motion_base_url')
+ '/local/images/motion_detected_person_animated-'
+ states('sensor.motion_detected_person_camera')
+ '.gif?e='
+ states('sensor.motion_detected_person_event_' + states('sensor.motion_detected_person_camera'))
+ ')' }}
Detected {{ states('sensor.motion_detected_person_count') }} person(s)
Expand Down
16 changes: 11 additions & 5 deletions homeassistant/automation/motion/detected_vehicle_notify.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,17 @@
notification_id: >
motion_detected_vehicle-{{- states('sensor.motion_detected_vehicle_camera') -}}
message: >-
{{ '![]('
+ states('sensor.motion_base_url')
+ '/local/images/motion_detected_vehicle-'
+ states('sensor.motion_detected_vehicle_camera')
+ '.jpg?e='
{{ '[![]('
+ states('sensor.motion_base_url')
+ '/local/images/motion_detected_vehicle-'
+ states('sensor.motion_detected_vehicle_camera')
+ '.jpg?e='
+ states('sensor.motion_detected_vehicle_event_' + states('sensor.motion_detected_vehicle_camera'))
+ ')]('
+ states('sensor.motion_base_url')
+ '/local/images/motion_detected_vehicle_animated-'
+ states('sensor.motion_detected_vehicle_camera')
+ '.gif?e='
+ states('sensor.motion_detected_vehicle_event_' + states('sensor.motion_detected_vehicle_camera'))
+ ')' }}
Detected {{ states('sensor.motion_detected_vehicle_count') }} vehicle(s)
Expand Down
Loading

0 comments on commit ca0b7cd

Please sign in to comment.