Skip to content

Commit

Permalink
lgtm
Browse files Browse the repository at this point in the history
  • Loading branch information
dcmartin committed Dec 3, 2020
1 parent a5a5853 commit 6d015c3
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 45 deletions.
35 changes: 0 additions & 35 deletions homeassistant/automation/motion/detected_notify.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,6 @@
# homeassistant/automation/motion/detected_notify.yaml
###

- id: motion_detected_notify
alias: motion_detected_notify
initial_state: on
trigger:
- platform: state
entity_id: sensor.motion_detected_when
condition:
condition: and
conditions:
- 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') }} {{ states('sensor.motion_detect_entity') -}}(s)
from {{ states('sensor.motion_detected_camera') }}
notification_id: >
detected-{{- states('sensor.motion_event_detected_camera') -}}
message: >-
{{ '![]('
+ states('sensor.motion_base_url')
+ '/local/images/motion_detected-'
+ states('sensor.motion_detected_camera')
+ '.jpg?v1'
+ ')' }}
Detected {{ states('sensor.motion_detected_count') }} {{ states('sensor.motion_detect_entity') -}}(s)
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'
Expand Down
29 changes: 28 additions & 1 deletion homeassistant/lovelace.developer.json.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -1388,6 +1388,15 @@
"title": "Person ago (⧖)",
"type": "history-graph"
},
{
"entities": [
"sensor.motion_detected_person_ago_mean"
],
"hours_to_show": 24,
"refresh_interval": 30,
"title": "Person ago mean (μ)",
"type": "history-graph"
},
{
"entities": [
{
Expand Down Expand Up @@ -1657,6 +1666,15 @@
"title": "Vehicle ago (⧖)",
"type": "history-graph"
},
{
"entities": [
"sensor.motion_detected_vehicle_ago_mean"
],
"hours_to_show": 24,
"refresh_interval": 30,
"title": "Vehicle ago mean (μ)",
"type": "history-graph"
},
{
"entities": [
{
Expand Down Expand Up @@ -1713,7 +1731,7 @@
},
{
"entities": [
"sensor.motion_detected_vechiel_count_mean"
"sensor.motion_detected_vehicle_count_mean"
],
"hours_to_show": 24,
"refresh_interval": 30,
Expand Down Expand Up @@ -1920,6 +1938,15 @@
"title": "Animal ago (⧖)",
"type": "history-graph"
},
{
"entities": [
"sensor.motion_detected_animal_ago_mean"
],
"hours_to_show": 24,
"refresh_interval": 30,
"title": "Animal ago mean (μ)",
"type": "history-graph"
},
{
"entities": [
{
Expand Down
3 changes: 3 additions & 0 deletions homeassistant/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -305,8 +305,11 @@ lovelace.developer.json: lovelace.developer.json.tmpl motion/webcams.json
| jq '(.data.config.views[]|select(.path=="motion_live").cards[]|select(.title=="OVERVIEW").elements)+='"$$(jq '[.[]|{"type":"icon","entity":("camera.motion_live_"+.name),"icon": ("mdi:"+.icon),"style":{"color":"red","left":(.left|tostring+"%"),"top":(.top|tostring+"%"),"height":"5%","width": "5%"}}]' motion/webcams.json)" \
| jq '(.data.config.views[]|select(.path=="settings_view").cards[]|select(.title=="Detect entity").entities)+='"$$(jq '[.[]|{"name":("Detect at "+.name),"entity":("input_select.motion_detect_entity_"+.name)},{"name":("Notify at "+.name),"entity":("input_boolean.motion_detected_entity_notify_"+.name)}]' motion/webcams.json)" \
| jq '(.data.config.views[]|select(.path=="person").cards[]|select(.title=="Person count mean (μ)").entities)+='"$$(jq '[.[]|("sensor.motion_detected_person_count_"+.name+"_mean")]' motion/webcams.json)" \
| jq '(.data.config.views[]|select(.path=="person").cards[]|select(.title=="Person ago mean (μ)").entities)+='"$$(jq '[.[]|("sensor.motion_detected_person_ago_"+.name+"_mean")]' motion/webcams.json)" \
| jq '(.data.config.views[]|select(.path=="vehicle").cards[]|select(.title=="Vehicle count mean (μ)").entities)+='"$$(jq '[.[]|("sensor.motion_detected_vehicle_count_"+.name+"_mean")]' motion/webcams.json)" \
| jq '(.data.config.views[]|select(.path=="vehicle").cards[]|select(.title=="Vehicle ago mean (μ)").entities)+='"$$(jq '[.[]|("sensor.motion_detected_vehicle_ago_"+.name+"_mean")]' motion/webcams.json)" \
| jq '(.data.config.views[]|select(.path=="animal").cards[]|select(.title=="Animal count mean (μ)").entities)+='"$$(jq '[.[]|("sensor.motion_detected_animal_count_"+.name+"_mean")]' motion/webcams.json)" \
| jq '(.data.config.views[]|select(.path=="animal").cards[]|select(.title=="Animal ago mean (μ)").entities)+='"$$(jq '[.[]|("sensor.motion_detected_animal_ago_"+.name+"_mean")]' motion/webcams.json)" \
> $@
@echo "MADE $@"
rm -f .storage/lovelace.lovelace_developer
Expand Down
19 changes: 10 additions & 9 deletions homeassistant/motion/sensor.webcam.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -1653,7 +1653,7 @@
- platform: template
sensors:
motion_detected_person_ago_${MOTION_CAMERA}:
friendly_name: ${MOTION_CAMERA} person ago
friendly_name: '${MOTION_CAMERA} ⧖'
icon_template: 'mdi:camera-timer'
unit_of_measurement: seconds
value_template: >
Expand All @@ -1667,7 +1667,8 @@
- platform: template
sensors:
motion_detected_person_ago_${MOTION_CAMERA}_mean:
friendly_name: ${MOTION_CAMERA} person ago mean
friendly_name: '${MOTION_CAMERA} ⧖ μ'
icon_template: 'mdi:account'
unit_of_measurement: seconds
value_template: >-
{% if states('sensor.motion_detected_person_ago_${MOTION_CAMERA}_statistics') != 'unknown' %}
Expand Down Expand Up @@ -1750,7 +1751,7 @@
- platform: template
sensors:
motion_detected_person_count_${MOTION_CAMERA}:
friendly_name: ${MOTION_CAMERA} person count
friendly_name: '${MOTION_CAMERA} Σ'
icon_template: 'mdi:counter'
unit_of_measurement: '👱'
value_template: >
Expand Down Expand Up @@ -2188,7 +2189,7 @@
- platform: template
sensors:
motion_detected_vehicle_ago_${MOTION_CAMERA}:
friendly_name: ${MOTION_CAMERA} vehicle ago
friendly_name: '${MOTION_CAMERA} ⧖'
icon_template: 'mdi:camera-timer'
unit_of_measurement: seconds
value_template: >
Expand All @@ -2202,7 +2203,7 @@
- platform: template
sensors:
motion_detected_vehicle_ago_${MOTION_CAMERA}_mean:
friendly_name: ${MOTION_CAMERA} vehicle ago mean
friendly_name: '${MOTION_CAMERA} ⧖ μ'
unit_of_measurement: seconds
value_template: >-
{% if states('sensor.motion_detected_vehicle_ago_${MOTION_CAMERA}_statistics') != 'unknown' %}
Expand Down Expand Up @@ -2285,7 +2286,7 @@
- platform: template
sensors:
motion_detected_vehicle_count_${MOTION_CAMERA}:
friendly_name: ${MOTION_CAMERA} vehicle count
friendly_name: '${MOTION_CAMERA} Σ'
icon_template: 'mdi:counter'
unit_of_measurement: '🚗'
value_template: >
Expand Down Expand Up @@ -2723,7 +2724,7 @@
- platform: template
sensors:
motion_detected_animal_ago_${MOTION_CAMERA}:
friendly_name: ${MOTION_CAMERA} animal ago
friendly_name: '${MOTION_CAMERA} ⧖'
icon_template: 'mdi:camera-timer'
unit_of_measurement: seconds
value_template: >
Expand All @@ -2737,7 +2738,7 @@
- platform: template
sensors:
motion_detected_animal_ago_${MOTION_CAMERA}_mean:
friendly_name: ${MOTION_CAMERA} animal ago mean
friendly_name: '${MOTION_CAMERA} ⧖ μ'
unit_of_measurement: seconds
value_template: >-
{% if states('sensor.motion_detected_animal_ago_${MOTION_CAMERA}_statistics') != 'unknown' %}
Expand Down Expand Up @@ -2820,7 +2821,7 @@
- platform: template
sensors:
motion_detected_animal_count_${MOTION_CAMERA}:
friendly_name: ${MOTION_CAMERA} animal count
friendly_name: '${MOTION_CAMERA} Σ'
icon_template: 'mdi:counter'
unit_of_measurement: '🐄'
value_template: >
Expand Down

0 comments on commit 6d015c3

Please sign in to comment.