Compare commits
No commits in common. "c831770ac8f7fc574cf6ba4e4fc787de42343b3b" and "51b2f58791d5c1ff68050e2e362119e2d7067ba2" have entirely different histories.
c831770ac8
...
51b2f58791
@ -1,25 +0,0 @@
|
|||||||
services:
|
|
||||||
deepstack:
|
|
||||||
container_name: deepstack
|
|
||||||
restart: unless-stopped
|
|
||||||
image: deepquestai/deepstack
|
|
||||||
ports:
|
|
||||||
- '5000:5000'
|
|
||||||
environment:
|
|
||||||
- VISION-DETECTION=True
|
|
||||||
- API-KEY=""
|
|
||||||
volumes:
|
|
||||||
- /Users/robin/Data/pytorch-models:/modelstore/detection
|
|
||||||
deepstack_ui:
|
|
||||||
container_name: deepstack_ui
|
|
||||||
restart: unless-stopped
|
|
||||||
image: robmarkcole/deepstack-ui:latest
|
|
||||||
environment:
|
|
||||||
- DEEPSTACK_IP=deepstack
|
|
||||||
- DEEPSTACK_PORT=5000
|
|
||||||
- DEEPSTACK_API_KEY=""
|
|
||||||
- DEEPSTACK_TIMEOUT=20
|
|
||||||
- DEEPSTACK_CUSTOM_MODEL=fire
|
|
||||||
- DEEPSTACK_UI_DEBUG_MODE=True
|
|
||||||
ports:
|
|
||||||
- '8501:8501'
|
|
||||||
@ -1,39 +0,0 @@
|
|||||||
# Automation version of notification
|
|
||||||
action: notify.mobile_app_sm_n986b
|
|
||||||
data_template:
|
|
||||||
message: A {{trigger.payload_json["after"]["label"]}} was detected.
|
|
||||||
title: Frigate
|
|
||||||
data:
|
|
||||||
image: >-
|
|
||||||
https://home-assistant.sthome.org/api/frigate/notifications/{{trigger.payload_json["after"]["id"]}}/thumbnail.jpg?format=android
|
|
||||||
tag: "{{trigger.payload_json[\"after\"][\"id\"]}}"
|
|
||||||
when: "{{trigger.payload_json[\"after\"][\"start_time\"]|int}}"
|
|
||||||
actions:
|
|
||||||
- action: URI
|
|
||||||
title: Open Image
|
|
||||||
uri: >-
|
|
||||||
https://home-assistant.sthome.org/api/frigate/notifications/{{trigger.payload_json["after"]["id"]}}/thumbnail.jpg?format=android
|
|
||||||
enabled: true
|
|
||||||
|
|
||||||
# script version of notification
|
|
||||||
alias: Send Dynamic Notification To All Devices
|
|
||||||
sequence:
|
|
||||||
- data:
|
|
||||||
message: "{{ message }}"
|
|
||||||
title: "{{ title }}"
|
|
||||||
data: null
|
|
||||||
url: "{{ video }}"
|
|
||||||
tag: "{{ notifTag }}"
|
|
||||||
group: "{{ group }}"
|
|
||||||
attachment:
|
|
||||||
url: >-
|
|
||||||
{% if (importance == "default" and video != null) -%} {{ video }} {%-
|
|
||||||
else -%} {{ image }} {%- endif %}
|
|
||||||
push:
|
|
||||||
interruption-level: >-
|
|
||||||
{% if importance == "max" -%} time-sensitive {%- else -%} passive {%-
|
|
||||||
endif %}
|
|
||||||
action: notify.mobile_app_sm_n986b
|
|
||||||
mode: single
|
|
||||||
icon: mdi:bell-ring-outline
|
|
||||||
max: 10
|
|
||||||
@ -1,97 +0,0 @@
|
|||||||
alias: "FRIGATE: Person Detect Logic"
|
|
||||||
description: >-
|
|
||||||
This automation is used to send a notification when a person is detected by
|
|
||||||
Frigate. It uses the frigate MQTT event stream to trigger the notification and
|
|
||||||
includes a snapshot of the detected object. The notification will be sent to
|
|
||||||
all devices with the specified group and will include a video clip of the
|
|
||||||
detection if available.
|
|
||||||
triggers:
|
|
||||||
- topic: homeassistant/events
|
|
||||||
id: frigate-event
|
|
||||||
value_template: "{{ value_json[\"after\"][\"camera\"] }}"
|
|
||||||
variables:
|
|
||||||
after_zones: "{{ trigger.payload_json[\"after\"][\"entered_zones\"] }}"
|
|
||||||
before_zones: "{{ trigger.payload_json[\"before\"][\"entered_zones\"] }}"
|
|
||||||
camera: "{{ trigger.payload_json[\"after\"][\"camera\"] }}"
|
|
||||||
id: "{{ trigger.payload_json[\"after\"][\"id\"] }}"
|
|
||||||
label: "{{ trigger.payload_json[\"after\"][\"label\"] }}"
|
|
||||||
score: "{{ trigger.payload_json[\"after\"][\"score\"] }}"
|
|
||||||
time_clip_start: "{{ trigger.payload_json[\"after\"][\"start_time\"] - 10.0 }}"
|
|
||||||
trigger: mqtt
|
|
||||||
conditions:
|
|
||||||
- condition: or
|
|
||||||
conditions:
|
|
||||||
- condition: template
|
|
||||||
value_template: "{{ trigger.payload_json['type'] == 'new' }}"
|
|
||||||
- condition: template
|
|
||||||
value_template: "{{ before_zones | length == 0 }}"
|
|
||||||
enabled: false
|
|
||||||
- condition: template
|
|
||||||
value_template: "{{ trigger.payload_json[\"after\"][\"entered_zones\"]|length > 0 }}"
|
|
||||||
enabled: false
|
|
||||||
actions:
|
|
||||||
- choose:
|
|
||||||
- conditions:
|
|
||||||
- condition: trigger
|
|
||||||
id: frigate-event
|
|
||||||
sequence:
|
|
||||||
- action: script.person_in_driveway_detect_actions
|
|
||||||
data:
|
|
||||||
id: "{{ id }}"
|
|
||||||
title: >-
|
|
||||||
{{ label }} was detected on {{ camera | replace("_", " ") |
|
|
||||||
title }}
|
|
||||||
message: >-
|
|
||||||
{{ label }} detected in the {{ after_zones[0] | replace("_", "
|
|
||||||
") | title }}
|
|
||||||
notifTag: "{{ id }}"
|
|
||||||
notifIcon: mdi:doorbell-video
|
|
||||||
group: frigate-notification-{{ camera }}
|
|
||||||
importance: max
|
|
||||||
image: /api/frigate/notifications/{{ id }}/snapshot.jpg
|
|
||||||
video: ""
|
|
||||||
clickAction: ""
|
|
||||||
camera: "{{ camera }}"
|
|
||||||
- repeat:
|
|
||||||
sequence:
|
|
||||||
- wait_for_trigger:
|
|
||||||
- topic: homeassistant/events
|
|
||||||
payload: "{{ trigger.payload_json[\"after\"][\"id\"] }}"
|
|
||||||
value_template: "{{ value_json[\"after\"][\"id\"] }}"
|
|
||||||
trigger: mqtt
|
|
||||||
continue_on_timeout: false
|
|
||||||
timeout: "00:02:00"
|
|
||||||
- condition: template
|
|
||||||
value_template: "{{ wait.trigger.payload_json['type'] == 'end' }}"
|
|
||||||
- action: script.person_in_driveway_detect_actions
|
|
||||||
data:
|
|
||||||
id: "{{ id }}"
|
|
||||||
title: >
|
|
||||||
{% if (wait.trigger.payload_json["after"]["sub_label"] !=
|
|
||||||
None) -%} {{
|
|
||||||
(wait.trigger.payload_json["after"]["sub_label"]) | title
|
|
||||||
}} {%- else -%} {{ label | replace("_", " ") | title }}
|
|
||||||
{%- endif %} was detected in the {{ after_zones[0] |
|
|
||||||
replace("_", " ") | title }}
|
|
||||||
message: >-
|
|
||||||
Detected with {{ int(score | round(2) * 100) }}%
|
|
||||||
confidence
|
|
||||||
notifTag: "{{ id }}"
|
|
||||||
notifIcon: mdi:doorbell-video
|
|
||||||
group: >
|
|
||||||
frigate-notification-{{
|
|
||||||
trigger.payload_json["after"]["camera"] }}
|
|
||||||
importance: default
|
|
||||||
image: /api/frigate/notifications/{{ id }}/snapshot.jpg
|
|
||||||
video: >-
|
|
||||||
home-assistant.sthome.org/api/{{ id }}/{{ camera
|
|
||||||
}}/clip.mp4
|
|
||||||
clickAction: >
|
|
||||||
https://home-assistant.sthome.org/api/frigate/notifications/{{id}}/{{camera}}/clip.mp4
|
|
||||||
camera: "{{ camera }}"
|
|
||||||
until:
|
|
||||||
- condition: template
|
|
||||||
value_template: "{{ wait.trigger.payload_json[\"type\"] == \"end\" }}"
|
|
||||||
default: []
|
|
||||||
mode: parallel
|
|
||||||
max: 10
|
|
||||||
@ -1,125 +0,0 @@
|
|||||||
alias: Person detect Actions
|
|
||||||
description: ""
|
|
||||||
variables:
|
|
||||||
relay: null
|
|
||||||
counter: null
|
|
||||||
sequence:
|
|
||||||
- if:
|
|
||||||
- condition: template
|
|
||||||
value_template: "{{ camera == 'Driveway' }}"
|
|
||||||
then:
|
|
||||||
- variables:
|
|
||||||
relay: switch.sthome_ut1_relay_1
|
|
||||||
counter: counter.driveway_person_alarm_counter
|
|
||||||
else:
|
|
||||||
- if:
|
|
||||||
- condition: template
|
|
||||||
value_template: "{{ camera == 'Patio' }}"
|
|
||||||
then:
|
|
||||||
- variables:
|
|
||||||
relay: switch.sthome_ut1_relay_2
|
|
||||||
counter: counter.patio_person_alarm_counter
|
|
||||||
else:
|
|
||||||
- if:
|
|
||||||
- condition: template
|
|
||||||
value_template: "{{ camera == 'Westwall' }}"
|
|
||||||
then:
|
|
||||||
- variables:
|
|
||||||
relay: switch.sthome_ut1_relay_2
|
|
||||||
counter: counter.west_wall_person_alarm_counter
|
|
||||||
else:
|
|
||||||
- if:
|
|
||||||
- condition: template
|
|
||||||
value_template: "{{ camera == 'Eastwall' }}"
|
|
||||||
then:
|
|
||||||
- variables:
|
|
||||||
relay: switch.sthome_ut1_relay_3
|
|
||||||
counter: counter.east_wall_person_alarm_counter
|
|
||||||
else:
|
|
||||||
- if:
|
|
||||||
- condition: template
|
|
||||||
value_template: "{{ camera == 'Backyard' }}"
|
|
||||||
then:
|
|
||||||
- variables:
|
|
||||||
relay: switch.sthome_ut1_relay_4
|
|
||||||
counter: counter.backyard_person_alarm_counter
|
|
||||||
else:
|
|
||||||
- stop: Unknown camera
|
|
||||||
- action: counter.increment
|
|
||||||
target:
|
|
||||||
entity_id: "{{ counter }}"
|
|
||||||
data: {}
|
|
||||||
- action: switch.turn_on
|
|
||||||
target:
|
|
||||||
entity_id: "{{ relay }}"
|
|
||||||
data: {}
|
|
||||||
- action: script.send_dynamic_notification_to_all_devices
|
|
||||||
data:
|
|
||||||
id: "{{ id }}"
|
|
||||||
title: "{{ title }}"
|
|
||||||
message: "{{ message }}"
|
|
||||||
notifTag: "{{ notifTag }}"
|
|
||||||
notifIcon: "{{ notifIcon }}"
|
|
||||||
group: "{{ group }}"
|
|
||||||
importance: "{{ importance }}"
|
|
||||||
image: "{{ image }}"
|
|
||||||
video: "{{ video }}"
|
|
||||||
clickAction: "{{ clickAction }}"
|
|
||||||
enabled: true
|
|
||||||
fields:
|
|
||||||
id:
|
|
||||||
selector:
|
|
||||||
text: null
|
|
||||||
name: id
|
|
||||||
required: true
|
|
||||||
title:
|
|
||||||
selector:
|
|
||||||
text: null
|
|
||||||
name: title
|
|
||||||
required: true
|
|
||||||
message:
|
|
||||||
selector:
|
|
||||||
text: null
|
|
||||||
name: message
|
|
||||||
required: true
|
|
||||||
notiftag:
|
|
||||||
selector:
|
|
||||||
text: null
|
|
||||||
name: notifTag
|
|
||||||
required: true
|
|
||||||
notificon:
|
|
||||||
selector:
|
|
||||||
text: null
|
|
||||||
name: notifIcon
|
|
||||||
required: true
|
|
||||||
group:
|
|
||||||
selector:
|
|
||||||
text: null
|
|
||||||
name: group
|
|
||||||
required: true
|
|
||||||
importance:
|
|
||||||
selector:
|
|
||||||
text: null
|
|
||||||
name: importance
|
|
||||||
required: true
|
|
||||||
image:
|
|
||||||
selector:
|
|
||||||
text: null
|
|
||||||
name: image
|
|
||||||
required: true
|
|
||||||
clickaction:
|
|
||||||
selector:
|
|
||||||
text: null
|
|
||||||
name: clickAction
|
|
||||||
required: true
|
|
||||||
video:
|
|
||||||
selector:
|
|
||||||
text: null
|
|
||||||
name: video
|
|
||||||
required: true
|
|
||||||
camera:
|
|
||||||
selector:
|
|
||||||
entity: {}
|
|
||||||
name: camera
|
|
||||||
description: Name of camera as defined in Frigate
|
|
||||||
required: true
|
|
||||||
@ -1,107 +0,0 @@
|
|||||||
alias: Send Dynamic Notification To All Devices
|
|
||||||
sequence:
|
|
||||||
- parallel:
|
|
||||||
# - if:
|
|
||||||
# - condition: template
|
|
||||||
# value_template: '{{ send_to_fold | default(True) }}'
|
|
||||||
# then:
|
|
||||||
# - data:
|
|
||||||
# message: '{{ message }}'
|
|
||||||
# title: '{{ title }}'
|
|
||||||
# data:
|
|
||||||
# channel: '{{ channel }}'
|
|
||||||
# clickAction: '{{ video }}'
|
|
||||||
# tag: '{{ notifTag }}'
|
|
||||||
# group: '{{ group }}'
|
|
||||||
# image: '{% if (importance == "default" and video != null) -%} {{ null
|
|
||||||
# }} {%- else -%} {{ image }} {%- endif %}'
|
|
||||||
# video: '{% if (importance == "default" and video != null) -%} {{ video
|
|
||||||
# }} {%- else -%} {{ null }} {%- endif %}'
|
|
||||||
# notification_icon: '{{ notifIcon }}'
|
|
||||||
# importance: '{{ importance }}'
|
|
||||||
# action: notify.mobile_app_fold
|
|
||||||
- data:
|
|
||||||
message: '{{ message }}'
|
|
||||||
title: '{{ title }}'
|
|
||||||
data:
|
|
||||||
url: '{{ video }}'
|
|
||||||
tag: '{{ notifTag }}'
|
|
||||||
group: '{{ group }}'
|
|
||||||
attachment:
|
|
||||||
url: '{% if (importance == "default" and video != null) -%} {{ video }} {%- else -%} {{ image }} {%- endif %}'
|
|
||||||
push:
|
|
||||||
interruption-level: '{% if importance == "max" -%} time-sensitive {%- else -%} passive {%- endif %}'
|
|
||||||
# must test above data sent to notify.mobile_app_sm_n986b and check whether the following data is needed
|
|
||||||
# actions:
|
|
||||||
# - action: URI
|
|
||||||
# title: Open Image
|
|
||||||
# uri: https://home-assistant.sthome.org/api/frigate/notifications/{{ id }}/thumbnail.jpg?format=android
|
|
||||||
action: notify.mobile_app_sm_n986b
|
|
||||||
# - if:
|
|
||||||
# - condition: template
|
|
||||||
# value_template: '{{ states("media_player.nova4k") != "off" }}'
|
|
||||||
# - condition: template
|
|
||||||
# value_template: '{{ importance == "max" }}'
|
|
||||||
# then:
|
|
||||||
# - data:
|
|
||||||
# message: '{{ message }}'
|
|
||||||
# title: '{{ title }}'
|
|
||||||
# data:
|
|
||||||
# fontsize: medium
|
|
||||||
# image:
|
|
||||||
# url: https://frigate.sthome.org/api/events/{{id}}/snapshot.jpg
|
|
||||||
# action: notify.nova_4k
|
|
||||||
mode: parallel
|
|
||||||
icon: mdi:bell-ring-outline
|
|
||||||
max: 10
|
|
||||||
fields:
|
|
||||||
id:
|
|
||||||
selector:
|
|
||||||
text: null
|
|
||||||
name: id
|
|
||||||
required: true
|
|
||||||
title:
|
|
||||||
selector:
|
|
||||||
text: null
|
|
||||||
name: title
|
|
||||||
required: true
|
|
||||||
message:
|
|
||||||
selector:
|
|
||||||
text: null
|
|
||||||
name: message
|
|
||||||
required: true
|
|
||||||
notiftag:
|
|
||||||
selector:
|
|
||||||
text: null
|
|
||||||
name: notifTag
|
|
||||||
required: true
|
|
||||||
notificon:
|
|
||||||
selector:
|
|
||||||
text: null
|
|
||||||
name: notifIcon
|
|
||||||
required: true
|
|
||||||
group:
|
|
||||||
selector:
|
|
||||||
text: null
|
|
||||||
name: group
|
|
||||||
required: true
|
|
||||||
importance:
|
|
||||||
selector:
|
|
||||||
text: null
|
|
||||||
name: importance
|
|
||||||
required: true
|
|
||||||
image:
|
|
||||||
selector:
|
|
||||||
text: null
|
|
||||||
name: image
|
|
||||||
required: true
|
|
||||||
clickaction:
|
|
||||||
selector:
|
|
||||||
text: null
|
|
||||||
name: clickAction
|
|
||||||
required: true
|
|
||||||
video:
|
|
||||||
selector:
|
|
||||||
text: null
|
|
||||||
name: video
|
|
||||||
required: true
|
|
||||||
@ -1,171 +0,0 @@
|
|||||||
https://www.youtube.com/watch?v=gA67NCcTwms&t=621s
|
|
||||||
|
|
||||||
# Automation yaml file
|
|
||||||
--- snip ---
|
|
||||||
alias: "FRIGATE: Notify driveway zone1 person detection"
|
|
||||||
description: FRIGATE notify - driveway
|
|
||||||
triggers:
|
|
||||||
- topic: homeassistant/events
|
|
||||||
trigger: mqtt
|
|
||||||
conditions:
|
|
||||||
- condition: template
|
|
||||||
value_template: "{{ trigger.payload_json['after']['label'] == 'person' }}"
|
|
||||||
- condition: template
|
|
||||||
value_template: "{{ 'driveway_z1' in trigger.payload_json['after']['entered_zones']}}"
|
|
||||||
actions:
|
|
||||||
- action: notify.mobile_app_sm_n986b
|
|
||||||
data_template:
|
|
||||||
message: A {{trigger.payload_json["after"]["label"]}} was detected.
|
|
||||||
title: Frigate
|
|
||||||
data:
|
|
||||||
image: >-
|
|
||||||
https://home-assistant.sthome.org/api/frigate/notifications/{{trigger.payload_json["after"]["id"]}}/thumbnail.jpg?format=android
|
|
||||||
tag: "{{trigger.payload_json[\"after\"][\"id\"]}}"
|
|
||||||
when: "{{trigger.payload_json[\"after\"][\"start_time\"]|int}}"
|
|
||||||
actions:
|
|
||||||
- action: URI
|
|
||||||
title: Open Image
|
|
||||||
uri: >-
|
|
||||||
https://home-assistant.sthome.org/api/frigate/notifications/{{trigger.payload_json["after"]["id"]}}/thumbnail.jpg?format=android
|
|
||||||
enabled: true
|
|
||||||
mode: single
|
|
||||||
--- snip ---
|
|
||||||
|
|
||||||
# Install home-assistant app on your android phone from the play store
|
|
||||||
# After installation and connection to you home-assistant server, on home-assistant server (on computer), navigate to Settings -> Devices & services -> Integrations. Look for your Mobile App in the list of integrations.
|
|
||||||
# To change the name of the device, click on the 3 dot menu next to the device name under Integration Entities and select Rename.
|
|
||||||
|
|
||||||
# open app on phone and from the Overview screen, click on hamburger menu -> Settings -> Companion app -> Notification channels
|
|
||||||
|
|
||||||
# With the device name now known, edit the yaml file above to reflect the device name, e.g.
|
|
||||||
# if device name is SM-N986B, then
|
|
||||||
- action: notify.mobile_app_samsung_sm_n986b
|
|
||||||
|
|
||||||
|
|
||||||
To create a script using GUI
|
|
||||||
----------------------------
|
|
||||||
Navigate to Settings -> Automations & Scenes -> Scripts
|
|
||||||
Click "+ CREATE SCRIPT"
|
|
||||||
Click Create New Script
|
|
||||||
|
|
||||||
To create script directly using yaml
|
|
||||||
------------------------------------
|
|
||||||
In truenas shell, go to config/scripts folder
|
|
||||||
# Create custom scripts folder to keep scripts organised
|
|
||||||
mkdir custom_scripts
|
|
||||||
# Create script file using nano editor, for example:
|
|
||||||
nano custom_scripts/send_dynamic_notification_to_all_devices.yaml
|
|
||||||
# Then edit scripts.yaml to include newly created script file
|
|
||||||
nano scripts.yaml
|
|
||||||
# Enter following line in scripts.yaml file, save and exit
|
|
||||||
script: !include_dir_merge_named custom_scripts/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-------------------------
|
|
||||||
alias: Outside - Driveway & Front Yard - Frigate Event - Cat / Dog / Person Seen
|
|
||||||
description: ''
|
|
||||||
# The trigger is mqtt and will fire whenever an object is detected by YOUR_CAMERA_NAME
|
|
||||||
trigger:
|
|
||||||
- platform: mqtt
|
|
||||||
topic: frigate/events
|
|
||||||
id: frigate-event
|
|
||||||
payload: YOUR_CAMERA_NAME
|
|
||||||
value_template: "{{ value_json['after']['camera'] }}"
|
|
||||||
variables:
|
|
||||||
after_zones: "{{ trigger.payload_json['after']['entered_zones'] }}"
|
|
||||||
before_zones: "{{ trigger.payload_json['before']['entered_zones'] }}"
|
|
||||||
camera: "{{ trigger.payload_json['after']['camera'] }}"
|
|
||||||
id: "{{ trigger.payload_json['after']['id'] }}"
|
|
||||||
label: "{{ trigger.payload_json['after']['label'] }}"
|
|
||||||
score: "{{ trigger.payload_json['after']['score'] }}"
|
|
||||||
time_clip_start: "{{ trigger.payload_json['after']['start_time'] - 10.0 }}"
|
|
||||||
# Conditions must be used to filter out objects / detections that are not of interest
|
|
||||||
condition:
|
|
||||||
# This condition is used to ensure that I am only notified of objects that are new or only just entered a zone. This is to avoid getting loads of updated notifications for the same dog in my backyard (as an example).
|
|
||||||
- condition: or
|
|
||||||
conditions:
|
|
||||||
- condition: template
|
|
||||||
value_template: "{{ trigger.payload_json['type'] == 'new' }}"
|
|
||||||
- condition: template
|
|
||||||
value_template: "{{ before_zones | length == 0 }}"
|
|
||||||
# This ensures that the object at least has one zone, this can be removed if you don't care about zones
|
|
||||||
- condition: template
|
|
||||||
value_template: '{{ trigger.payload_json["after"]["entered_zones"]|length > 0 }}'
|
|
||||||
# This specifically checks for the object to be in the driveway or front_yard zone. This can be removed or those names changed to fit your use case.
|
|
||||||
for example:
|
|
||||||
- condition: template
|
|
||||||
value_template: >-
|
|
||||||
{{ ["driveway", "front_yard"] | select("in",
|
|
||||||
after_zones) | list | length > 0 }}
|
|
||||||
alias: Object is in Driveway or Front Yard
|
|
||||||
# This filters out any car objects as I have a separate automation with different behavior for car. This can be removed if not applicable to your use case.
|
|
||||||
- condition: template
|
|
||||||
value_template: '{{ trigger.payload_json["after"]["label"] != "car" }}'
|
|
||||||
action:
|
|
||||||
- choose:
|
|
||||||
- conditions:
|
|
||||||
- condition: trigger
|
|
||||||
id: frigate-event
|
|
||||||
sequence:
|
|
||||||
# Send the initial notification with snapshot and info.
|
|
||||||
- service: script.send_dynamic_notification_to_all_devices
|
|
||||||
data:
|
|
||||||
id: "{{ id }}"
|
|
||||||
title: >-
|
|
||||||
{{ label }} was
|
|
||||||
detected on {{ camera |
|
|
||||||
replace("_", " ") | title }}
|
|
||||||
message: >-
|
|
||||||
{{ label }} detected in
|
|
||||||
the {{ after_zones[0] |
|
|
||||||
replace("_", " ") | title }}
|
|
||||||
notifTag: "{{ id }}"
|
|
||||||
notifIcon: mdi:doorbell-video
|
|
||||||
group: >-
|
|
||||||
frigate-notification-{{ camera }}
|
|
||||||
importance: max
|
|
||||||
image: >-
|
|
||||||
/api/frigate/notifications/{{ id }}/snapshot.jpg
|
|
||||||
clickAction: ''
|
|
||||||
# Wait until the end of the notification has occurred.
|
|
||||||
- repeat:
|
|
||||||
until:
|
|
||||||
- condition: template
|
|
||||||
value_template: '{{ wait.trigger.payload_json["type"] == "end" }}'
|
|
||||||
sequence:
|
|
||||||
- wait_for_trigger:
|
|
||||||
- platform: mqtt
|
|
||||||
topic: frigate/events
|
|
||||||
payload: "{{ trigger.payload_json[\"after\"][\"id\"] }}"
|
|
||||||
value_template: "{{ value_json[\"after\"][\"id\"] }}"
|
|
||||||
continue_on_timeout: false
|
|
||||||
timeout: '00:02:00'
|
|
||||||
- condition: template
|
|
||||||
value_template: '{{ wait.trigger.payload_json[''type''] == ''end'' }}'
|
|
||||||
- service: script.send_dynamic_notification_to_all_devices
|
|
||||||
data:
|
|
||||||
id: '{{ id }}'
|
|
||||||
# Uses double take for title and message to include face info if a match is detected.
|
|
||||||
title: >-
|
|
||||||
{% if (wait.trigger.payload_json["after"]["sub_label"] !=
|
|
||||||
None) -%} {{ (wait.trigger.payload_json["after"]["sub_label"])
|
|
||||||
| title }} {%- else -%} {{ label | replace("_", " ") | title
|
|
||||||
}} {%- endif %} was detected in the {{ after_zones[0] |
|
|
||||||
replace("_", " ") | title }}
|
|
||||||
message: Detected with {{ int(score | round(2) * 100) }}% confidence
|
|
||||||
notifTag: '{{ id }}'
|
|
||||||
notifIcon: mdi:doorbell-video
|
|
||||||
group: >-
|
|
||||||
frigate-notification-{{
|
|
||||||
trigger.payload_json["after"]["camera"] }}
|
|
||||||
importance: default
|
|
||||||
image: >-
|
|
||||||
/api/frigate/notifications/{{ id }}/snapshot.jpg
|
|
||||||
video: >-
|
|
||||||
HASS_URL_BASE/api/{{id}}/{{camera}}/clip.mp4
|
|
||||||
clickAction: >-
|
|
||||||
http://HASS_URL_BASE/api/frigate/notifications/{{id}}/{{camera}}/clip.mp4
|
|
||||||
default: []
|
|
||||||
mode: parallel
|
|
||||||
max: 10
|
|
||||||
@ -1,106 +0,0 @@
|
|||||||
alias: Frigate Person Detect Notification
|
|
||||||
description: 'This automation is used to send a notification when a person is detected by Frigate. It uses the frigate MQTT event stream to trigger the notification and includes a snapshot of the detected object. The notification will be sent to all devices with the specified group and will include a video clip of the detection if available.'
|
|
||||||
# The trigger is mqtt and will fire whenever an object is detected by YOUR_CAMERA_NAME
|
|
||||||
trigger:
|
|
||||||
- platform: mqtt
|
|
||||||
topic: homeassistant/events
|
|
||||||
id: frigate-event
|
|
||||||
payload: Driveway
|
|
||||||
value_template: "{{ value_json['after']['camera'] }}"
|
|
||||||
variables:
|
|
||||||
after_zones: "{{ trigger.payload_json['after']['entered_zones'] }}"
|
|
||||||
before_zones: "{{ trigger.payload_json['before']['entered_zones'] }}"
|
|
||||||
camera: "{{ trigger.payload_json['after']['camera'] }}"
|
|
||||||
id: "{{ trigger.payload_json['after']['id'] }}"
|
|
||||||
label: "{{ trigger.payload_json['after']['label'] }}"
|
|
||||||
score: "{{ trigger.payload_json['after']['score'] }}"
|
|
||||||
time_clip_start: "{{ trigger.payload_json['after']['start_time'] - 10.0 }}"
|
|
||||||
# Conditions must be used to filter out objects / detections that are not of interest
|
|
||||||
condition:
|
|
||||||
# This condition is used to ensure that I am only notified of objects that are new or only just entered a zone. This is to avoid getting loads of updated notifications for the same dog in my backyard (as an example).
|
|
||||||
- condition: or
|
|
||||||
conditions:
|
|
||||||
- condition: template
|
|
||||||
value_template: "{{ trigger.payload_json['type'] == 'new' }}"
|
|
||||||
- condition: template
|
|
||||||
value_template: "{{ before_zones | length == 0 }}"
|
|
||||||
# This ensures that the object at least has one zone, this can be removed if you don't care about zones
|
|
||||||
- condition: template
|
|
||||||
value_template: '{{ trigger.payload_json["after"]["entered_zones"]|length > 0 }}'
|
|
||||||
# This specifically checks for the object to be in the specified zones. This can be removed or those names changed to fit your use case.
|
|
||||||
#for example:
|
|
||||||
- condition: template
|
|
||||||
value_template: >-
|
|
||||||
{{ ["driveway_z1", "Driveway_Paving"] | select("in",
|
|
||||||
after_zones) | list | length > 0 }}
|
|
||||||
alias: Object is in Driveway
|
|
||||||
# This filters out any car objects. This can be removed if not applicable to your use case.
|
|
||||||
- condition: template
|
|
||||||
value_template: '{{ trigger.payload_json["after"]["label"] != "car" }}'
|
|
||||||
action:
|
|
||||||
- choose:
|
|
||||||
- conditions:
|
|
||||||
- condition: trigger
|
|
||||||
id: frigate-event
|
|
||||||
sequence:
|
|
||||||
# Send the initial notification with snapshot and info.
|
|
||||||
- service: script.send_dynamic_notification_to_all_devices
|
|
||||||
data:
|
|
||||||
id: "{{ id }}"
|
|
||||||
title: >-
|
|
||||||
{{ label }} was
|
|
||||||
detected on {{ camera |
|
|
||||||
replace("_", " ") | title }}
|
|
||||||
message: >-
|
|
||||||
{{ label }} detected in
|
|
||||||
the {{ after_zones[0] |
|
|
||||||
replace("_", " ") | title }}
|
|
||||||
notifTag: "{{ id }}"
|
|
||||||
notifIcon: mdi:doorbell-video
|
|
||||||
group: >-
|
|
||||||
frigate-notification-{{ camera }}
|
|
||||||
importance: max
|
|
||||||
image: >-
|
|
||||||
/api/frigate/notifications/{{ id }}/snapshot.jpg
|
|
||||||
clickAction: ''
|
|
||||||
# Wait until the end of the notification has occurred.
|
|
||||||
- repeat:
|
|
||||||
until:
|
|
||||||
- condition: template
|
|
||||||
value_template: '{{ wait.trigger.payload_json["type"] == "end" }}'
|
|
||||||
sequence:
|
|
||||||
- wait_for_trigger:
|
|
||||||
- platform: mqtt
|
|
||||||
topic: homeassistant/events
|
|
||||||
payload: "{{ trigger.payload_json[\"after\"][\"id\"] }}"
|
|
||||||
value_template: "{{ value_json[\"after\"][\"id\"] }}"
|
|
||||||
continue_on_timeout: false
|
|
||||||
timeout: '00:02:00'
|
|
||||||
- condition: template
|
|
||||||
value_template: '{{ wait.trigger.payload_json[''type''] == ''end'' }}'
|
|
||||||
- service: script.send_dynamic_notification_to_all_devices
|
|
||||||
data:
|
|
||||||
id: '{{ id }}'
|
|
||||||
# Uses double take for title and message to include face info if a match is detected.
|
|
||||||
title: >-
|
|
||||||
{% if (wait.trigger.payload_json["after"]["sub_label"] !=
|
|
||||||
None) -%} {{ (wait.trigger.payload_json["after"]["sub_label"])
|
|
||||||
| title }} {%- else -%} {{ label | replace("_", " ") | title
|
|
||||||
}} {%- endif %} was detected in the {{ after_zones[0] |
|
|
||||||
replace("_", " ") | title }}
|
|
||||||
message: Detected with {{ int(score | round(2) * 100) }}% confidence
|
|
||||||
notifTag: '{{ id }}'
|
|
||||||
notifIcon: mdi:doorbell-video
|
|
||||||
group: >-
|
|
||||||
frigate-notification-{{
|
|
||||||
trigger.payload_json["after"]["camera"] }}
|
|
||||||
importance: default
|
|
||||||
image: >-
|
|
||||||
/api/frigate/notifications/{{ id }}/snapshot.jpg
|
|
||||||
video: >-
|
|
||||||
home-assistant.sthome.org/api/{{id}}/{{camera}}/clip.mp4
|
|
||||||
clickAction: >-
|
|
||||||
https://home-assistant.sthome.org/api/frigate/notifications/{{id}}/{{camera}}/clip.mp4
|
|
||||||
default: []
|
|
||||||
mode: parallel
|
|
||||||
max: 10
|
|
||||||
@ -1,24 +0,0 @@
|
|||||||
# NOT WORKING
|
|
||||||
|
|
||||||
# Adding notify to Configuration.yaml file
|
|
||||||
# --------------------------------------------------------
|
|
||||||
# open home-assistant configration.yaml file with nano
|
|
||||||
nano /mnt/SSD1/docker/data/home-assistant/config/configuration.yaml
|
|
||||||
# Add the following lines to the end of the file
|
|
||||||
notify:
|
|
||||||
- platform: androidtv
|
|
||||||
name: Android TV
|
|
||||||
host: nova4k.sthome.org
|
|
||||||
|
|
||||||
# Checking the configuration and restarting home-assistant
|
|
||||||
# --------------------------------------------------------
|
|
||||||
# In home-assistant, go to Developer Tools > YAML and click Check Configuration.
|
|
||||||
# If there are no errors, click Restart to apply the changes.
|
|
||||||
|
|
||||||
# In home-assistant, go to Developer Tools > Services and select the notify service.
|
|
||||||
# In the Service Data field, enter the following JSON:
|
|
||||||
{
|
|
||||||
"message": "Hello from Home Assistant!",
|
|
||||||
"title": "Test Notification",
|
|
||||||
"target": "Android TV"
|
|
||||||
}
|
|
||||||
@ -63,16 +63,6 @@ cp -pr /mnt/stpool1/apps/mosquitto/* /mnt/SSD1/docker/data/mosquitto/config/conf
|
|||||||
chown -R mosquitt:mosquitt /mnt/SSD1/docker/data/mosquitto/
|
chown -R mosquitt:mosquitt /mnt/SSD1/docker/data/mosquitto/
|
||||||
chmod -R 700 /mnt/SSD1/docker/data/mosquitto/
|
chmod -R 700 /mnt/SSD1/docker/data/mosquitto/
|
||||||
|
|
||||||
Creating mosquitto user
|
|
||||||
-----------------------
|
|
||||||
# start mosquitto app with Dockge or issuing "docker compose up -d" in stacks/mosquitto folder
|
|
||||||
# open shell on mosquitto
|
|
||||||
docker exec -it mosquitto-mosquitto-1 sh
|
|
||||||
# enter following line in mosquitto app shell, replacing <username> with the appropriate mosquitto username
|
|
||||||
mosquitto_passwd -c /mosquitto/config/password.txt <username>
|
|
||||||
# enter and confirm the password
|
|
||||||
# exit mosquitto shell
|
|
||||||
|
|
||||||
Test mosquitto
|
Test mosquitto
|
||||||
--------------
|
--------------
|
||||||
# TODO
|
# TODO
|
||||||
|
|||||||
@ -28,7 +28,7 @@ services:
|
|||||||
# tcp services
|
# tcp services
|
||||||
# -------------
|
# -------------
|
||||||
- "traefik.tcp.services.${APPLICATION_NAME}-svc.loadbalancer.server.port=${SERVICE_PORT}"
|
- "traefik.tcp.services.${APPLICATION_NAME}-svc.loadbalancer.server.port=${SERVICE_PORT}"
|
||||||
#- "traefik.tcp.services.${APPLICATION_NAME}-secure-svc.loadbalancer.server.port=${SECURE_SERVICE_PORT}"
|
- "traefik.tcp.services.${APPLICATION_NAME}-secure-svc.loadbalancer.server.port=${SECURE_SERVICE_PORT}"
|
||||||
#
|
#
|
||||||
# tcp routers
|
# tcp routers
|
||||||
# ------------
|
# ------------
|
||||||
@ -48,7 +48,6 @@ services:
|
|||||||
# passthrough tls
|
# passthrough tls
|
||||||
- "traefik.tcp.routers.${APPLICATION_NAME}-secure-rtr.tls.passthrough=true"
|
- "traefik.tcp.routers.${APPLICATION_NAME}-secure-rtr.tls.passthrough=true"
|
||||||
# generate certificates using following certresolver
|
# generate certificates using following certresolver
|
||||||
- "traefik.tcp.routers.${APPLICATION_NAME}-secure-rtr.tls.certresolver=solver-dns"
|
- "traefik.tcp.routers.${APPLICATION_NAME}-secure-rtr.tls.certresolver=sthomeresolver"
|
||||||
# assign svc target to routers
|
# assign svc target to routers
|
||||||
#- "traefik.tcp.routers.${APPLICATION_NAME}-secure-rtr.service=${APPLICATION_NAME}-secure-svc"
|
- "traefik.tcp.routers.${APPLICATION_NAME}-secure-rtr.service=${APPLICATION_NAME}-secure-svc"
|
||||||
- "traefik.tcp.routers.${APPLICATION_NAME}-secure-rtr.service=${APPLICATION_NAME}-svc" # use same svc as non-secure router to avoid issues with certificates on mosquitto
|
|
||||||
|
|||||||
@ -70,10 +70,6 @@ services:
|
|||||||
published: "8883"
|
published: "8883"
|
||||||
protocol: tcp
|
protocol: tcp
|
||||||
mode: host
|
mode: host
|
||||||
- target: 9001 # mosquitto websocket port
|
|
||||||
published: "9001"
|
|
||||||
protocol: tcp
|
|
||||||
mode: host
|
|
||||||
- target: 19132 # minecraft-bedrock port
|
- target: 19132 # minecraft-bedrock port
|
||||||
published: "19132"
|
published: "19132"
|
||||||
protocol: udp
|
protocol: udp
|
||||||
|
|||||||
@ -52,30 +52,45 @@ entryPoints:
|
|||||||
- "10.0.0.0/24"
|
- "10.0.0.0/24"
|
||||||
- "192.168.2.0/24"
|
- "192.168.2.0/24"
|
||||||
- "172.16.0.0/12"
|
- "172.16.0.0/12"
|
||||||
|
|
||||||
wireguard:
|
wireguard:
|
||||||
address: ":51820/udp"
|
address: ":51820/udp"
|
||||||
|
|
||||||
plex:
|
plex:
|
||||||
address: ":32400"
|
address: ":32400"
|
||||||
|
http:
|
||||||
|
redirections:
|
||||||
|
entrypoint:
|
||||||
|
to: websecure
|
||||||
|
scheme: https
|
||||||
|
|
||||||
metrics:
|
metrics:
|
||||||
address: ":8082"
|
address: ":8082"
|
||||||
|
|
||||||
ping:
|
ping:
|
||||||
address: ":8083"
|
address: ":8083"
|
||||||
|
|
||||||
mariadb:
|
mariadb:
|
||||||
address: ":8306"
|
address: ":8306"
|
||||||
|
|
||||||
mysql:
|
mysql:
|
||||||
address: ":9306"
|
address: ":9306"
|
||||||
|
|
||||||
mqtt:
|
mqtt:
|
||||||
address: ":1883"
|
address: ":1883"
|
||||||
|
|
||||||
mqttsecure:
|
mqttsecure:
|
||||||
address: ":8883"
|
address: ":8883"
|
||||||
mqttwebsocket:
|
|
||||||
address: ":9001"
|
|
||||||
mc-bedrock:
|
mc-bedrock:
|
||||||
address: ":19132/udp"
|
address: ":19132/udp"
|
||||||
|
|
||||||
mc-java:
|
mc-java:
|
||||||
address: ":25565/udp"
|
address: ":25565/udp"
|
||||||
|
|
||||||
mc-java-rcon:
|
mc-java-rcon:
|
||||||
address: ":25575"
|
address: ":25575"
|
||||||
|
|
||||||
sftp1:
|
sftp1:
|
||||||
address: ":2022"
|
address: ":2022"
|
||||||
sftp2:
|
sftp2:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user