The problem if I at home I got - not critical notification between 7AM-12AM why?
I cannot figure out the problem
alias: In Home - Someone enter to dangerzone (00-06 Critical)
description: ""
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 }}/{{ value_json['type']}}"
id: frigate-event
condition: []
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: 60
- 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 }}"
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,
'not_home') }}
initial_entered_zones: "{{ trigger.payload_json['after']['entered_zones'] }}"
message: A {{ label }} was detected on the {{ camera_name }} camera.
button_1: View Clip
button_2: View Snapshot
button_3: Silence New Notifications
custom_url: "{{base_url}}/api/frigate/notifications/{{id}}/snapshot.jpg"
icon:
- mdi:home-assistant
- 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 zones|select('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: 83073481c067b87f9df240bc8e2c1d15
domain: mobile_app
type: notify
message: "{{message}}"
data:
tag: "{{ id }}"
group: "{{ camera }}-frigate-notification"
image: >-
/api/frigate/notifications/{{id}}/thumbnail.jpg?format=android
clickAction: >-
{{base_url}}/api/frigate/notifications/{{id}}/{{camera}}/clip.mp4
ttl: "{{ iif(critical, 0, 3600000) }}"
priority: "{{ iif(critical, 'high', 'normal') }}"
notification_icon: "{{icon}}"
url: >-
{{base_url}}/api/frigate/notifications/{{id}}/{{camera}}/clip.mp4
attachment:
url: >-
/api/frigate/notifications/{{id}}/thumbnail.jpg
push:
sound: "{{sound}}"
interruption-level: "{{ iif(critical, 'critical', 'active') }}"
actions:
- action: URI
title: "{{button_1}}"
uri: >-
{{base_url}}/api/frigate/notifications/{{id}}/{{camera}}/clip.mp4
- action: URI
title: "{{button_2}}"
uri: "{{custom_url}}"
- action: silence-{{ camera }}
title: "{{button_3}}"
destructive: true
default:
- service: notify.{{ group_target }}
data:
message: "{{message}}"
data:
tag: "{{ id }}"
group: "{{ camera }}-frigate-notification"
image: >-
/api/frigate/notifications/{{id}}/thumbnail.jpg?format=android
clickAction: >-
{{base_url}}/api/frigate/notifications/{{id}}/{{camera}}/clip.mp4
ttl: "{{ iif(critical, 0, 3600000) }}"
priority: "{{ iif(critical, 'high', 'normal') }}"
notification_icon: "{{icon}}"
url: >-
{{base_url}}/api/frigate/notifications/{{id}}/{{camera}}/clip.mp4
attachment:
url: /api/frigate/notifications/{{id}}/thumbnail.jpg
push:
sound: "{{sound}}"
interruption-level: "{{ iif(critical, 'critical', 'active') }}"
actions:
- action: URI
title: "{{button_1}}"
uri: >-
{{base_url}}/api/frigate/notifications/{{id}}/{{camera}}/clip.mp4
- action: URI
title: "{{button_2}}"
uri: "{{custom_url}}"
- action: silence-{{ camera }}
title: "{{button_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,
'not_home') }}
presence_changed: >-
{{ presence_entity != '' and
as_datetime(event['before']['frame_time']) <
states[presence_entity].last_changed }}
last_zones: "{{ event['before']['entered_zones'] }}"
entered_zones: "{{ event['after']['entered_zones'] }}"
zone_filter: >-
{{ not zone_only or zones|select('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
}}
update: >-
{{ alert_once or (new_snapshot and not loitering and not
presence_changed and not zone_only_changed and not
entered_zones_changed) }}
- alias: Notify on loitering or significant change
choose:
- conditions: >-
{{ loitering or (not home and zone_filter and state_true
and (new_snapshot or presence_changed or
stationary_moved or zone_only_changed or
entered_zones_changed)) }}
sequence:
- choose:
- conditions: "{{ not group_target }}"
sequence:
- device_id: 83073481c067b87f9df240bc8e2c1d15
domain: mobile_app
type: notify
message: "{{message}}"
data:
tag: "{{ id }}{{'-loitering' if loitering}}"
group: >-
{{ camera
}}-frigate-notification{{'-loitering' if
loitering}}
image: >-
/api/frigate/notifications/{{id}}/thumbnail.jpg?format=android
clickAction: >-
{{base_url}}/api/frigate/notifications/{{id}}/{{camera}}/clip.mp4
ttl: "{{ iif(critical, 0, 3600000) }}"
priority: "{{ iif(critical, 'high', 'normal') }}"
alert_once: "{{ alert_once }}"
notification_icon: "{{icon}}"
url: >-
{{base_url}}/api/frigate/notifications/{{id}}/{{camera}}/clip.mp4
attachment:
url: >-
/api/frigate/notifications/{{id}}/thumbnail.jpg
push:
sound:
name: "{{ iif(update, 'none', sound) }}"
interruption-level: >-
{{ iif(critical, 'critical', 'active')
}}
actions:
- action: URI
title: "{{button_1}}"
uri: >-
{{base_url}}/api/frigate/notifications/{{id}}/{{camera}}/clip.mp4
- action: URI
title: "{{button_2}}"
uri: "{{custom_url}}"
- action: silence-{{ camera }}
title: "{{button_3}}"
destructive: true
default:
- service: notify.{{ group_target }}
data:
message: "{{message}}"
data:
tag: "{{ id }}{{'-loitering' if loitering}}"
group: >-
{{ camera
}}-frigate-notification{{'-loitering' if
loitering}}
image: >-
/api/frigate/notifications/{{id}}/thumbnail.jpg?format=android
clickAction: >-
{{base_url}}/api/frigate/notifications/{{id}}/{{camera}}/clip.mp4
ttl: "{{ iif(critical, 0, 3600000) }}"
priority: "{{ iif(critical, 'high', 'normal') }}"
alert_once: "{{ alert_once }}"
notification_icon: "{{icon}}"
url: >-
{{base_url}}/api/frigate/notifications/{{id}}/{{camera}}/clip.mp4
attachment:
url: >-
/api/frigate/notifications/{{id}}/thumbnail.jpg
push:
sound:
name: "{{ iif(update, 'none', sound) }}"
interruption-level: "{{ iif(critical, 'critical', 'active') }}"
actions:
- action: URI
title: "{{button_1}}"
uri: >-
{{base_url}}/api/frigate/notifications/{{id}}/{{camera}}/clip.mp4
- action: URI
title: "{{button_2}}"
uri: "{{custom_url}}"
- action: silence-{{ camera }}
title: "{{button_3}}"
destructive: true
until: >-
{{ not wait.trigger or wait.trigger.payload_json['type'] ==
'end' }}
mode: parallel
trigger_variables:
input_camera: camera.gardentwo
camera: "{{ input_camera | replace('camera.', '') }}"
variables:
input_camera: camera.gardentwo
camera: "{{ input_camera | replace('camera.', '') }}"
camera_name: "{{ camera | replace('_', ' ') | title }}"
base_url: https://abc.com:8123
critical_input: >-
{{'false' if now().hour in
[7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,0] else 'true'}}
critical: "{{true if critical_input == 'true' else false}}"
alert_once: true
update_thumbnail: true
group_target: ""
zone_only: true
input_zones:
- zone_danger
zones: "{{ input_zones | list }}"
input_labels:
- person
- cat
- dog
labels: "{{ input_labels | list }}"
presence_entity: device_tracker.testiphonetest
disable_times: []
cooldown: 150
loiter_timer: 150
fps: "{{ states('sensor.' + camera + '_camera_fps')|int(5) }}"
state_only: false
input_entity: ""
input_states: []
states_filter: "{{ input_states | list }}"
sound: default