blakeblackshear / frigate-hass-addons

Frigate hass.io addons
MIT License
204 stars 118 forks source link

HassOS Beta #67

Open Coolie1101 opened 2 years ago

Coolie1101 commented 2 years ago

How do I install the HassOS Beta Version?

Add-on Store

image

There are several versions of the addon available:** image

blakeblackshear commented 2 years ago

It should be showing up now. I had an error in the config.

Coolie1101 commented 2 years ago

Seems to be working without any errors so far.

Coolie1101 commented 2 years ago

No Integration sensors available with the Beta Version?

image

blakeblackshear commented 2 years ago

Nothing changed there. Check your HA logs to see if the integration needs to be reconfigured.

Coolie1101 commented 2 years ago

Nothing changed there. Check your HA logs to see if the integration needs to be reconfigured.

I removed and re-added the integration but it's still the same.

Also, can't figure out why the following automation executes every 1 minute, seems like Person Motion in stuck, it's now 3:15pm and still shows detected from since 12:54pm.

alias: Frigate - Notify Detected Object On Porch
description: Object detection notification from Frigate
trigger:
  - platform: mqtt
    topic: frigate/events
condition:
  - condition: template
    value_template: >-
      {{ as_timestamp(now()) -
      as_timestamp(states.binary_sensor.front_door.last_changed) > 60 }}
  - condition: template
    value_template: >-
      {{
      (as_timestamp(now())-as_timestamp(state_attr('automation.frigate_notify_detected_object_on_porch','last_triggered')
      | default(0)) | int > 60) }}
  - condition: template
    value_template: '{{ not ''steps'' in trigger.payload_json[''after''][''current_zones''] }}'
  - condition: template
    value_template: '{{ not ''south_side'' in trigger.payload_json[''after''][''camera''] }}'
action:
  - service: notify.group
    data:
      message: >-
        A {{trigger.payload_json["after"]["label"]}} was detected on the
        {{trigger.payload_json["after"]["camera"]}} camera.
      data:
        photo:
          - url: >-
              hassos_url/api/frigate/notifications/{{trigger.payload_json["after"]["id"]}}/snapshot.jpg
            caption: >-
              'A {{trigger.payload_json["after"]["label"]}} was detected at the
              Front {{trigger.payload_json["after"]["entered_zones"]}}'.
  - delay:
      seconds: 20
  - service: notify.group
    data:
      message: Video of {{trigger.payload_json["after"]["label"]}}" detected.
      data:
        video:
          - url: >-
              hassos_url/api/frigate/notifications/{{trigger.payload_json["after"]["id"]}}/{{trigger.payload_json["after"]["camera"]}}/clip.mp4
            timeout: 1000
            caption: >-
              'Video of {{trigger.payload_json["after"]["label"]}}" detected at
              the Front {{trigger.payload_json["after"]["entered_zones"]}}'.
mode: single
initial_state: true

Could be that it's being triggered by the tree in the pic below? image

image

image

Coolie1101 commented 2 years ago

It should be showing up now. I had an error in the config.

FYI, 0.11.0-beta1 seems to be much more stable, no errors in logs even with hardware acceleration enabled.

EDIT: Excepts for the following, I have no idea what it means. "ERROR : ffmpeg version 4.3.3-0+rpt2+deb11u1 Copyright (c) 2000-2021 the FFmpeg developers"

blakeblackshear commented 2 years ago

Have you taken a look at the debug view? Frigate tracks stationary objects and sends an update message for them every minute. Sounds like something is being tracked.

Coolie1101 commented 2 years ago

Have you taken a look at the debug

Seems to be working as intended, or maybe I'm lookin at it wrong.

image

Here's the automation:-

alias: Frigate - Notify Detected Object On Porch
description: Object detection notification from Frigate
trigger:
  - platform: mqtt
    topic: frigate/events
condition:
  - condition: template
    value_template: >-
### Cancel if the front door was open recently - means we are going out.
      {{ as_timestamp(now()) -
      as_timestamp(states.binary_sensor.front_door.last_changed) > 60 }}
  - condition: template
    value_template: >-
### Cancel if this automation ran within the last min.
      {{
      (as_timestamp(now())-as_timestamp(state_attr('automation.frigate_notify_detected_object_on_porch','last_triggered')
      | default(0)) | int > 60) }}
  - condition: template
### Avoid triggering for the following zones.
    value_template: '{{ not ''steps'' in trigger.payload_json[''after''][''current_zones''] }}'
  - condition: template
    value_template: '{{ not ''south_side'' in trigger.payload_json[''after''][''camera''] }}'
action:
  - service: notify.group
    data:
      message: >-
        A {{trigger.payload_json["after"]["label"]}} was detected on the
        {{trigger.payload_json["after"]["camera"]}} camera.
      data:
        photo:
          - url: >-
              http://hass_url/api/frigate/notifications/{{trigger.payload_json["after"]["id"]}}/snapshot.jpg
            caption: >-
              'A {{trigger.payload_json["after"]["label"]}} was detected at the
              Front {{trigger.payload_json["after"]["entered_zones"]}}'.
  - delay:
      seconds: 20
  - service: notify.group
    data:
      message: Video of {{trigger.payload_json["after"]["label"]}}" detected.
      data:
        video:
          - url: >-
              http://hass_url/api/frigate/notifications/{{trigger.payload_json["after"]["id"]}}/{{trigger.payload_json["after"]["camera"]}}/clip.mp4
            timeout: 1000
            caption: >-
              'Video of {{trigger.payload_json["after"]["label"]}}" detected at
              the Front {{trigger.payload_json["after"]["entered_zones"]}}'.
mode: single
initial_state: true
Coolie1101 commented 2 years ago

Motion Masks

image

image

image

image

Coolie1101 commented 2 years ago

Zones

Front Door image

Porch image

Steps image

Coolie1101 commented 2 years ago

Person Object Mask

image

Coolie1101 commented 2 years ago

Check your HA logs

Still no sensors, Nothing in HA Logs.

Also the automation triggers exactly 1 min apart with a new in mage, can't figure out what's triggering it.

Coolie1101 commented 2 years ago

Here are the latest events:- image

What I notice, is when the automation is triggered by an object, it executes as expected, but then continues to fire every minute sending an image with no specified object until I restart Frigate.

image 'A person was detected at the Front []'.

Coolie1101 commented 2 years ago

New Issue

Clips downloaded from the "http://hassos:8123/ccab4aaf_frigate-fa-beta/dashboard", downloads as "clip.htm", shouldn't it be in a video format?

blakeblackshear commented 2 years ago

then continues to fire every minute sending an image with no specified object until I restart Frigate

This is expected behavior when tracking stationary objects. If you look at the debug view when this is happening, you should see a bounding box for the stationary object.

blakeblackshear commented 2 years ago

You will need to add a condition to ignore messages for stationary objects. I think this will work.

  - condition: template
    value_template: '{{ not trigger.payload_json[''after''][''stationary''] }}'
Coolie1101 commented 2 years ago

If you look at the debug view when this is happening, you should see a bounding box for the stationary object.

My debug view only shows the stats with the config below, see pic. Screenshot_20220226-145607

blakeblackshear commented 2 years ago

Click on the camera to view the live stream and then select debug in the top right. Below the stream you have some options to turn on bounding boxes, etc.

Coolie1101 commented 2 years ago

Click on the camera to view the live stream and then select debug in the top right. Below the stream you have some options to turn on bounding boxes, etc.

Got it, I could be wrong, but could it be the time in the zone below is what may have been triggering the event, I adjusted the zone, but won't know the effects for sure until tomorrow AM.

Old Zone image

New Zone image

Any idea how I can troubleshoot the issue with the missing sensors?, I removed and re-added the integration a couple times with the same result.

Sensors Currently Available image

Coolie1101 commented 2 years ago

Any chance of detecting packages/box only if in configured zone's for X amount of time?

Coolie1101 commented 2 years ago

New error on live stream.

Error from stream worker: Error opening stream (ERRORTYPE_2, No such file or directory) ccab4aaf-frigate-fa-beta

blakeblackshear commented 2 years ago

Any chance of detecting packages/box only if in configured zone's for X amount of time?

The model doesn't support packages, but custom models in Frigate+ will.

Some sensors are sent via MQTT, so make sure that is still working properly between HA and Frigate.

could it be the time in the zone below is what may have been triggering the event

You should definitely add a motion mask over the timestamp if you haven't already, but motion and zones have nothing to do with each other. Zones are only applicable to objects.

Coolie1101 commented 2 years ago

but custom models in Frigate+ will 👍

Some sensors are sent via MQTT

MQTT seems to be working.

{
  "frontdoor": {
    "camera_fps": 5,
    "process_fps": 5,
    "skipped_fps": 0,
    "detection_fps": 0,
    "pid": 221,
    "capture_pid": 226
  },
  "south_side": {
    "camera_fps": 5.1,
    "process_fps": 5.1,
    "skipped_fps": 0,
    "detection_fps": 0,
    "pid": 225,
    "capture_pid": 229
  },
  "detectors": {
    "coral": {
      "inference_speed": 55.4,
      "detection_start": 0,
      "pid": 217
    }
  },
  "detection_fps": 0,
  "service": {
    "uptime": 311,
    "version": "0.11.0-cbf26e0",
    "storage": {
      "/media/frigate/recordings": {
        "total": 235535.3,
        "used": 63994.4,
        "free": 161940.5,
        "mount_type": "ext4"
      },
      "/media/frigate/clips": {
        "total": 235535.3,
        "used": 63994.4,
        "free": 161940.5,
        "mount_type": "ext4"
      },
      "/tmp/cache": {
        "total": 4095,
        "used": 56.4,
        "free": 4038.5,
        "mount_type": "tmpfs"
      },
      "/dev/shm": {
        "total": 4095,
        "used": 1.3,
        "free": 4093.7,
        "mount_type": "tmpfs"
      }
    },
    "temperatures": {}
  }
}

You should definitely add a motion mask

Motion mask already exist. image

Coolie1101 commented 2 years ago

Any idea why I keep getting the following error?

Timeout error fetching information from http://ccab4aaf-frigate-fa-beta:5000/api/stats:

Also, any idea how I can increase the inference speed on a Raspberry Pi4 running HassOS?

DEBUG 0.11.0-CBF26E0

detector | inference speed | detection start | pid -- | -- | -- | -- coral | 53.78 | 0 | 217
camera | camera fps | process fps | skipped fps | detection fps | pid | capture pid -- | -- | -- | -- | -- | -- | -- porch | 5.1 | 5.1 | 0 | 0 | 223 | 227 south_side | 5.1 | 5.1 | 0 | 0 | 226 | 229
blakeblackshear commented 2 years ago

The integration looks like it's set up to point to the full access beta addon. If you have switched the the stable version of the addon, you need to remove and reconfigure the integration to update the url.

For inference speeds, lower is better. Those speeds look like USB2 speeds. Is it plugged into a USB3 port?

Coolie1101 commented 2 years ago

I am still using the bata version. Frigate NVR (Full Access) Beta (0.11.0

Hostname ccab4aaf-frigate-fa-beta

Coolie1101 commented 2 years ago

The integration looks like it's set up to point to the full access beta addon.

Errors still persist, and I am still using the Full Access Beta version. image

Also, I stopped receiving video with the automation below, I only receive the photo, any ideas?

Automation Action

action:
  - service: notify.group
    data:
      message: >-
        A {{trigger.payload_json["after"]["label"]}} was detected on the
        {{trigger.payload_json["after"]["camera"]}} camera.
      data:
        photo:
          - url: >-
              http://hass_url/api/frigate/notifications/{{trigger.payload_json["after"]["id"]}}/snapshot.jpg
            caption: >-
              'A {{trigger.payload_json["after"]["label"]}} was detected at the
              Front {{trigger.payload_json["after"]["entered_zones"]}}'.
  - delay:
      seconds: 30
  - service: notify.group
    data:
      message: Video of {{trigger.payload_json["after"]["label"]}}" detected.
      data:
        video:
          - url: >-
              http://hass_url/api/frigate/notifications/{{trigger.payload_json["after"]["id"]}}/{{trigger.payload_json["after"]["camera"]}}/clip.mp4
            timeout: 1000
            caption: >-
              'Video of {{trigger.payload_json["after"]["label"]}}" detected at
              the Front {{trigger.payload_json["after"]["entered_zones"]}}'.

LOGS

Logger: homeassistant.components.telegram_bot
Source: components/telegram_bot/__init__.py:798
Integration: Telegram bot (documentation, issues)
First occurred: March 12, 2022, 9:12:22 AM (85 occurrences)
Last logged: 8:55:11 AM

Can't send file with kwargs: {'message': 'Video of person" detected.', 'url': 'http://hass_url/api/frigate/notifications/1647468709.715787-tsefen/porch/clip.mp4', 'timeout': 1000, 'caption': '\'Video of person" detected at the Front [\'Porch\']\'.'}
Can't send file with kwargs: {'message': 'Video of person" detected.', 'url': 'http://hass_url/api/frigate/notifications/1647473117.722614-dmizdl/porch/clip.mp4', 'timeout': 1000, 'caption': '\'Video of person" detected at the Front [\'Porch\']\'.'}
Can't send file with kwargs: {'message': 'Video of person" detected.', 'url': 'http://hass_url/api/frigate/notifications/1647516870.548805-2cmi1j/porch/clip.mp4', 'timeout': 1000, 'caption': '\'Video of person" detected at the Front [\'Porch\']\'.'}
Can't send file with kwargs: {'message': 'Video of person" detected.', 'url': 'http://hass_url/api/frigate/notifications/1647518692.463201-3wb45u/porch/clip.mp4', 'timeout': 1000, 'caption': '\'Video of person" detected at the Front [\'Door\']\'.'}
Can't send file with kwargs: {'message': 'Video of person" detected.', 'url': 'http://hass_url/api/frigate/notifications/1647521677.710851-p4nfxt/porch/clip.mp4', 'timeout': 1000, 'caption': '\'Video of person" detected at the Front [\'Porch\']\'.'}
Coolie1101 commented 2 years ago

Nothing changed there. Check your HA logs to see if the integration needs to be reconfigured.

So, I did a fresh install and still don't see the sensors. any idea what the issue may be?

MQTT Raw / formatted JSON

{
  "porch_01": {
    "camera_fps": 5.1,
    "process_fps": 5.1,
    "skipped_fps": 0,
    "detection_fps": 0,
    "pid": 222,
    "capture_pid": 226
  },
  "south_side": {
    "camera_fps": 5,
    "process_fps": 5,
    "skipped_fps": 0,
    "detection_fps": 0,
    "pid": 224,
    "capture_pid": 227
  },
  "detectors": {
    "coral": {
      "inference_speed": 19.86,
      "detection_start": 0,
      "pid": 217
    }
  },
  "detection_fps": 0,
  "service": {
    "uptime": 263021,
    "version": "0.11.0-cbf26e0",
    "storage": {
      "/media/frigate/recordings": {
        "total": 235535.3,
        "used": 42590.8,
        "free": 183344.1,
        "mount_type": "ext4"
      },
      "/media/frigate/clips": {
        "total": 235535.3,
        "used": 42590.8,
        "free": 183344.1,
        "mount_type": "ext4"
      },
      "/tmp/cache": {
        "total": 4095,
        "used": 72.3,
        "free": 4022.7,
        "mount_type": "tmpfs"
      },
      "/dev/shm": {
        "total": 4095,
        "used": 1.3,
        "free": 4093.7,
        "mount_type": "tmpfs"
      }
    },
    "temperatures": {}
  }
}
blakeblackshear commented 2 years ago

Some sensors are mqtt based and some poll the stats endpoint. Specifically which sensors are not working?

The video endpoint is known to be broken in that unofficial beta. When an official bets is released, it will be fixed.

Coolie1101 commented 2 years ago

Specifically which sensors are not working?

Pretty much all the system (nvr) sensors as mentioned above and listed below, except for the following 2. image

sensor.frigate_nvr_cpu_percent
sensor.frigate_nvr_memory_percent
binary_sensor.frigate_nvr_running
sensor.frigate_nvr_version
sensor.frigate_nvr_newest_version
binary_sensor.frigate_nvr_update_available
blakeblackshear commented 2 years ago

I don't think the frigate integration provides those sensors. Are those created by the supervisor for addons?

Coolie1101 commented 2 years ago

I don't think the frigate integration provides those sensors. Are those created by the supervisor for addons?

I'm not sure, I assume they were created by the integration, but they all disappeared after upgrading.

blakeblackshear commented 2 years ago

I would look in the supervisor logs. The integration doesn't create them.

Coolie1101 commented 2 years ago

Not much pertaining to Frigate in the Supervisor Logs, except for a few entries about Frigate having full access.

blakeblackshear commented 2 years ago

All I know is that the integration doesn't create those sensors. I have never seen sensors like that because I do not run HassOS.

Coolie1101 commented 2 years ago

All I know is that the integration doesn't create those sensors.

They are indeed created by HA Supervisor, and was all disabled, not sure why, but they are all back up and running after manually re-enabling them.

image

Coolie1101 commented 2 years ago

So, I still can't figure out why the below send video action in my automation don't work, I tried reaching the url from the error log directly, but got the message below, could it be an issue with the ID?

Automation Action That Works

  - service: notify.group
    data_template:
      message: Some Message.
      data:
        photo:
          - url: >-
              http://192.168.200.211:8123/api/frigate/notifications/{{trigger.payload_json["after"]["id"]}}/snapshot.jpg
            caption: >-
              'A {{trigger.payload_json["after"]["label"]}} was detected at the
              Front {{trigger.payload_json["after"]["entered_zones"]}}'.

Automation Action that Don't Work

  - delay:
      seconds: 45
  - service: notify.group
    data_template:
      message: Video of {{trigger.payload_json["after"]["label"]}}" detected.
      data:
        video:
          - url: >-
              http://192.168.200.211:8123/api/frigate/notifications/{{trigger.payload_json["after"]["id"]}}/{{trigger.payload_json["after"]["camera"]}}/clip.mp4
            timeout: 5000
            caption: >-
              'Video of {{trigger.payload_json["after"]["label"]}}" detected at
              the Front {{trigger.payload_json["after"]["entered_zones"]}}'.

Error Log

Logger: homeassistant.components.telegram_bot
Source: components/telegram_bot/__init__.py:809
Integration: Telegram bot ([documentation](https://www.home-assistant.io/integrations/telegram_bot), [issues](https://github.com/home-assistant/home-assistant/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+telegram_bot%22))
First occurred: April 27, 2022, 8:09:39 PM (22 occurrences)
Last logged: 5:47:44 PM

Can't send file with kwargs: {'message': 'Video of person" detected.', 'url': 'http://192.168.200.211:8123/api/frigate/notifications/1651261173.422286-hnxrtc/porch_01/clip.mp4', 'timeout': 5000, 'caption': '\'Video of person" detected at the Front []\'.'}
Can't send file with kwargs: {'message': 'Video of person" detected.', 'url': 'http://192.168.200.211:8123/api/frigate/notifications/1651261366.842301-994nok/porch_01/clip.mp4', 'timeout': 5000, 'caption': '\'Video of person" detected at the Front [\'Porch\']\'.'}
Can't send file with kwargs: {'message': 'Video of person" detected.', 'url': 'http://192.168.200.211:8123/api/frigate/notifications/1651262777.82933-75r8o4/porch_01/clip.mp4', 'timeout': 5000, 'caption': '\'Video of person" detected at the Front [\'Steps\', \'Porch\']\'.'}
Can't send file with kwargs: {'message': 'Video of person" detected.', 'url': 'http://192.168.200.211:8123/api/frigate/notifications/1651267569.036967-z1wjxi/porch_01/clip.mp4', 'timeout': 5000, 'caption': '\'Video of person" detected at the Front [\'Steps\', \'Porch\']\'.'}
Can't send file with kwargs: {'message': 'Some Message.', 'url': 'http://192.168.200.211:8123/api/frigate/notifications/1651268803.686459-pcti8t/south_side/clip.mp4', 'timeout': 5000, 'caption': '\'Video of person" detected on the South Side Camera.\''}

Message after trying to access the video directly URL:- http://192.168.200.211:8123/api/frigate/notifications/1651261173.422286-hnxrtc/porch_01/clip.mp4 Msg: Could not create clip from recordings for porch_01.

*Files In Folder image

blakeblackshear commented 2 years ago

This is a known issue with the initial beta. It will be fixed when an official beta comes out for 0.11.0.

Coolie1101 commented 2 years ago

This is a known issue with the initial beta. It will be fixed when an official beta comes out for 0.11.0.

Just saw that Frigate+ is available, are there definitions for the various options/abilities listed?

Upload & annotate
Frigate integration
Support open source Frigate
Access to custom models

Also, does Frigate+ replace the add-on or used simultaneously?

Coolie1101 commented 2 years ago

I'm not sure what's happening, but since I updated to 0.11.0-beta2, and then reverted back to 0.11.0-beta, frigate seems to have stopped storing events, but snapshots exist for the entity in the integration, and automations with sending snapshots still work.

Last few stored events May 19th image

Last snapshot in integration May 23rd image

blakeblackshear commented 2 years ago

The database updates for beta 2 are not backwards compatible. You will either need to restore your old database file or delete the database file and let it get recreatead.

Coolie1101 commented 2 years ago

Would the old database still exist in the addon?, and if so, where would it be located?

blakeblackshear commented 2 years ago

The old database would only exist if you have backups somewhere.

Coolie1101 commented 2 years ago

This is a known issue with the initial beta. It will be fixed when an official beta comes out for 0.11.0.

Video clips in notifications now work in "0.11.0-beta3", but the Web UI / Dashboard is Blank.

Coolie1101 commented 2 years ago

@blakeblackshear Beta4 isn't showing up in HA Add-On Store or as an update.