blakeblackshear / frigate-hass-integration

Frigate integration for Home Assistant
MIT License
720 stars 113 forks source link

after 0.11.1 upgrade, HomeKit sends doorbell alerts for vanilla cameras #368

Closed blysik closed 1 year ago

blysik commented 1 year ago

I recently upgraded to Frigate 0.11.1 and version 3.0.0. After the upgrade, I now receive "doorbell" alerts from all my vanilla hikvision cameras when it detects people.

Is there a way I can disable this behavior? Thanks!

NickM-27 commented 1 year ago

This is going to be a homekit config issue, most likely you'll just want to filter out the binary_sensor.<camera_name>_person_occupancy entities and make sure they aren't added to HomeKit. Odds are this is being perceived as a doorbell due to its occupancy device class.

blysik commented 1 year ago

hmm. i added this to my homekit configuration:

filter:
  exclude_entity_globs:
      - binary_sensor.*_occupancy

Didn't seem to do the trick. I'm looking more.

blysik commented 1 year ago

And I'll note that no binary_sensors for these occupancy sensors are showing up in Home.app at all.

NickM-27 commented 1 year ago

Just found this: https://github.com/home-assistant/core/issues/78541

blysik commented 1 year ago

I'm testing the workaround in that issue. (Template always off binary sensor to link as a doorbell.) So far it seems to be working. Thanks!

bagobones commented 1 year ago

Is there anything in the way frigate exposes the sensors that they might be misclassified as doorbell or is this purely a HA issue?

On the HA side it isn't assigned to anyone as the default assignee removed them self.

I would say something like they are probably focusing on matter support, but matter does not have camera support so this issue and the workaround is kind of annoying for sure.

I haven't used the workaround as I suspect I will have to re-setup all my cameras again and selectively add them to my apple TVs again if the device type etc changes in a future update. So for now I only have my real doorbell exposed in HA.

NickM-27 commented 1 year ago

Is there anything in the way frigate exposes the sensors that they might be misclassified as doorbell or is this purely a HA issue?

It could be that the sensor uses device_class: occupancy but then we'd expect this to happen for all objects detected and not just person

bagobones commented 1 year ago

Is there anything in the way frigate exposes the sensors that they might be misclassified as doorbell or is this purely a HA issue?

It could be that the sensor uses device_class: occupancy but then we'd expect this to happen for all objects detected and not just person

motion would be a more appropriate device class based on what is actually detected and how most cameras work..

Also the way they trigger in frigate (no object tracking, just raw output) motion would make more sense.. Occupancy sensors are normally long on off period sensors and motion more short on off.

Would you be able to run a test with the class changed?

NickM-27 commented 1 year ago

motion would be a more appropriate device class based on what is actually detected and how most cameras work..

The author of this issue said that disabling person detection stopped this from happening, so I'm not sure on motion.

Also the way they trigger in frigate (no object tracking, just raw output) motion would make more sense.. Occupancy sensors are normally long on off period sensors and motion more short on off.

Well, the default config for the motion sensor in frigate requires 30 seconds of no motion to go back to off (by default).

Would you be able to run a test with the class changed?

You can just go into your custom components folder and comment out https://github.com/blakeblackshear/frigate-hass-integration/blob/master/custom_components/frigate/binary_sensor.py#L134 then restart HA

bagobones commented 1 year ago

I actually am using person detection as I remapped that for my door bell so that isn't an option. I would also only want to use PERSON motion events mapped to the other cameras if I set them up.

30 seconds isn't much frigate sends an event every time it detects an object even if it is still and lost sight of it for a few seconds. At least as per discussions previously of the difference between how the mqtt / ha sensors worked vs how events work (they have stationary object code)

NickM-27 commented 1 year ago

I actually am using person detection as I remapped that for my door bell so that isn't an option.

What are you referring to, what is not an option?

I would also only want to use PERSON motion events mapped to the other cameras if I set them up.

I think, to be explicit, we should not refer to object events as motion but as occupancy.

30 seconds isn't much frigate sends an event every time it detects an object even if it is still and lost sight of it for a few seconds. At least as per discussions previously of the difference between how the mqtt / ha sensors worked vs how events work (they have stationary object code)

The 30 seconds is only referring to the motion sensor, not the object occupancy sensors

bagobones commented 1 year ago

What are you referring to, what is not an option?

Disabling person detection, I DO want to use that in HA and have it re-mapped to the person sensor instead of the random one HA assigned.

I think, to be explicit, we should not refer to object events as motion but as occupancy.

Probably a good idea to look at how other cameras and integrations eposes object detection.

As far as I can tell Dahua / Amcrest / Homekit enabled devices all refer to person / face / object detection as motion events.

The 30 seconds is only referring to the motion sensor, not the object occupancy sensors

Correction I was thinking of person count (highly erratic), however person occupancy is more stable. So if there is a 30 second cool down I suppose that would meet the definition of occupancy.

NickM-27 commented 1 year ago

Disabling person detection, I DO want to use that in HA and have it re-mapped to the person sensor instead of the random one HA assigned.

I wasn't suggesting it as a fix. Simply that the user said it was person detection disabling it that stopped it for them which suggests it isn't the motion sensor doing this.

Correction I was thinking of person count (highly erratic), however person occupancy is more stable. So if there is a 30 second cool down I suppose that would meet the definition of occupancy

The occupancy sensors do not have any cool down, they are raw output from what frigate detects. The only sensor that has a cool down is the basic motion sensor.

github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

t0ny-peng commented 1 year ago

Seems there's some effort in Home Assistant repo to resolve this issue, and the suggestion is to upgrade to the new event component: https://github.com/home-assistant/architecture/discussions/929

Discussion: https://github.com/home-assistant/core/issues/78541

NickM-27 commented 1 year ago

That's not totally clear what is meant by "old system".

And using the event component for things like person detected instead of the occupancy sensor like it is now wouldn't make sense in my opinion. The event component is for events, stateless things that occur.