Output object with sub_label for HA #21793
Replies: 3 comments
|
Your automation is counting persons correctly. To count sub_labels (sled, skies, snowboard), you need to check the The For your use case, modify your automation to check the sub_label: triggers:
- topic: frigate/events
trigger: mqtt
conditions:
- condition: template
value_template: |
{{ trigger.payload_json["type"] == "new"
and trigger.payload_json["after"]["label"] == "person"
and trigger.payload_json["after"]["sub_label"] is not none
and trigger.payload_json["after"]["sub_label"][0] in ["sled", "skies", "snowboard"]
and trigger.payload_json["after"]["id"]
!= states("input_text.last_frigate_" + trigger.payload_json["after"]["sub_label"][0] + "_id") }}
actions:
- choose:
- conditions:
- condition: template
value_template: "{{ trigger.payload_json['after']['sub_label'][0] == 'sled' }}"
sequence:
- action: counter.increment
target:
entity_id: counter.sled_counter
- action: input_text.set_value
target:
entity_id: input_text.last_frigate_sled_id
data:
value: "{{ trigger.payload_json['after']['id'] }}"
- conditions:
- condition: template
value_template: "{{ trigger.payload_json['after']['sub_label'][0] == 'skies' }}"
sequence:
- action: counter.increment
target:
entity_id: counter.skies_counter
- action: input_text.set_value
target:
entity_id: input_text.last_frigate_skies_id
data:
value: "{{ trigger.payload_json['after']['id'] }}"
- conditions:
- condition: template
value_template: "{{ trigger.payload_json['after']['sub_label'][0] == 'snowboard' }}"
sequence:
- action: counter.increment
target:
entity_id: counter.snowboard_counter
- action: input_text.set_value
target:
entity_id: input_text.last_frigate_snowboard_id
data:
value: "{{ trigger.payload_json['after']['id'] }}"You'll need to create separate counter and input_text helpers for each sub_label (sled, skies, snowboard) in Home Assistant. 📚 Sources: Have another question? Just tag @inkeep. |
|
Where can i find logs where i can see the payload that contains this classification? |
|
You can monitor the MQTT payloads directly using an MQTT client to subscribe to the The To view these payloads in real-time, you can:
logger:
default: info
logs:
homeassistant.components.mqtt: debugThis will show MQTT messages in your Home Assistant logs, which you can view under Settings > System > Logs. Alternatively, you can create a simple Home Assistant automation to log the payloads: triggers:
- topic: frigate/events
trigger: mqtt
actions:
- action: system_log.write
data:
message: "Frigate event payload: {{ trigger.payload_json }}"
level: infoThis will write the full payload to your Home Assistant logs each time an event is published.(1) 📚 Sources: Have another question? Just tag @inkeep. |
Uh oh!
There was an error while loading. Please reload this page.
Hi!
I´ve managed to train my model with object_labeling.
It is a startingpoint at a skislope that detects persons with sled, skies or snowboard.
How can i count those different objects in HA? Have anyone done this before?
YAML normal person counting (once) works well , ...
triggers:
trigger: mqtt
conditions:
value_template: |
{{ trigger.payload_json["type"] == "new"
and trigger.payload_json["after"]["label"] == "person"
and trigger.payload_json["after"]["id"]
!= states("input_text.last_frigate_person_id") }}
actions:
entity_id: counter.person_counter
action: counter.increment
entity_id: input_text.last_frigate_person_id
data:
value: "{{ trigger.payload_json['after']['id'] }}"
action: input_text.set_value
THX!
All reactions