Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save SgtBatten/10a2dc7f16af9f55f3ba83fe4523d8d7 to your computer and use it in GitHub Desktop.
Save SgtBatten/10a2dc7f16af9f55f3ba83fe4523d8d7 to your computer and use it in GitHub Desktop.
Frigate Notifications have moved
blueprint:
name: Frigate Notifications by SgtB have moved
description: |
## ANNOUNCEMENT
I have moved from this gist to a github repositry.
Please checkout https://github.com/SgtBatten/HA_blueprints for the latest versions
domain: automation
input:
camera:
name: This blueprint has moved.
description: Please checkout https://github.com/SgtBatten/HA_blueprints for the latest versions
selector:
text:
default: https://github.com/SgtBatten/HA_blueprints
trigger: []
action: []
@SgtBatten
Copy link
Author

@mrplow still not working for me, but images are updating again.

I'm considering hardcoding snapshots everywhere to test. Maybe frigate doesn't save the bounding box before the image gets sent.

@mr-brains
Copy link

mr-brains commented Apr 11, 2023

@mr-brains please share your config for the automation like mrplow did above
here you go:

  alias: beweging woonkamer beta
  description: ''
  use_blueprint:
    path: hunterjm/frigate_0.11_15f-beta.yaml
    input:
      tv_transparency: 0%
      camera: camera.huiskamer
      notify_device: f1dd73c85b7201c8b2faad8ba0a3347a
      base_url: http://external.url:8123
      title: Beweging!
      critical: 'true'
      alert_once: true
      tv_size: large
      tv_position: center
      color: red
      message: persoon gedetecteerd in huiskamer
      zone_filter: true
      zones:
      - side
      - examples
      zone_multi: false
      debug: true

config from the cam:

huiskamer:
    record:
      enabled: true
    ffmpeg:
      hwaccel_args: preset-vaapi
      inputs:
        - path: rtsp://user:[email protected]:8554/
          roles:
            - detect
            - rtmp
    rtmp:
      enabled: False
    detect:
      width: 640
      height: 360
    zones:
      Side:
        coordinates: 0,360,640,360,90,108,0,126
      examples:
        coordinates: 585,80,640,247,365,243,370,0

@SgtBatten
Copy link
Author

SgtBatten commented Apr 11, 2023

@mrplow I have tested extensively today. It seems the primary issue is simply that the snapshot is cropped and saved in the background sometime after the notification is sent. I have tried hardcoding snaphot.jpg instead of using the variable just in case, no change.

I have been testing by running two notifications in parallel for the same camera. one with thumbnail and one with snapshot. The thumbnail one shows a cropped image, the snapshot one shows an uncropped image despite being set to crop: true. Both update simultaneously as better snapshots are taken (i move closer to camera)

Clicking view snapshot on either notification shows me the uncropped image. If i wait a little while after ending the event the same url now shows me a cropped image with the bounding box. Not sure i can solve this one

@SgtBatten
Copy link
Author

@mr-brains I may see the issue. Can you grab me the debug output please, I see you have it enabled.

You can view it easily in the notification trace by clicking on this icon
image
One is 7 down from the top and the other is 6 up from the bottom. Im more interested in the bottom one which may have many iterations. The last one should be enough.

@mr-brains
Copy link

mr-brains commented Apr 11, 2023

the top one:

Edited down to relevant bit by SgtBatten

      Required zones: ['side', 'examples'], 
      Entered Zones: ['Side'], 

@mr-brains
Copy link

also: Ah, there is where the debugging is going. i expected them in the logging of home assistant somewhere. :)

@SgtBatten
Copy link
Author

also: Ah, there is where the debugging is going. i expected them in the logging of home assistant somewhere. :)

It goes to the logbook also, but the formatting is hard to read. much easier to read in the trace.

I have just uploaded a fix for your issue.
The issue was capitalisation of your zones in frigate config.

  Required zones: ['side', 'examples'], 

  Entered Zones: ['Side'], 

See here that side is not the same as Side
The fix should make everything lowercase behind the scenes, regardless of your configuration. Please try the latest beta and let me know

@mr-brains
Copy link

on it. I was seeing that and so i tried to add the zone's with upper and lowercase. didn't work.
I let you know the result of the fix.

@mr-brains
Copy link

@SgtBatten
IT WORKS! thank you.
now up to finetuning my notifications.

@SgtBatten
Copy link
Author

i tried to add the zone's with upper and lowercase. didn't work.

Yep that wouldn't have worked because I was forcing the inputs to be lowercase already (due to users having the opposite problem to you. Now it does both so they should always match.

@SgtBatten
Copy link
Author

@mrplow I have a workaround and I really hate how much bigger the blueprint gets but try the latest beta (16a). It sends a final notification 10 seconds after the end of the event which seems to be enough time for my frigate instance to process the snapshot.

It will only send if update thumbnail is true and attachment is set to snapshot.

@Delta1977
Copy link

@Delta1977 forked from an original gist. I could change it for easier conversations/issue tracking though

@SgtBatten Do you have plans or a timeline to move to git?

@mr-brains
Copy link

@SgtBatten IT WORKS! thank you. now up to finetuning my notifications.

and that was it, worked 1 time :/
i am going to start allover, trow away what i have now and start with 1 camera.
let you know what happens.

@mr-brains
Copy link

first i had to restart HA,after that the camera we troubleshoot started working again. so that was something with my homeassist.
it looks like your blueprint doesn't like _ in the camera names. I renamed 1 camera and now it works.

other question, can i edit the zones in the automation yaml?
the tekst glitch is preventing me from typing but i kan paste and hit enter,or i just type it in the automation yaml.

@mrplow
Copy link

mrplow commented Apr 11, 2023

@SgtBatten wow, that was a big change. So far so good though. I had two notifications so far this morning and both had the bounding boxes.

@SgtBatten
Copy link
Author

blueprint doesn't like _ in the camera names

I have _ in some of mine. It does handle them fine.

Yes you can edit the zones in yaml, select one of the examples and then edit it in yaml. I have raised an issue on GitHub and someone has already done a fix but it is not yet release in homeassistant.

@SgtBatten
Copy link
Author

@Delta1977 I will clean up this repo later today but you can now use https://github.com/SgtBatten/HA_blueprints and people can raise issues there.

@Delta1977
Copy link

@Delta1977 I will clean up this repo later today but you can now use https://github.com/SgtBatten/HA_blueprints and people can raise issues there.

@SgtBatten great. Thank you for your amazing work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment