Is there something I’m missing for setting the base_url? I have it set to: https://myurlstring.ui.nabu.casa/
, but I get “Cannot complete request” in firefox when i click ‘view snapshot’ from the notifcation.
No, copy the link and try it in any browser. Does it work? If not, you have an access issue
Looks like nabu casa was disconnected . Thank you!
Hi Just tried you Bluebrind. Works god so far but i cant get the Zone Filter Working.
I have 2 Cams with Zones named “Fri-Garten_Zone0” and Fri-Haustuer_Zone0" in the Config.
When i enter the Names in the Blueprint it doesn’t seem to work.
Frigate recognized me in Zone0 but i haven’t received a notification
Please try the beta version if not already and also post the automation config.
i’am at a los. thought maybe the naming of the photo’s was wrong but that was not the case.it still choosing no action.
to bad really wanted this blueprint te work.i’am afraid i have to figure out a different solution to get a notification on my phone and tv
I removed the _2, but still no notification.
alias: Frigate Notifications
description: ""
use_blueprint:
path: SgtBatten/Stable.yaml
input:
camera: camera.r4252_smart_outdoor_camera
notify_device: 1336b603037d01a61d6de3e445a6xxxx
message: Un mouvement a été détecté dehors
attachment: snapshot
update_thumbnail: false
mode: parallel
trigger_variables:
input_camera: camera.r4252_smart_outdoor_camera
camera: '{{ input_camera | replace(''camera.'', '''') }}'
trigger:
- platform: event
event_type: mobile_app_notification_action
event_data:
action: silence-{{ camera }}
id: silence
- platform: mqtt
topic: frigate/events
payload: '{{ camera }}/new'
value_template: >-
{{ value_json['after']['camera'] | lower | replace('-','_') }}/{{
value_json['type']}}
id: frigate-event
variables:
input_camera: camera.r4252_smart_outdoor_camera
camera: '{{ input_camera | replace(''camera.'', '''') }}'
camera_name: '{{ camera | replace(''_'', '' '') | title }}'
input_base_url: ''
base_url: '{{ input_base_url.rstrip(''/'')}}'
attachment: snapshot
critical_input: 'false'
critical: '{{ true if critical_input == ''true'' else false }}'
alert_once: false
update_thumbnail: false
ios_live_view: false
group: ''
group_target: '{{ group | lower | replace(''notify.'', '''') | replace('' '',''_'') }}'
zone_only: false
input_zones: []
zones: '{{ input_zones | list | lower }}'
zone_multi: false
input_labels: ''
labels: '{{ input_labels | list | lower }}'
presence_entity: ''
disable_times: []
cooldown: 30
loitering: false
loiter_timer: 0
fps: '{{ states(''sensor.'' + camera + ''_camera_fps'')|int(5) }}'
state_only: false
input_entity: ''
input_states: []
states_filter: '{{ input_states | list | lower }}'
color: steelblue
sound: default
tv: false
tv_position: center
tv_size: large
tv_duration: 10
tv_transparency: 0%
tv_interrupt: false
debug: false
action:
- choose:
- alias: Silence New Object Notifications
conditions:
- condition: trigger
id: silence
sequence:
- service: automation.turn_off
target:
entity_id: '{{ this.entity_id }}'
data:
stop_actions: false
- delay:
minutes: 30
- service: automation.turn_on
target:
entity_id: '{{ this.entity_id }}'
- alias: Frigate Event
conditions:
- condition: trigger
id: frigate-event
- '{{ is_state(this.entity_id, ''on'') }}'
- >-
{{ not this.attributes.last_triggered or (now() -
this.attributes.last_triggered).seconds > cooldown }}
- >-
{{ not disable_times|length or not now().hour in
disable_times|map('int')|list }}
sequence:
- variables:
id: '{{ trigger.payload_json[''after''][''id''] }}'
object: '{{ trigger.payload_json[''after''][''label''] }}'
label: '{{ object | title }}'
initial_home: >-
{{ presence_entity != '' and is_state(presence_entity, 'home')
}}
initial_entered_zones: '{{ trigger.payload_json[''after''][''entered_zones''] |lower}}'
zone_multi_filter: >-
{{zone_only and zone_multi and initial_entered_zones|length and
zones and zones |reject('in', initial_entered_zones) |list
|length == 0 }}
title: ''
message: Un mouvement a été détecté dehors
tap_action: >-
{{base_url}}/api/frigate/notifications/{{id}}/{{camera}}/clip.mp4
button_1: View Clip
button_2: View Snapshot
button_3: Silence New Notifications
url_1: >-
{{base_url}}/api/frigate/notifications/{{id}}/{{camera}}/clip.mp4
url_2: '{{base_url}}/api/frigate/notifications/{{id}}/snapshot.jpg'
url_3: silence-{{ camera }}
icon: mdi:home-assistant
channel: ''
- alias: 'Debug: write to Log'
choose:
- conditions:
- '{{debug}}'
sequence:
- service: logbook.log
data_template:
name: Frigate Notification
message: |
DEBUG:
Info:
fps: {{fps}},
frigate event id: {{id}},
object (formatted): {{object}} ({{label}}),
Config:
camera(formatted): {{camera}}({{camera_name}}),
Base URL: {{base_url}},
critical: {{critical}},
alert once: {{alert_once}},
Update Thumbnails: {{update_thumbnail}},
Target: {{'group (input/formatted): ' + group + '/' + group_target + ', ' if group else 'Mobile Device'}}
cooldown: {{cooldown}}s,
loiter timer: {{loiter_timer}}s,
color: {{color}},
sound: {{sound}},
Title: {{title}},
Message: {{message}},
tap_action: {{tap_action}},
button 1 Text/URL: {{iif(button_1, button_1, 'unset')}} ({{url_1}}),
button 2 Text/URL: {{button_2}} ({{url_2}}),
button 3 Text/URL: {{button_3}} ({{url_3}}),
icon: {{icon}}
tv: {{tv}},
tv_position: {{tv_position}},
tv_size: {{tv_size}},
tv_duration: {{tv_duration}},
tv_transparency: {{tv_transparency}},
tv_interrupt: {{tv_interrupt}},
Filters:
Zones:
zone filter toggle on: {{zone_only}},
Multi Zone toggle on: {{zone_multi}},
Required zones: {{input_zones}},
Entered Zones: {{initial_entered_zones}},
Zone Filter TEST: {{'PASS (Multi)' if zone_multi_filter else 'PASS' if ( not zone_only or not zone_multi and zones|select('in', initial_entered_zones)|list|length ) else 'FAIL (Multi)' if zone_multi else 'FAIL' }},
Required objects TEST:
Input: {{input_labels}},
TEST: {{'PASS' if not labels|length or object in labels else 'FAIL'}}
presence entity (not home):
Entity: {{presence_entity}}
TEST: {{'PASS' if not initial_home else 'FAIL'}},
disabled times: {{disable_times}},
State Filter:
state filter toggle on: {{state_only}},
state filter entity: {{input_entity}},
required states: {{input_states}},
State Filter TEST: {{'PASS' if not state_only or states(input_entity) in states_filter else 'FAIL' }},
- alias: Notifications enabled for object label
condition: template
value_template: '{{ not labels|length or object in labels }}'
- alias: Notify on new object
choose:
- conditions:
- >-
{{ not zone_only or (not zone_multi and zones|select('in',
initial_entered_zones)|list|length > 0) or (zone_multi and
initial_entered_zones|length > 0 and zones |reject('in',
initial_entered_zones) |list |length == 0) }}
- '{{ not initial_home }}'
- >-
{{ not state_only or states(input_entity) in states_filter
}}
sequence:
- choose:
- conditions: '{{ not group_target }}'
sequence:
- device_id: 1336b603037d01a61d6de3e445a6xxxx
domain: mobile_app
type: notify
title: '{{title}}'
message: '{{message}}'
data:
tag: '{{ id }}'
group: '{{ camera }}-frigate-notification'
color: '{{color}}'
image: >-
/api/frigate/notifications/{{id}}/{{attachment}}.jpg?format=android
clickAction: '{{tap_action}}'
ttl: '{{ iif(critical, 0, 3600000) }}'
priority: '{{ iif(critical, ''high'', ''normal'') }}'
notification_icon: '{{icon}}'
channel: '{{channel}}'
url: '{{tap_action}}'
attachment:
url: >-
/api/frigate/notifications/{{id}}/{{attachment}}.jpg
push:
sound: '{{sound}}'
interruption-level: '{{ iif(critical, ''critical'', ''active'') }}'
entity_id: '{{ iif(ios_live_view, input_camera, '''' ) }}'
actions:
- action: URI
title: '{{button_1}}'
uri: '{{url_1}}'
- action: URI
title: '{{button_2}}'
uri: '{{url_2}}'
- action: '{{ ''URI'' if ''/'' in url_3 else url_3 }}'
title: '{{button_3}}'
uri: '{{url_3}}'
destructive: true
- conditions: '{{ tv }}'
sequence:
- service: notify.{{ group_target }}
data:
title: '{{title}}'
message: '{{message}}'
data:
tag: '{{ id }}'
group: '{{ camera }}-frigate-notification'
color: '{{color}}'
clickAction: '{{tap_action}}'
ttl: '{{ iif(critical, 0, 3600000) }}'
priority: '{{ iif(critical, ''high'', ''normal'') }}'
notification_icon: '{{icon}}'
channel: '{{channel}}'
image:
url: >-
{{base_url}}/api/frigate/notifications/{{id}}/snapshot.jpg
fontsize: '{{tv_size}}'
position: '{{tv_position}}'
duration: '{{tv_duration}}'
transparency: '{{tv_transparency}}'
interrupt: '{{tv_interrupt}}'
timeout: 30
url: '{{tap_action}}'
attachment:
url: >-
/api/frigate/notifications/{{id}}/{{attachment}}.jpg
push:
sound: '{{sound}}'
interruption-level: '{{ iif(critical, ''critical'', ''active'') }}'
entity_id: '{{ iif(ios_live_view, input_camera, '''' ) }}'
actions:
- action: URI
title: '{{button_1}}'
uri: '{{url_1}}'
- action: URI
title: '{{button_2}}'
uri: '{{url_2}}'
- action: '{{ ''URI'' if ''/'' in url_3 else url_3 }}'
title: '{{button_3}}'
uri: '{{url_3}}'
destructive: true
default:
- service: notify.{{ group_target }}
data:
title: '{{title}}'
message: '{{message}}'
data:
tag: '{{ id }}{{''-loitering'' if loitering}}'
group: >-
{{ camera }}-frigate-notification{{'-loitering' if
loitering}}
color: '{{color}}'
image: >-
/api/frigate/notifications/{{id}}/{{attachment}}.jpg?format=android
clickAction: '{{tap_action}}'
ttl: '{{ iif(critical, 0, 3600000) }}'
priority: '{{ iif(critical, ''high'', ''normal'') }}'
notification_icon: '{{icon}}'
channel: '{{channel}}'
fontsize: '{{tv_size}}'
position: '{{tv_position}}'
duration: '{{tv_duration}}'
transparency: '{{tv_transparency}}'
interrupt: '{{tv_interrupt}}'
url: '{{tap_action}}'
attachment:
url: >-
/api/frigate/notifications/{{id}}/{{attachment}}.jpg
push:
sound: '{{sound}}'
interruption-level: '{{ iif(critical, ''critical'', ''active'') }}'
entity_id: '{{ iif(ios_live_view, input_camera, '''' ) }}'
actions:
- action: URI
title: '{{button_1}}'
uri: '{{url_1}}'
- action: URI
title: '{{button_2}}'
uri: '{{url_2}}'
- action: '{{ ''URI'' if ''/'' in url_3 else url_3 }}'
title: '{{button_3}}'
uri: '{{url_3}}'
destructive: true
- repeat:
sequence:
- wait_for_trigger:
- platform: mqtt
topic: frigate/events
payload: '{{ id }}'
value_template: '{{ value_json[''after''][''id''] }}'
timeout:
minutes: 2
continue_on_timeout: false
- variables:
event: '{{ wait.trigger.payload_json }}'
loitering: >-
{{ loiter_timer and
event['before']['motionless_count']/fps/60 < loiter_timer
and event['after']['motionless_count']/fps/60 >=
loiter_timer }}
new_snapshot: >-
{{ update_thumbnail and event['before']['snapshot_time']
!= event['after']['snapshot_time'] }}
home: >-
{{ presence_entity != '' and is_state(presence_entity,
'home') }}
presence_changed: >-
{{ presence_entity != '' and
as_datetime(event['before']['frame_time']) <
states[presence_entity].last_changed }}
last_zones: '{{ event[''before''][''entered_zones''] |lower}}'
entered_zones: '{{ event[''after''][''entered_zones''] |lower}}'
zone_filter: >-
{{ not zone_only or zones|select('in',
entered_zones)|list|length > 0 }}
zone_multi_filter: >-
{{not zone_only or not zone_multi or (
entered_zones|list|length > 0 and zones and
zones|reject('in', entered_zones)|list|length == 0 ) }}
stationary_moved: >-
{{ event['after']['position_changes'] >
event['before']['position_changes'] }}
zone_only_changed: >-
{{ zone_only and (entered_zones|length > 0 and not
last_zones|length) }}
entered_zones_changed: >-
{{ zones|length > 0 and (zones|select('in',
entered_zones)|list|length > 0 and not zones|select('in',
last_zones)|list|length) }}
state_true: >-
{{ not state_only or states(input_entity) in states_filter
}}
sub_label: '{{ event[''after''][''sub_label'']}}'
sub_label_changed: '{{ sub_label != event[''before''][''sub_label''] }}'
update: >-
{{ alert_once or (new_snapshot and not loitering and not
presence_changed and not zone_only_changed and not
entered_zones_changed and not sub_label_changed) }}
title: |
{% if sub_label %}
{{title | replace('A Person', sub_label|title) | replace('Person', sub_label|title)}}
{%else%}
{{title}}
{%endif%}
message: |
{% if sub_label %}
{{message | replace('A Person', sub_label|title) | replace('Person', sub_label|title)}}
{%else%}
{{message}}
{%endif%}
- alias: 'Debug: write to Log'
choose:
- conditions:
- '{{debug}}'
sequence:
- service: logbook.log
data_template:
name: Frigate Notification
message: |
DEBUG (in loop):
Info:
Last Zones: {{last_zones}},
Current zones: {{entered_zones}},
sublabel: {{sub_label}},
iOS sound: {{update if not critical else 'yes due critical notifications'}},
Android Sound: {{'disabled by alert once' if alert_once else 'enabled'}},
Triggers:
New Snapshot: {{new_snapshot}},
Presence Changed: {{presence_changed}},
stationary moved: {{stationary_moved}},
entered zones changed: {{entered_zones_changed}},
sublabel changed: {{sub_label_changed}},
Conditions:
Loitering: {{loitering}}
or
Presence Entity not home: {{'ON' if presence_entity != '' else 'OFF'}} - {{'PASS' if not home else 'FAIL'}},
zone filter TEST: {{'ON' if zone_only else 'OFF'}} - {{'PASS' if zone_filter else 'FAIL'}},
multi-zone filter: {{'OFF' if not zone_only or not zone_multi else 'ON'}} - {{'PASS' if not zone_only or not zone_multi or ( entered_zones|length and zones and zones |reject('in', entered_zones) |list |length == 0 ) else 'FAIL'}},
state filter TEST: {{'ON' if state_only else 'OFF'}} - {{'PASS' if state_true else 'FAIL'}}
image: "/api/frigate/notifications/{{id}}/{{attachment}}.jpg"
- alias: Notify on loitering or significant change
choose:
- conditions: >-
{{ loitering or (not home and zone_filter and
zone_multi_filter and state_true and (new_snapshot or
presence_changed or stationary_moved or
zone_only_changed or entered_zones_changed or
sub_label_changed)) }}
sequence:
- choose:
- conditions: '{{ not group_target }}'
sequence:
- device_id: 1336b603037d01a61d6de3e445a6xxxx
domain: mobile_app
type: notify
title: '{{title}}'
message: '{{message}}'
data:
tag: '{{ id }}{{''-loitering'' if loitering}}'
group: >-
{{ camera
}}-frigate-notification{{'-loitering' if
loitering}}
color: '{{color}}'
image: >-
/api/frigate/notifications/{{id}}/{{attachment}}.jpg?format=android
clickAction: '{{tap_action}}'
ttl: '{{ iif(critical, 0, 3600000) }}'
priority: '{{ iif(critical, ''high'', ''normal'') }}'
alert_once: '{{ alert_once }}'
notification_icon: '{{icon}}'
channel: '{{channel}}'
url: '{{tap_action}}'
attachment:
url: >-
/api/frigate/notifications/{{id}}/{{attachment}}.jpg
push:
sound: '{{ iif(update, ''none'', sound) }}'
interruption-level: >-
{{ iif(critical, 'critical', 'active')
}}
entity_id: >-
{{ iif(ios_live_view, input_camera, '' )
}}
actions:
- action: URI
title: '{{button_1}}'
uri: '{{url_1}}'
- action: URI
title: '{{button_2}}'
uri: '{{url_2}}'
- action: '{{ ''URI'' if ''/'' in url_3 else url_3 }}'
title: '{{button_3}}'
uri: '{{url_3}}'
destructive: true
- conditions: '{{ tv }}'
sequence:
- service: notify.{{ group_target }}
data:
title: '{{title}}'
message: '{{message}}'
data:
tag: '{{ id }}{{''-loitering'' if loitering}}'
group: >-
{{ camera
}}-frigate-notification{{'-loitering' if
loitering}}
color: '{{color}}'
clickAction: '{{tap_action}}'
ttl: '{{ iif(critical, 0, 3600000) }}'
priority: '{{ iif(critical, ''high'', ''normal'') }}'
alert_once: '{{ alert_once }}'
notification_icon: '{{icon}}'
channel: '{{channel}}'
image:
url: >-
{{base_url}}/api/frigate/notifications/{{id}}/snapshot.jpg
fontsize: '{{tv_size}}'
position: '{{tv_position}}'
duration: '{{tv_duration}}'
transparency: '{{tv_transparency}}'
interrupt: '{{tv_interrupt}}'
timeout: 30
url: '{{tap_action}}'
attachment:
url: >-
/api/frigate/notifications/{{id}}/{{attachment}}.jpg
push:
sound: '{{ iif(update, ''none'', sound) }}'
interruption-level: >-
{{ iif(critical, 'critical', 'active')
}}
entity_id: >-
{{ iif(ios_live_view, input_camera, '' )
}}
actions:
- action: URI
title: '{{button_1}}'
uri: '{{url_1}}'
- action: URI
title: '{{button_2}}'
uri: '{{url_2}}'
- action: '{{ ''URI'' if ''/'' in url_3 else url_3 }}'
title: '{{button_3}}'
uri: '{{url_3}}'
destructive: true
default:
- service: notify.{{ group_target }}
data:
title: '{{title}}'
message: '{{message}}'
data:
tag: '{{ id }}{{''-loitering'' if loitering}}'
group: >-
{{ camera
}}-frigate-notification{{'-loitering' if
loitering}}
color: '{{color}}'
image: >-
/api/frigate/notifications/{{id}}/{{attachment}}.jpg?format=android
clickAction: '{{tap_action}}'
ttl: '{{ iif(critical, 0, 3600000) }}'
priority: '{{ iif(critical, ''high'', ''normal'') }}'
alert_once: '{{ alert_once }}'
notification_icon: '{{icon}}'
channel: '{{channel}}'
fontsize: '{{tv_size}}'
position: '{{tv_position}}'
duration: '{{tv_duration}}'
transparency: '{{tv_transparency}}'
interrupt: '{{tv_interrupt}}'
url: '{{tap_action}}'
attachment:
url: >-
/api/frigate/notifications/{{id}}/{{attachment}}.jpg
push:
sound: '{{ iif(update, ''none'', sound) }}'
interruption-level: '{{ iif(critical, ''critical'', ''active'') }}'
entity_id: '{{ iif(ios_live_view, input_camera, '''' ) }}'
actions:
- action: URI
title: '{{button_1}}'
uri: '{{url_1}}'
- action: URI
title: '{{button_2}}'
uri: '{{url_2}}'
- action: '{{ ''URI'' if ''/'' in url_3 else url_3 }}'
title: '{{button_3}}'
uri: '{{url_3}}'
destructive: true
until: >-
{{ not wait.trigger or wait.trigger.payload_json['type'] ==
'end' }}
id: '1714482324845'
alias: Frigate Notifications
description: ''
You triggered it manually. It won’t work. You need to send a fake Mqtt message or just walk out in front of the camera
I walk, but nothing it’s triggered.
I think cause may be from mqtt, here my frigate config:
## Connection à MQTT ##
mqtt:
enabled: false
#cameras:
# dummy_camera: # <--- this will be changed to your actual camera later
# enabled: False
# ffmpeg:
# inputs:
# - path: rtsp://127.0.0.1:554/rtsp
# roles:
# - detect
# /config/frigate.yaml
## Choix des caméras ##
go2rtc:
streams:
r4252_smart_outdoor_camera:
- echo:bash /config/custom_components/expose_camera_stream_source/get_stream.sh
camera.r4252_smart_outdoor_camera
## Liste des caméras avec leurs adresses de connection ##
cameras:
r4252_smart_outdoor_camera:
ffmpeg:
inputs:
- path: rtsp://127.0.0.1:8554/r4252_smart_outdoor_camera?video
input_args: preset-rtsp-restream-low-latency
roles:
- detect
# motion: ## Création des zones à ignorer ##
# mask:
# - 0,461,3,0,1919,0,1919,843,1699,492,1344,458,1346,336,973,317,869,375,866,432
## Choix des options de détection et d'enregistrement ##
motion:
mask:
- 262,0,259,36,32,38,31,0
record:
enabled: true
retain:
days: 7
mode: motion
events:
retain:
default: 30
# mode: motion ## Conserve les vidéos avec mouvements seulement ##
mode: active_objects ## Conserve les vidéos avec détection d'objets ##
objects:
dog: 2 ## Durée de conservation par objets ##
cat: 2
person: 7
#detect:
# stationary:
# Optional: Frequency for confirming stationary objects (default: same as threshold)
# When set to 1, object detection will run to confirm the object still exists on every frame.
# If set to 10, object detection will run to confirm the object still exists on every 10th frame.
# interval: 50
# Optional: Number of frames without a position change for an object to be considered stationary (default: 10x the frame rate or 10s)
# threshold: 50
# Optional: Define a maximum number of frames for tracking a stationary object (default: not set, track forever)
# This can help with false positives for objects that should only be stationary for a limited amount of time.
# It can also be used to disable stationary object tracking. For example, you may want to set a value for person, but leave
# car at the default.
# WARNING: Setting these values overrides default behavior and disables stationary object tracking.
# There are very few situations where you would want it disabled. It is NOT recommended to
# copy these values from the example config into your config unless you know they are needed.
# Optional: Object configuration
# NOTE: Can be overridden at the camera level
objects:
# Optional: list of objects to track from labelmap.txt (default: shown below)
track:
- person
- dog
- cat
# Optional: mask to prevent all object types from being detected in certain areas (default: no mask)
# Checks based on the bottom center of the bounding box of the object.
# NOTE: This mask is COMBINED with the object type specific mask below
# mask: 0,0,1000,0,1000,200,0,200
# Optional: filters to reduce false positives for specific object types
# filters:
# person:
# Optional: minimum width*height of the bounding box for the detected object (default: 0)
# min_area: 5000
# Optional: maximum width*height of the bounding box for the detected object (default: 24000000)
# max_area: 100000
# Optional: minimum width/height of the bounding box for the detected object (default: 0)
# min_ratio: 0.5
# Optional: maximum width/height of the bounding box for the detected object (default: 24000000)
# max_ratio: 2.0
# Optional: minimum score for the object to initiate tracking (default: shown below)
# min_score: 0.5
# Optional: minimum decimal percentage for tracked object's computed score to be considered a true positive (default: shown below)
# threshold: 0.7
# Optional: mask to prevent this object type from being detected in certain areas (default: no mask)
# Checks based on the bottom center of the bounding box of the object
# mask: 0,0,1000,0,1000,200,0,200
snapshots:
enabled: true
I’ve events from Frigate
Mine was the beta, but you still have the box in the middle of step 3, just below where it goes to the right.
Ahh yeah, this is an issue.
Yes, that says the very first check failed. It was not triggered by a frigate Mqtt event. So how was it triggered? Did you trigger it manually?1
No this trigger from walking in front of the camera.
When i listen voor the mqtt on frigate/events i can see al the things that are send and that look good to me.
I turned off al the options.i can show my config of frigate when i get home,maybe i need to change something there.
Are you sure every trace is like this? Can you store more traces and check back further?
The details for your Mqtt broker/server.
I add mqtt broker info. But we can’t add like !secret mqtt_user.
Thanks for your help.