SgtBatten / HA_blueprints

Somewhere to store automation blueprints
181 stars 70 forks source link

[Bug]: Label Names seem to be arrays in the beta Frigate, reads poorly when Notification updates #102

Open robchandhok opened 11 months ago

robchandhok commented 11 months ago

Description

Just started running Frigate 0.13.0-beta2 and Frigate Integration v5.0.0-beta.2. Using DoubleTake 1.13.1.

Was solely using the Stable version (0.12.0.1) of this wonderful blueprint (THANK YOU). Have also tried with the Beta (0.12.0.1r) version of the blueprint on one camera, no difference in behavior.

Both versions of the blueprint correctly report the object detection A Person was detected on the Front Door camera.

The bug is that when the notification updates with the face label from DoubleTake, it no longer reports "Rob was detected on the Front Door camera" (for example). Instead the notification text reads "['rob',None] was detected on the Front Door camera".

I am not overriding the template for generating the message.

I haven't been able to track it down in the Frigate changes, but maybe Labels come back as an array in the event now? I'm happy to help debug if useful.

Version

0.12.0.1

Automation Config

alias: Notice Camera - Front Door
description: ""
use_blueprint:
  path: SgtBatten/Beta.yaml
  input:
    tv_transparency: 0%
    camera: camera.front_door
    base_url: https://XXXXXXXXXXXXX
    update_thumbnail: true
    zones:
      - front_door_path
    labels:
      - person
    ios_live_view: false
    cooldown: 120
    state_entity: input_boolean.quiet_camera_notifications
    state_filter_states:
      - "off"
    state_filter: true
    tv_size: large
    tv_position: center
    zone_filter: true
    notify_group: all_mobile
    color: grey

Frigate Config

No response

Any other relevant information

No response

robchandhok commented 11 months ago

I should have been more clear, this is a change in the "sub label" behavior that face detection components use to label and event.

Could be related to this Frigate PR https://github.com/blakeblackshear/frigate/pull/7113 ...also fixes the case where only a string was being used for sub labels

SgtBatten commented 11 months ago

Yeah that will be it. Must be an array now. I'll have to look into it and release a version for the new frigate version when I get a chance

robchandhok commented 10 months ago

Just for the record, tried to give you a PR for this, but can't for the life of me figure out how to get the value out. Tried {{event['after']['sub_label'].0}} and {{event['after']['sub_label'][0]}}

In the code in Frigate (frigate/events/maintainer.py) it is ` if event_data.get("sub_label") is not None: 215 | event[Event.sub_label] = event_data["sub_label"][0] 216 | event[Event.data]["sub_label_score"] = event_data["sub_label"][1]

`

Sorry, I guess I'm not a jinja expert either :-)

Example values in the MQTT messages:

` "label": "person", 33 | "sub_label": null, 34 | "top_score": 0.958984375,   61 | "label": "person", 62 | "sub_label": ["John Smith", 0.79], 63 | "top_score": 0.958984375,

`

robchandhok commented 10 months ago

submitted PR https://github.com/SgtBatten/HA_blueprints/pull/127