core icon indicating copy to clipboard operation
core copied to clipboard

HomeKit accessory Cameras are all generating as doorbells.

Open bagobones opened this issue 1 year ago • 45 comments

The problem

I want to export 3 cameras from frigate in HA to homekit.

One is a doorbell the other two I just want to be motion based on the people occupancy sensor.

However all 3 appear to generate as doorbells when viewed in homekit and automatically seem to have a doorbell senor linked even if not configured.

support_audio: false also appears to be ignored as they all show up with audio and push to talk options.

What version of Home Assistant Core has the issue?

core-2022.9.4

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Container

Integration causing the issue

HomeKit

Link to integration documentation on our website

https://www.home-assistant.io/integrations/homekit/

Diagnostics information

No response

Example YAML snippet

##homekit
  - name: "Notifications"
    mode: accessory
    port: 51001
    filter:
      include_entities:
        - camera.homekit_notification_camera    
    entity_config:
      camera.homekit_notification_camera:
        linked_motion_sensor: binary_sensor.homekit_notification_motion
  - name: "Doorbell"
    mode: accessory
    port: 51002
    filter:
      include_entities:
        - camera.doorbell    
    entity_config:
      camera.doorbell:
        support_audio: false
        linked_doorbell_sensor: binary_sensor.front_door_doorbell_button_pressed
  - name: "Garage Front"
    mode: accessory
    port: 51003
    filter:
      include_entities:
        - camera.garage_front    
    entity_config:
      camera.garage_front:
        support_audio: false
        linked_motion_sensor: binary_sensor.garage_front_person_occupancy
  - name: "Backyard"
    mode: accessory
    port: 51004
    filter:
      include_entities:
        - camera.backyard    
    entity_config:
      camera.backyard:
        support_audio: false
        linked_motion_sensor: binary_sensor.backyard_person_occupancy

Anything in the logs that might be useful for us?

No response

Additional information

No response

bagobones avatar Sep 15 '22 15:09 bagobones

homekit documentation homekit source (message by IssueLinks)

Hey there @bdraco, mind taking a look at this issue as it has been labeled with an integration (homekit) you are listed as a code owner for? Thanks! (message by CodeOwnersMention)

I am not sure how to check this but I THINK the integration is "implicitly" adding entities such as motion sensors if they exist even if I have not defined them.

From the config I provided before:

"Doorbell" is home how generating MOTION events in homekit but I did not define a MOTION sensor only a doorbell sensor.

"Garage Front" and "Backyard" are generating doorbell events on "motion" as far as I can tell.. This indicates that a doorbell sensor was generated and linked to one of the motion / people sensors on the HA camera they are linked to.

This is not desired as 1 I have no idea which sensor has been linked to the doorbell press / sensor and two doorbell events are default broadcast to EVERY Homekit device, where motion events are opt in by default.

bagobones avatar Sep 15 '22 17:09 bagobones

  - name: "Garage Front"
    mode: accessory
    port: 51003
    filter:
      include_entities:
        - camera.garage_front    
    entity_config:
      camera.garage_front:
        support_audio: false
        linked_motion_sensor: binary_sensor.garage_front_person_occupancy

Just figured out how to download the diagnostics for the integration.

It looks like it is randomly linking one of the many other sensors that are part of the frigate camera, in this case it just decides to link the bird sensor to the door bell.

  "data": {
    "status": 1,
    "config-entry": {
      "title": "Garage Front:51003",
      "version": 1,
      "data": {
        "name": "Garage Front",
        "port": 51003,
        "index": 2
      },
      "options": {
        "filter": {
          "include_entities": [
            "camera.garage_front"
          ],
          "include_entity_globs": [],
          "include_domains": [],
          "exclude_entities": [],
          "exclude_entity_globs": [],
          "exclude_domains": []
        },
        "entity_config": {
          "camera.garage_front": {
            "support_audio": false,
            "linked_motion_sensor": "binary_sensor.garage_front_person_occupancy",
            "video_map": "0:v:0",
            "max_height": 1080,
            "audio_map": "0:a:0",
            "max_fps": 30,
            "audio_codec": "libopus",
            "audio_packet_size": 188,
            "video_codec": "libx264",
            "low_battery_threshold": 20,
            "stream_count": 3,
            "video_packet_size": 1316,
            "max_width": 1920,
            "manufacturer": "Frigate",
            "model": "3.0.0-rc.4/0.11.0-be7b858",
            "platform": "frigate",
            "linked_doorbell_sensor": "binary_sensor.garage_front_bird_occupancy"
          }
        },
        "mode": "accessory"
      }
    },
  1. I would not expect any of the sensors to AUTO configure in YAML mode.
  2. I don't see a way in the documentation to override the linking.

bagobones avatar Sep 22 '22 02:09 bagobones

the doorbell on motion is driving me nuts; I have 3 cameras that overlook that path that people take to the front door, so I get multiple doorbells as they walk to the door, and those ring out across multiple homepods. Is there an effective workaround to suppress all doorbells from the homekit/frigate integration?

wez avatar Oct 01 '22 21:10 wez

the doorbell on motion is driving me nuts; I have 3 cameras that overlook that path that people take to the front door, so I get multiple doorbells as they walk to the door, and those ring out across multiple homepods.

Is there an effective workaround to suppress all doorbells from the homekit/frigate integration?

I view this as a bug in the HomeKit YAML accessory config it should not be randomly mapping available sensors from the device period, only the ones in the YAML.

bagobones avatar Oct 01 '22 22:10 bagobones

HomeKit defaults doorbell push notifications to "on" (whereas normal motion sensors default to "off"), meaning you have to go disable each camera's doorbell notification on each of your Apple devices' settings. Having an arbitrarily mapped doorbell sensor is much more intrusive than having an arbitrarily mapped motion sensor.

As a workaround, I've been assigning a fake sensor as the doorbell for each of my cameras:

binary_sensor:
    - platform: template
      sensors:
        always_off_occupancy_sensor:
          value_template: off
          friendly_name: "Always Off Occupancy Sensor"
          device_class: occupancy
          unique_id: binary_sensor.always_off_occupancy_sensor

# homekit:
      camera.front:
        name: Front Camera
        linked_doorbell_sensor: binary_sensor.always_off_occupancy_sensor
        linked_motion_sensor: my-real-motion-sensor

HomeKit still thinks each camera has a doorbell, but it never triggers an event, so I can just ignore the doorbell notification settings on my Apple devices.

ChrisRegado avatar Oct 01 '22 23:10 ChrisRegado

Just wanted to chime in and say I have an installation that is also having the same issue. A camera exposed to homekit via HA is now bound to a motion sensor in an Esphome device, and reporting a doorbell press everytime the motion sensor triggers. I can provide diagnostic info if needed. The integration in this case is configured entirely by GUI, no yaml in the configuration. Started in 2022.9.4 and continued on to 2022.10.1

MagnaPilot avatar Oct 15 '22 11:10 MagnaPilot

@bdraco any thoughts on this issue? It was left un assigned.

bagobones avatar Oct 23 '22 05:10 bagobones

Same issue.

    "config-entry": {
      "title": "Backyard Camera:21063",
      "version": 1,
      "data": {
        "port": 21063,
        "name": "Backyard Camera"
      },
      "options": {
        "filter": {
          "include_entities": [
            "camera.backyard"
          ],
          "include_entity_globs": [],
          "exclude_domains": [],
          "include_domains": [],
          "exclude_entity_globs": [],
          "exclude_entities": []
        },
        "entity_config": {
          "camera.backyard": {
            "linked_motion_sensor": "binary_sensor.backyard_all_occupancy",
            "video_codec": "copy",
            "max_width": 2048,
            "max_height": 1536,
            "max_fps": 15,
            "low_battery_threshold": 20,
            "video_packet_size": 1316,
            "support_audio": false,
            "audio_codec": "libopus",
            "stream_count": 3,
            "video_map": "0:v:0",
            "audio_packet_size": 188,
            "audio_map": "0:a:0",
            "manufacturer": "Frigate",
            "model": "3.0.0/0.11.1-2eada21",
            "platform": "frigate",
            "linked_doorbell_sensor": "binary_sensor.backyard_motorcycle_occupancy"
          }
        },
        "mode": "accessory"
      }

robgridley avatar Oct 24 '22 16:10 robgridley

I’m also having this problem.

acateon avatar Oct 24 '22 21:10 acateon

Just wanted to add that after doing a upgrade to my docker HA it reset all my doorbell settings. So even though I'd gone to every device and turned off doorbell settings in HomeKit, it re-applied them on after the upgrade to 2022.11 of HA.

Hoping someone can look into this, as the above linked_doorbell_sensor idea doesn't seem to be working for me:

homekit:
  filter:
    include_entities:
      camera.back_garden_2:
        linked_doorbell_sensor: binary_sensor.always_off_occupancy_sensor
      camera.driveway_2:
        linked_doorbell_sensor: binary_sensor.always_off_occupancy_sensor
      camera.kitchen:
        linked_doorbell_sensor: binary_sensor.always_off_occupancy_sensor
      camera.side_passage_2:
        linked_doorbell_sensor: binary_sensor.always_off_occupancy_sensor

DanClarke-io avatar Nov 03 '22 15:11 DanClarke-io

This ticket is unassigned so no one is looking at it, not sure why @bdraco removed them selves from the ticket as they are apparently the maintainer of the homekit integration.

It really does mess up homekit cameras badly when trying to use them from frigate, it is unclear why it is auto mapping the doorbell can't tell if this is the fault of the integration or something frigate is doing, but since the frigate cameras do not appear as doorbells in homeassistant I assume it is the homekit integration at fault.

I suspect the up coming matter integration is taking resources and priority.

bagobones avatar Nov 03 '22 17:11 bagobones

Please stop tagging me. Thanks

bdraco avatar Nov 03 '22 17:11 bdraco

Can confirm, 2022.11 didn't cope well either. I too am using Frigate cameras, I'm curious if anyone else with the problem is also using Frigate for cameras, maybe there is something to this.

MagnaPilot avatar Nov 03 '22 20:11 MagnaPilot

I'm using Frigate cameras and I'm also having the doorbell issue.

What appears to happen is with every update to homeassistant my camera settings somehow reset in HomeKit. I've disabled notifications on those cameras several times, but when home assistant updates anything, those super annoying doorbell notifications keep reappearing. The only solution I've found is to completely disable all notifications from HomeKit on each device.

It's insanely irritating to have to keep turning this crap off. I really wish there was a global HomeKit setting to disable notifications so I don't have to do this on my iPhone, my MacBook, by partner's iPhone, my partner's iPad, my Apple TVs....etc. every single time there's an update to home assistant. Disabling all HomeKit notifications is the only workaround.

wryandginger avatar Nov 06 '22 18:11 wryandginger

It's insanely irritating to have to keep turning this crap off. I really wish there was a global HomeKit setting to disable notifications so I don't have to do this on my iPhone, my MacBook, by partner's iPhone, my partner's iPad, my Apple TVs....etc. every single time there's an update to home assistant. Disabling all HomeKit notifications is the only workaround.

The problem is that it is a Doorbell, camera motion events are not enabled by default in HomeKit, it is because it is a doorbell that it started enabled on all devices.

There was a recent fix for device IDs for homekit, that might fix the resetting part but still the Doorbell bug is strange.

bagobones avatar Nov 06 '22 19:11 bagobones

There does seem to be a common thread here, and I don't know why that is for sure, but we all seem to be using Frigate for our cameras. Perhaps this is something to do with the Frigate addon as well?

MagnaPilot avatar Nov 08 '22 21:11 MagnaPilot

There does seem to be a common thread here, and I don't know why that is for sure, but we all seem to be using Frigate for our cameras. Perhaps this is something to do with the Frigate addon as well?

Maybe or it might be because frigate is popular and each camera has several sensors.

bagobones avatar Nov 09 '22 03:11 bagobones

Exact same issue for me with my frigate cameras. I just updated HA today and the problem started immediately. I updated frigate a few days ago but the problem didn’t start until I updated HA.

marky421 avatar Nov 10 '22 01:11 marky421