home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
69.98k stars 29.06k forks source link

HomeKit accessory Cameras are all generating as doorbells. #78541

Open bagobones opened 1 year ago

bagobones commented 1 year ago

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

probot-home-assistant[bot] commented 1 year ago

homekit documentation homekit source (message by IssueLinks)

probot-home-assistant[bot] commented 1 year ago

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)

bagobones commented 1 year ago

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 commented 1 year ago
  - 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.
wez commented 1 year ago

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?

bagobones commented 1 year ago

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.

ChrisRegado commented 1 year ago

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.

MagnaPilot commented 1 year ago

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

bagobones commented 1 year ago

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

robgridley commented 1 year ago

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"
      }
acateon commented 1 year ago

I’m also having this problem.

DanClarke-io commented 1 year ago

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
bagobones commented 1 year ago

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.

bdraco commented 1 year ago

Please stop tagging me. Thanks

MagnaPilot commented 1 year ago

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.

wryandginger commented 1 year ago

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.

bagobones commented 1 year ago

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.

MagnaPilot commented 1 year ago

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?

bagobones commented 1 year ago

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.

marky421 commented 1 year ago

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.

blysik commented 1 year ago

This workaround is doing the trick for me now, thanks.

HVR88 commented 1 year ago

Unfortunately, when 16.2 is updated on all your hubs/devices and Homekit updated to the new architecture, everything will eventually stop working. Wrong accessory class is going to seem like a fond memory.

bagobones commented 1 year ago

And cameras are not supported in the matter spec at all yet.

blysik commented 1 year ago

Unfortunately, when 16.2 is updated on all your hubs/devices and Homekit updated to the new architecture, everything will eventually stop working. Wrong accessory class is going to seem like a fond memory.

Is there a bug or anything tracking this problem? Is this a real upcoming issue?

HVR88 commented 1 year ago

Is there a bug or anything tracking this problem? Is this a real upcoming issue?

This is one related issue here: https://github.com/home-assistant/core/issues/81882

The HomeKit integration is a janky mess, IMO. Even things like editing a bridge instance are problematic. Deleting a bridge in Home doesn't always (rarely) brings its QR code back to Home Assistant, requiring one to remake it from scratch.

At the moment, nothing I expose to HomeKit from HA works at all. If I delete a bridge in Home and try re-adding it after a change, it won't add back at all.

Three classes of moving targets right now in my installation. Home Assistant, Homekit via HomePod, iOS,iPadOS and tvOS updates, plus Eero router firmware. It's really difficult to troubleshoot when I can't roll back the software on Eero or the Apple/Home stuff.

issue-triage-workflows[bot] commented 1 year ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

bagobones commented 1 year ago

This issue should not be stale.

t0ny-peng commented 1 year ago

I'm also seeing such problem. And since all the cameras HomeKits are added via the Integration page, there's no configuration to associate the cameras with an always-off-binary_sensor to fool it.

bagobones commented 1 year ago

I'm also seeing such problem. And since all the cameras HomeKits are added via the Integration page, there's no configuration to associate the cameras with an always-off-binary_sensor to fool it.

Only way to work around it at the moment is to create the camera in the YAML config which is still supported but clunky as well.

bdraco commented 1 year ago

This issue is waiting for an architecture change see https://github.com/home-assistant/core/pull/87559

Manual configuration via yaml is the best option for now.

d3wy commented 1 year ago

Seems odd with the HA development team's push to GUI the world! That the GUI for Homekit is missing so much configuration causing this issue to be such a pain. Being woken up by a doorbell chime whenever a car drives past the house in the middle of the night is so much fun!

codyc1515 commented 12 months ago

It looks like your pull got closed for being stale somehow, @bdraco.

bdraco commented 12 months ago

See https://github.com/home-assistant/architecture/discussions/929

sarthurdev commented 11 months ago

With the required event component merged, will this also be included for 2023.8?

bdraco commented 11 months ago

We need every integration using the old system to migrate to the new system and wait out the 6 month breaking change window

Than we can remove support for this from HomeKit and wait out another 6 month breaking change window

Best case 12 months, but integrations authors are mostly volunteers and not under any obligation to migrate to the new system so the likely time before we can fully switch is 18-36months

issue-triage-workflows[bot] commented 8 months ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

codyc1515 commented 8 months ago

Still happening

d3wy commented 8 months ago

Issue is still occuring.

Tezzlicious commented 7 months ago

Had to turn off doorbell notification per camera in the Home app to work around this.

HVR88 commented 7 months ago

Best advice I can give, based on my own experience: give up exposing cameras to homekit directly from Home Assistant and instead use Scrypted

This is honestly the best change I've made to Home Assistant in the past two years. I've never been happy with camera performance in HA, whether it be RTSP or ONVIF. Using Scrypted on the other had provides much faster stream response. I'm using Scrypted within HA as an add-on and currently have 4 cameras exposed to homekit, all with Homekit Secure Video support working 100%. One doorbell and three bullet cameras. Only the doorbell shows up as a doorbell - as expected.

issue-triage-workflows[bot] commented 4 months ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

LarsStegman commented 4 months ago

Not stale

HVR88 commented 4 months ago

Might as well close this and other Homekit issues as "not going to fix" - pretty obvious by this point.

jcutrell commented 1 month ago

This is still happening for me too.

bdraco commented 2 weeks ago

update on https://github.com/home-assistant/core/issues/78541#issuecomment-1647824796

event entity support https://github.com/home-assistant/core/pull/120834

After most integrations move to event entities for doorbells we can remove the old binary_sensor support

There are a few remaining at this point:

bdraco commented 1 week ago

121392 will add the event platform for august