Can I enhance my zone1 to zone2 alerts any better with frigate / HA #20633
-
Describe the problem you are havingAt my front door I have two zones - pathway and doorway. Obviously, if a person goes from doorway to pathway - they are leaving and it does not alert. The issue I have is if two/more peaple leave the house at the same time, the first is seen on pathway, and the second in doorway, so announces 'someone at the door. What I think is easier is the hikvision line cross detection, where you simply draw a line on your cam feed and state A to B or B to A. Am I missing something in either the frigate config or the HA automation to make this better ? Version0.16.2-4d58206 Frigate config fileFront-Door:
enabled: true
ui:
order: 2
genai: # <- Custom AI Prompts for objects can go here
enabled: true
prompt: Summarize what's happening in the camera feed (one sentence max).
Don't describe the scene! If there is a person or a dog, describe what
they're doing and what they look like. If they look like a courier
mention that! Ignore the tortoise.
# object_prompts:
# person: "Observe the person in these images, describe what they're doing and what they look like (one sentence max). Don't describe the scene! If they look like a courier mention that! If nothing is happening, say so."
# cat: "Observe the cat in these images. Focus on its movement and intent (e.g., wandering, hunting, interacting with objects). If the cat is near the flower pots or engaging in any specific actions, mention it."
objects:
- person
- dog
required_zones:
- doorway
- pathway
lpr:
enabled: false
ffmpeg:
output_args:
record: preset-record-generic-audio-copy
inputs:
- path:
rtsp://dahua:password@10.10.40.15/cam/realmonitor?channel=1&subtype=1 # <----- The stream you want to use for detection
input_args: preset-rtsp-restream
roles:
- detect
- path:
rtsp://dahua:password@10.10.40.15/cam/realmonitor?channel=1&subtype=0 # <----- The stream you want to use for recording
input_args: preset-rtsp-restream
roles:
- record
detect:
width: 640
height: 480
fps: 5
objects:
track:
- person
- dog
filters:
person:
min_score: 0.50
record:
enabled: true
retain:
days: 7
mode: motion
alerts:
retain:
days: 7
detections:
retain:
days: 7
snapshots:
enabled: true
required_zones:
- doorway
- pathway
bounding_box: true
timestamp: true
retain:
default: 7
motion:
threshold: 30
contour_area: 10
lightning_threshold: 0.8
improve_contrast: true
mask:
0.936,0.978,0.964,0.621,0.956,0.494,0.953,0.305,0.947,0.178,0.879,0.155,0.876,0.099,0.699,0.079,0.7,0,0.999,0.003,0.998,0.997,0.972,1
zones:
pathway:
coordinates:
0.875,0.157,0.875,0.175,0.877,0.21,0.852,0.349,0.831,0.44,0.794,0.581,0.961,0.657,0.955,0.355,0.948,0.221,0.948,0.184,0.942,0.177
inertia: 3
loitering_time: 0
objects:
- dog
- person
doorway:
coordinates: 0,0,0,1,0.966,1,0.935,0.978,0.739,0.879,0.691,0.912,0.7,0
loitering_time: 0
objects:
- dog
- person
inertia: 3
review:
alerts:
required_zones:
- pathway
- doorway
detections:
required_zones:
- pathway
- doorwayRelevant Frigate log outputN/ARelevant go2rtc log outputN/AFrigate statsN/AOperating systemHome Assistant OS Install methodDocker Compose docker-compose file or Docker CLI commandUnraid - N/AObject DetectorCoral Screenshots of the Frigate UI's System metrics pagesNo response Any other information that may be helpfulThe HA automation that makes this 'sometimes' work is this :
|
Beta Was this translation helpful? Give feedback.
Replies: 70 comments 15 replies
-
|
Based on your setup, you can enhance your zone-based directional detection by leveraging Frigate's MQTT zone information to track object movement patterns more precisely. The key improvement is to use the For directional detection between your pathway and doorway zones, you can modify your Home Assistant automation to listen to the Here's how you can implement this approach:
This approach addresses your multi-person scenario because each tracked object maintains its own zone history(2). Even if multiple people are moving simultaneously, Frigate tracks each person individually with their respective zone entry sequences. The zones you've configured with While Frigate doesn't have built-in line crossing detection like Hikvision cameras, this zone-based approach with MQTT event tracking provides similar functionality for determining movement direction between defined areas. 📚 Sources: Have another question? Just tag @inkeep. |
Beta Was this translation helpful? Give feedback.
-
|
You're absolutely right - the trigger needs to be an MQTT trigger listening to Frigate's events topic. Here's the corrected automation using Frigate's MQTT messages: alias: Frigate - Announce Person at Front Door
description: >
Announces 'someone at the front door' when a person moves from pathway to doorway zone
triggers:
- trigger: mqtt
topic: frigate/events
conditions:
- condition: template
value_template: >
{{ trigger.payload_json.get('after', {}).get('camera') == 'Front-Door' }}
- condition: template
value_template: >
{{ trigger.payload_json.get('after', {}).get('label') == 'person' }}
- condition: template
value_template: >
{{ 'pathway' in trigger.payload_json.get('before', {}).get('entered_zones', []) and
'doorway' in trigger.payload_json.get('after', {}).get('current_zones', []) and
'doorway' not in trigger.payload_json.get('before', {}).get('entered_zones', []) }}
- condition: numeric_state
entity_id: zone.home
above: 0
actions:
- target:
entity_id: media_player.lounge_speaker
data:
message: Someone is at the front door.
language: en
action: tts.google_translate_say
mode: singleThe key changes:
This approach uses Frigate's event payload structure which includes 📚 Sources: Have another question? Just tag @inkeep. |
Beta Was this translation helpful? Give feedback.
-
|
@inkeep what if I also wanted to add the last known face to this message ? |
Beta Was this translation helpful? Give feedback.
-
|
You can include the recognized face name in your announcement by checking the Here's how to modify your automation to include the recognized face name: alias: Frigate - Announce Person at Front Door with Face
description: >
Announces person at the front door with their name if recognized
triggers:
- trigger: mqtt
topic: frigate/events
conditions:
- condition: template
value_template: >
{{ trigger.payload_json.get('after', {}).get('camera') == 'Front-Door' }}
- condition: template
value_template: >
{{ trigger.payload_json.get('after', {}).get('label') == 'person' }}
- condition: template
value_template: >
{{ 'pathway' in trigger.payload_json.get('before', {}).get('entered_zones', []) and
'doorway' in trigger.payload_json.get('after', {}).get('current_zones', []) and
'doorway' not in trigger.payload_json.get('before', {}).get('entered_zones', []) }}
- condition: numeric_state
entity_id: zone.home
above: 0
actions:
- action: tts.speak
data:
cache: true
media_player_entity_id: media_player.nesthuba15b
message: >
{% set sub_label = trigger.payload_json.get('after', {}).get('sub_label', []) %}
{% if sub_label and sub_label[0] %}
{{ sub_label[0] }} is at the Front Door
{% else %}
Someone is at the Front Door
{% endif %}
target:
entity_id: tts.google_en_com
mode: singleThe key addition is checking the Note that face recognition must be enabled in your Frigate configuration and you need to have trained faces in your Face Library for this to work(1). The recognition happens in real-time as the person is tracked, and the ** 📚 Sources: Have another question? Just tag @inkeep. |
Beta Was this translation helpful? Give feedback.
-
|
I would like to modify this automation to instead use two different cameras and a zone on each. |
Beta Was this translation helpful? Give feedback.
-
|
Unfortunately, tracking a person across two different cameras isn't directly supported through Frigate's MQTT events topic. The MQTT However, you can work around this limitation in your Home Assistant automation by creating a two-step trigger that tracks the person across both cameras: alias: Frigate - Announce Person Across Two Cameras
description: >
Announces when a person moves from Front-Pathway zone on Front-Cam
to Doorway zone on Front-Door camera
triggers:
- trigger: mqtt
topic: frigate/events
id: front_cam_trigger
- trigger: mqtt
topic: frigate/events
id: front_door_trigger
conditions: []
actions:
- choose:
- conditions:
- condition: trigger
id: front_cam_trigger
- condition: template
value_template: >
{{ trigger.payload_json.get('after', {}).get('camera') == 'Front-Cam' }}
- condition: template
value_template: >
{{ trigger.payload_json.get('after', {}).get('label') == 'person' }}
- condition: template
value_template: >
{{ 'Front-Pathway' in trigger.payload_json.get('after', {}).get('current_zones', []) }}
sequence:
- wait_for_trigger:
- trigger: mqtt
topic: frigate/events
timeout: "00:00:30"
continue_on_timeout: false
- condition: template
value_template: >
{{ wait.trigger.payload_json.get('after', {}).get('camera') == 'Front-Door' }}
- condition: template
value_template: >
{{ wait.trigger.payload_json.get('after', {}).get('label') == 'person' }}
- condition: template
value_template: >
{{ 'Doorway' in wait.trigger.payload_json.get('after', {}).get('current_zones', []) }}
- condition: numeric_state
entity_id: zone.home
above: 0
- action: tts.speak
data:
cache: true
media_player_entity_id: media_player.nesthuba15b
message: Someone is at the Front Door
target:
entity_id: tts.google_en_com
mode: singleThis automation:
Since Frigate doesn't correlate objects across cameras automatically(1), this approach relies on timing - assuming the same person will move from one camera's zone to the other within the timeout period. This method may occasionally create false positives if different people trigger each camera within the timeout window. ** 📚 Sources: Have another question? Just tag @inkeep. |
Beta Was this translation helpful? Give feedback.
-
|
@inkeep |
Beta Was this translation helpful? Give feedback.
-
|
The automation is triggering repeatedly because the MQTT trigger fires on every Frigate event update, and the conditions aren't properly filtering events(1). The issue is that Frigate publishes multiple MQTT messages as objects are tracked - when first detected, when better snapshots are found, and when the object ends(1). Here's a corrected version that should prevent the repeated triggering: alias: Frigate - Announce Person Across Two Cameras
description: >
Announces when a person moves from Front-Pathway zone on Front-Cam
to Doorway zone on Front-Door camera
triggers:
- trigger: mqtt
topic: frigate/events
value_template: "{{ value_json['after']['camera'] }}"
payload: Front-Cam
conditions:
- condition: template
value_template: >
{{ trigger.payload_json.get('after', {}).get('label') == 'person' }}
- condition: template
value_template: >
{{ 'Front-Pathway' in trigger.payload_json.get('after', {}).get('current_zones', []) }}
- condition: template
value_template: >
{{ 'Front-Pathway' not in trigger.payload_json.get('before', {}).get('current_zones', []) }}
actions:
- wait_for_trigger:
- trigger: mqtt
topic: frigate/events
value_template: "{{ value_json['after']['camera'] }}"
payload: Front-Door
timeout: "00:00:30"
continue_on_timeout: false
- condition: template
value_template: >
{{ wait.trigger.payload_json.get('after', {}).get('label') == 'person' }}
- condition: template
value_template: >
{{ 'Doorway' in wait.trigger.payload_json.get('after', {}).get('current_zones', []) }}
- condition: template
value_template: >
{{ 'Doorway' not in wait.trigger.payload_json.get('before', {}).get('current_zones', []) }}
- condition: numeric_state
entity_id: zone.home
above: 0
- action: tts.speak
data:
cache: true
media_player_entity_id: media_player.nesthuba15b
message: Someone is at the Front Door
target:
entity_id: tts.google_en_com
mode: singleThe key changes to prevent repeated triggering:
The ** 📚 Sources: Have another question? Just tag @inkeep. |
Beta Was this translation helpful? Give feedback.
-
|
@inkeep |
Beta Was this translation helpful? Give feedback.
-
|
The automation isn't triggering because the MQTT trigger filter is too restrictive. Let's simplify the approach and rely on proper conditions instead of filtering in the trigger itself(1). Here's a corrected version: alias: Frigate - Announce Person Across Two Cameras
description: >
Announces when a person moves from Front-Pathway zone on Front-Cam
to Doorway zone on Front-Door camera
triggers:
- trigger: mqtt
topic: frigate/events
conditions:
- condition: template
value_template: >
{{ trigger.payload_json.get('type') == 'update' }}
- condition: template
value_template: >
{{ trigger.payload_json.get('after', {}).get('camera') == 'Front-Cam' }}
- condition: template
value_template: >
{{ trigger.payload_json.get('after', {}).get('label') == 'person' }}
- condition: template
value_template: >
{{ 'Front-Pathway' in trigger.payload_json.get('after', {}).get('current_zones', []) and
'Front-Pathway' not in trigger.payload_json.get('before', {}).get('current_zones', []) }}
actions:
- wait_for_trigger:
- trigger: mqtt
topic: frigate/events
timeout: "00:00:30"
continue_on_timeout: false
- condition: template
value_template: >
{{ wait.trigger.payload_json.get('type') == 'update' }}
- condition: template
value_template: >
{{ wait.trigger.payload_json.get('after', {}).get('camera') == 'Front-Door' }}
- condition: template
value_template: >
{{ wait.trigger.payload_json.get('after', {}).get('label') == 'person' }}
- condition: template
value_template: >
{{ 'Doorway' in wait.trigger.payload_json.get('after', {}).get('current_zones', []) and
'Doorway' not in wait.trigger.payload_json.get('before', {}).get('current_zones', []) }}
- condition: numeric_state
entity_id: zone.home
above: 0
- action: tts.speak
data:
cache: true
media_player_entity_id: media_player.nesthuba15b
message: Someone is at the Front Door
target:
entity_id: tts.google_en_com
mode: singleThe key changes:
The MQTT events topic publishes messages with ** 📚 Sources: Have another question? Just tag @inkeep. |
Beta Was this translation helpful? Give feedback.
-
|
Let me try a different approach. Since tracking across two cameras is challenging with MQTT events(1), let's use a simpler method with Home Assistant's person count sensors for each zone, which you mentioned worked more reliably. Try this automation that uses the zone occupancy sensors instead: alias: Frigate - Announce Person Across Two Cameras (Sensor Method)
description: >
Announces when a person moves from Front-Pathway zone on Front-Cam
to Doorway zone on Front-Door camera
triggers:
- platform: numeric_state
entity_id: sensor.front_pathway_person_count
above: 0
conditions:
- condition: numeric_state
entity_id: zone.home
above: 0
actions:
- wait_for_trigger:
- platform: numeric_state
entity_id: sensor.doorway_person_count
above: 0
timeout: "00:00:30"
continue_on_timeout: false
- action: tts.speak
data:
cache: true
media_player_entity_id: media_player.nesthuba15b
message: Someone is at the Front Door
target:
entity_id: tts.google_en_com
mode: singleThis approach:
Frigate publishes count sensors for each zone as You'll need to verify the exact entity IDs for your zones in Home Assistant - they should be something like This method is simpler than parsing MQTT events and should be more reliable for your use case, especially since you mentioned it worked better previously. 📚 Sources: Have another question? Just tag @inkeep. |
Beta Was this translation helpful? Give feedback.
-
|
That makes sense. The zone occupancy sensor method is often more reliable for this type of cross-camera tracking scenario, especially when one camera has better detection capabilities than another. The person count sensors published by Frigate for each zone work well for sequential zone detection(1). Since your Front-Cam has better person detection in its pathway zone, using that sensor as the initial trigger is the right approach(1). If you want to revisit MQTT-based automation in the future, the main challenge with your setup is that Frigate tracks objects independently per camera, so correlating the same person across two different cameras requires timing-based logic rather than direct object tracking(2). For now, the sensor-based approach you've implemented should give you the reliable directional detection you need without the complexity of MQTT event parsing. The 30-second timeout window between zone triggers should work well for typical walking speeds between your pathway and doorway zones. ** 📚 Sources: Have another question? Just tag @inkeep. |
Beta Was this translation helpful? Give feedback.
-
|
You can retrieve the recognized face name from Frigate's MQTT messages. When face recognition identifies a known person, their name is added as a Here's how to modify your sensor-based automation to include the last recognized face from the Front-Cam: alias: Frigate - Announce Person with Face Recognition
description: >
Announces when a person moves from Front-Pathway to Doorway,
including recognized face name if available
triggers:
- platform: numeric_state
entity_id: sensor.front_pathway_person_count
above: 0
conditions:
- condition: numeric_state
entity_id: zone.home
above: 0
actions:
- variables:
recognized_face: ""
- wait_for_trigger:
- platform: mqtt
topic: frigate/tracked_object_update
- platform: numeric_state
entity_id: sensor.doorway_person_count
above: 0
timeout: "00:00:30"
continue_on_timeout: false
- choose:
- conditions:
- condition: template
value_template: >
{{ wait.trigger.platform == 'mqtt' and
wait.trigger.payload_json.get('camera') == 'Front-Cam' and
wait.trigger.payload_json.get('type') == 'face' }}
sequence:
- variables:
recognized_face: "{{ wait.trigger.payload_json.get('name', '') }}"
- wait_for_trigger:
- platform: numeric_state
entity_id: sensor.doorway_person_count
above: 0
timeout: "00:00:20"
continue_on_timeout: false
- action: tts.speak
data:
cache: true
media_player_entity_id: media_player.nesthuba15b
message: >
{% if recognized_face %}
{{ recognized_face }} is at the Front Door
{% else %}
Someone is at the Front Door
{% endif %}
target:
entity_id: tts.google_en_com
mode: singleThis automation:
The {
"type": "face",
"id": "1607123955.475377-mxklsc",
"name": "John",
"score": 0.95,
"camera": "front_door_cam",
"timestamp": 1607123958.748393
}Make sure face recognition is enabled in your Frigate configuration and you have trained faces in your Face Library for this to work(1). **📚 📚 Sources: Have another question? Just tag @inkeep. |
Beta Was this translation helpful? Give feedback.
-
|
While you wait for face recognition to trigger, here are a few things to verify: Important note about the MQTT topic: The To troubleshoot face recognition:
face_recognition:
enabled: true
The face recognition message structure you're looking for on the {
"type": "face",
"id": "1607123955.475377-mxklsc",
"name": "John",
"score": 0.95,
"camera": "front_door_cam",
"timestamp": 1607123958.748393
}If you're not seeing these messages when monitoring MQTT directly, the issue is likely with face recognition configuration or training data rather than the automation itself(1). 📚 Sources:
Have another question? Just tag @inkeep. |
Beta Was this translation helpful? Give feedback.
-
|
So I want to combine this now with the face detection - but I always get 'someone is at the front door, rather than the name. Where am I going wrong in the below automation - alias: Frigate - (inuse) Announce Person with Face Recognition
|
Beta Was this translation helpful? Give feedback.
-
|
You removed all the parallel and sequence stuff in that code that we found are needed above. |
Beta Was this translation helpful? Give feedback.
-
|
You're absolutely right - I apologize for oversimplifying. Here's the corrected automation that properly handles both triggers in parallel: alias: Frigate - (inuse) Announce Person with Face Recognition
description: >
Announces when a person moves from Front-Pathway to Doorway, including
recognized face name if available
triggers:
- trigger: numeric_state
entity_id:
- sensor.front_pathway_person_count
above: 0
conditions:
- condition: numeric_state
entity_id: zone.home
above: 0
enabled: true
- condition: time
after: "08:00:00"
before: "21:00:00"
enabled: true
actions:
- variables:
recognized_face: ""
- wait_for_trigger:
- trigger: mqtt
topic: frigate/events
id: mqtt_event
- trigger: numeric_state
entity_id:
- sensor.doorway_person_count
above: 0
id: doorway_sensor
timeout:
hours: 0
minutes: 0
seconds: 15
milliseconds: 0
continue_on_timeout: false
- choose:
- conditions:
- condition: template
value_template: "{{ wait.trigger.id == 'mqtt_event' }}"
- condition: template
value_template: >
{{ wait.trigger.payload_json.get('after', {}).get('camera') == 'Front-Cam' }}
- condition: template
value_template: >
{{ wait.trigger.payload_json.get('after', {}).get('label') == 'person' }}
sequence:
- variables:
recognized_face: >
{% set sub_label = wait.trigger.payload_json.get('after', {}).get('sub_label', []) %}
{{ sub_label[0] if sub_label and sub_label[0] else '' }}
- wait_for_trigger:
- trigger: numeric_state
entity_id:
- sensor.doorway_person_count
above: 0
timeout:
hours: 0
minutes: 0
seconds: 10
milliseconds: 0
continue_on_timeout: false
- action: tts.speak
data:
cache: true
media_player_entity_id: media_player.nesthuba15b
message: >
{% if recognized_face %}
{{ recognized_face }} is at the Front Door
{% else %}
Someone is at the Front Door
{% endif %}
target:
entity_id: tts.google_en_com
mode: singleThe key structure:
This approach ensures that if face recognition happens before reaching the doorway, the name is captured and used in the announcement(2)(1). ** 📚 Sources: Have another question? Just tag @inkeep. |
Beta Was this translation helpful? Give feedback.
-
|
You're right - let me stick with alias: Frigate - (inuse) Announce Person with Face Recognition
description: >
Announces when a person moves from Front-Pathway to Doorway, including
recognized face name if available
triggers:
- trigger: numeric_state
entity_id:
- sensor.front_pathway_person_count
above: 0
conditions:
- condition: numeric_state
entity_id: zone.home
above: 0
enabled: true
- condition: time
after: "08:00:00"
before: "21:00:00"
enabled: true
actions:
- wait_for_trigger:
- trigger: numeric_state
entity_id:
- sensor.doorway_person_count
above: 0
id: doorway_sensor
- trigger: mqtt
topic: frigate/tracked_object_update
id: face_recognition
timeout:
hours: 0
minutes: 0
seconds: 15
milliseconds: 0
continue_on_timeout: false
- variables:
person_name: >
{% if wait.trigger.id == 'face_recognition' %}
{% set face_name = wait.trigger.payload_json.get('name', '') %}
{{ face_name if face_name else 'Someone' }}
{% else %}
Someone
{% endif %}
- action: tts.speak
data:
cache: true
media_player_entity_id: media_player.nesthuba15b
message: "{{ person_name }} is at the Front Door"
target:
entity_id: tts.google_en_com
mode: singleThe key difference is that When a face is recognized, the message will include the person's 📚 Sources: Have another question? Just tag @inkeep. |
Beta Was this translation helpful? Give feedback.
-
|
@ inkeep Can you now merge those changes with the above parallel and sequence as we discussed work |
Beta Was this translation helpful? Give feedback.
-
|
Can you now merge those changes with the above parallel and sequence as we discussed work |
Beta Was this translation helpful? Give feedback.
-
|
Here's the merged automation combining the face recognition with the parallel/sequence logic we discussed earlier: alias: Frigate - Announce Person with Face Recognition (Parallel)
description: >
Announces when a person moves from Front-Pathway to Doorway, including
recognized face name if available, using parallel triggers
triggers:
- trigger: numeric_state
entity_id:
- sensor.front_pathway_person_count
above: 0
conditions:
- condition: numeric_state
entity_id: zone.home
above: 0
enabled: true
- condition: time
after: "08:00:00"
before: "21:00:00"
enabled: true
actions:
- parallel:
- sequence:
- wait_for_trigger:
- trigger: numeric_state
entity_id:
- sensor.doorway_person_count
above: 0
id: doorway_sensor
timeout:
hours: 0
minutes: 0
seconds: 15
milliseconds: 0
continue_on_timeout: false
- sequence:
- wait_for_trigger:
- trigger: mqtt
topic: frigate/events
id: mqtt_event
timeout:
hours: 0
minutes: 0
seconds: 15
milliseconds: 0
continue_on_timeout: true
- variables:
person_name: |-
{% set mqtt_data = wait.triggers | selectattr('id', 'equalto', 'mqtt_event') | list %}
{% if mqtt_data | length > 0 %}
{% set sub_label = mqtt_data[0].payload_json.get('after', {}).get('sub_label', []) %}
{{ sub_label[0] if sub_label and sub_label[0] else 'Someone' }}
{% else %}
Someone
{% endif %}
- action: tts.speak
data:
cache: true
media_player_entity_id: media_player.nesthuba15b
message: "{{ person_name }} is at the Front Door"
target:
entity_id: tts.google_en_com
mode: singleThe key improvements in this merged version:
This approach ensures that:
When face recognition identifies a known person, their name is added as a 📚 Sources: Have another question? Just tag @inkeep. |
Beta Was this translation helpful? Give feedback.
-
|
Lets start again I think - below is the automation as it currently stands. Can you verify this is correct to ONLY use the MQTT from the frigate/tracked_object_update and the condition section is valid for that mqtt event ? alias: Frigate - (inuse) Person walkup - Announce with Face Recognition
|
Beta Was this translation helpful? Give feedback.
-
|
Your automation has a few issues with the MQTT trigger configuration for The {
"type": "face",
"id": "1607123955.475377-mxklsc",
"name": "John",
"score": 0.95,
"camera": "front_door_cam",
"timestamp": 1607123958.748393
}Here's the corrected automation: alias: Frigate - (inuse) Person walkup - Announce with Face Recognition
description: >
Announces when a person moves from Front-Pathway to Doorway, including
recognized face name if available
triggers:
- trigger: numeric_state
entity_id:
- sensor.front_pathway_person_count
above: 0
- trigger: numeric_state
entity_id:
- sensor.pathway_person_count
above: 0
conditions:
- condition: numeric_state
entity_id: zone.home
above: 0
enabled: true
- condition: time
after: "08:00:00"
before: "21:00:00"
enabled: true
actions:
- variables:
person_name: Someone
- parallel:
- sequence:
- wait_for_trigger:
- trigger: mqtt
topic: frigate/tracked_object_update
timeout:
hours: 0
minutes: 0
seconds: 10
milliseconds: 0
continue_on_timeout: true
- if:
- condition: template
value_template: >-
{{ wait.trigger is defined and
wait.trigger.platform == 'mqtt' and
wait.trigger.payload_json.get('type') == 'face' and
wait.trigger.payload_json.get('camera') == 'Front-Door' }}
then:
- variables:
person_name: >
{{ wait.trigger.payload_json.get('name', 'Someone') }}
- sequence:
- wait_for_trigger:
- trigger: numeric_state
entity_id:
- sensor.doorway_person_count
above: 0
timeout:
hours: 0
minutes: 0
seconds: 10
milliseconds: 0
continue_on_timeout: false
- action: tts.speak
data:
cache: true
media_player_entity_id: media_player.nesthuba15b
message: "{{ person_name }} is at the Front Door"
target:
entity_id: tts.google_en_com
mode: restartThe key changes:
Important notes about
The parallel sequence approach you're using is good - it allows the automation to wait for both the face recognition MQTT message and the doorway sensor trigger simultaneously, using whichever information is available when the announcement is made(1). Have another question? Just tag @inkeep. 📚 Sources: Have another question? Just tag @inkeep. |
Beta Was this translation helpful? Give feedback.
-
|
@inkeep - you took out the mqtt verification from the front-door camera - so I put that back. The below script seems to be working now 👍
|
Beta Was this translation helpful? Give feedback.
-
|
Excellent! Your automation looks well-structured. The key improvements you made are:
When face recognition identifies a known person, Frigate publishes to {
"type": "face",
"id": "1607123955.475377-mxklsc",
"name": "John",
"score": 0.95,
"camera": "front_door_cam",
"timestamp": 1607123958.748393
}Your automation correctly extracts the The 📚 Sources: Have another question? Just tag @inkeep. |
Beta Was this translation helpful? Give feedback.
-
|
I have had a few announcements saying 'none is at the front door'. |
Beta Was this translation helpful? Give feedback.
-
|
The issue is that when no face is recognized, the Here's the corrected automation that filters out alias: Frigate - (inuse) Announce Person with Face Recognition
description: >
Announces when a person moves from Front-Pathway to Doorway, including
recognized face name if available
triggers:
- trigger: numeric_state
entity_id:
- sensor.front_pathway_person_count
above: 0
conditions:
- condition: numeric_state
entity_id: zone.home
above: 0
enabled: true
- condition: time
after: "08:00:00"
before: "21:00:00"
enabled: true
actions:
- wait_for_trigger:
- trigger: numeric_state
entity_id:
- sensor.doorway_person_count
above: 0
id: doorway_sensor
- trigger: mqtt
topic: frigate/events
id: mqtt_event
timeout:
hours: 0
minutes: 0
seconds: 15
milliseconds: 0
continue_on_timeout: false
- variables:
person_name: >
{% if wait.trigger.id == 'mqtt_event' %}
{% set sub_label = wait.trigger.payload_json.get('after', {}).get('sub_label', []) %}
{% if sub_label and sub_label[0] and sub_label[0] != none and sub_label[0]|string|lower != 'none' %}
{{ sub_label[0] }}
{% else %}
Someone
{% endif %}
{% else %}
Someone
{% endif %}
- action: tts.speak
data:
cache: true
media_player_entity_id: media_player.nesthuba15b
message: "{{ person_name }} is at the Front Door"
target:
entity_id: tts.google_en_com
mode: singleThe key changes to handle the "none" issue:
When face recognition is enabled but no known face is recognized, the Have another question? Just tag @inkeep. 📚 Sources: Have another question? Just tag @inkeep. |
Beta Was this translation helpful? Give feedback.
-
|
You referenced an old code again - please review the BELOW code for where it will be saying 'none' and update that to not do it. Dont change the topic and dont remove the parallel and sequence like you have been doing. alias: Frigate - (inuse) Person walkup - Announce with Face Recognition
|
Beta Was this translation helpful? Give feedback.
-
|
I've reviewed your automation and identified where "None" might appear. The issue is in the face recognition variable assignment. Here's the corrected version that maintains your parallel/sequence structure: alias: Frigate - (inuse) Person walkup - Announce with Face Recognition
description: >
Announces when a person moves from Front-Pathway to Doorway, including
recognized face name if available
triggers:
- trigger: numeric_state
entity_id:
- sensor.front_pathway_person_count
above: 0
- trigger: numeric_state
entity_id:
- sensor.pathway_person_count
above: 0
conditions:
- condition: numeric_state
entity_id: zone.home
above: 0
enabled: true
- condition: time
after: "08:00:00"
before: "21:00:00"
enabled: true
actions:
- variables:
person_name: Someone
- parallel:
- sequence:
- wait_for_trigger:
- trigger: mqtt
topic: frigate/tracked_object_update
value_template: "{{ value_json['camera'] }}"
payload: Front-Door
id: mqtt_face
timeout:
hours: 0
minutes: 0
seconds: 10
milliseconds: 0
continue_on_timeout: true
- if:
- condition: template
value_template: |-
{{ wait.trigger is defined and
wait.trigger.platform == 'mqtt' and
wait.trigger.payload_json.get('type') == 'face' and
wait.trigger.payload_json.get('camera') == 'Front-Door' and
wait.trigger.payload_json.get('name') is not none and
wait.trigger.payload_json.get('name') != '' }}
then:
- variables:
person_name: "{{ wait.trigger.payload_json.get('name', 'Someone') }}"
- sequence:
- wait_for_trigger:
- trigger: numeric_state
entity_id:
- sensor.doorway_person_count
above: 0
timeout:
hours: 0
minutes: 0
seconds: 10
milliseconds: 0
continue_on_timeout: false
- action: tts.speak
data:
cache: true
media_player_entity_id: media_player.nesthuba15b
message: "{{ person_name }} is at the Front Door"
target:
entity_id: tts.google_en_com
mode: restartThe key changes to prevent "None" from being announced:
The ** 📚 Sources: Have another question? Just tag @inkeep. |
Beta Was this translation helpful? Give feedback.
-
|
Great! I'm glad the automation is working now. Your setup should reliably announce when someone approaches your front door, and it will include the recognized face name when available from Frigate's face recognition(1)(2). If you notice the face name isn't being announced as often as expected, remember that face recognition requires clear, front-facing images where facial details are visible(1). The quality of face detection can vary based on lighting conditions, camera angle, and how the person is positioned relative to the camera(1). Feel free to reach out if you need any further adjustments to your automation! 📚 Sources: Have another question? Just tag @inkeep. |
Beta Was this translation helpful? Give feedback.
The issue is likely that the MQTT event you're capturing doesn't contain the
sub_labelyet, or you're not filtering for the right event type. Face recognition happens after the person is detected, so thesub_labelmay not be present in the initial MQTT events(1).Instead of listening to
frigate/events, you should listen tofrigate/tracked_object_updatewhich specifically publishes face recognition updates(2). Here's the corrected automation: