Trigger Apple TV camera popup from Unifi Protect loitering alert (no doorbell hardware needed) homebridge

The problem

I wanted a specific Unifi Protect AI alert (person loitering) to automatically pop up the camera feed on my Apple TV 4K. The catch:

  • My cameras are G6 Turrets — not doorbell cameras, so no doorbell entity in HA
  • Apple TV only auto-pops camera feeds for doorbell accessories in HomeKit, not plain cameras
  • The loitering alert is only available via webhook from Unifi, not as a native HA device trigger
  • I didn't want general motion to trigger the popup, only the specific loitering alert

The Solution
Two blocks in configuration.yaml — no automation needed.
Configure Webhook in HA to Use in Unifi Alarm Manager and the Template

1..Webhook-triggered template binary sensor*

This listens directly for the Unifi webhook and turns on for 5 seconds, acting as the virtual doorbell press:

template:
  - trigger:
      - trigger: webhook
        webhook_id: "YOUR_WEBHOOK_ID"
    binary_sensor:
      - name: "Front Door Loitering"
        unique_id: front_door_loitering
        device_class: occupancy
        auto_off:
          seconds: 5
        state: "true"

Replace YOUR_WEBHOOK_ID with whatever ID you want. Your Unifi webhook URL becomes: http://YOUR_HA_IP:8123/api/webhook/YOUR_WEBHOOK_ID

2. Expose the camera as a HomeKit doorbell accessory

This creates a separate HomeKit accessory (paired independently) that presents the camera as a doorbell device type, with a template binary sensor as the virtual doorbell button:

homekit:
  - name: Front Door Doorbell
    port: 21067
    mode: accessory
    filter:
      include_entities:
        - camera.your_camera_entity
    entity_config:
      camera.your_camera_entity:
        name: "Front Door"
        linked_doorbell_sensor: binary_sensor.front_door_loitering
        support_audio: true

Note: mode: accessory is required for a single camera doorbell. Make sure the port doesn't conflict with your other HomeKit bridges.

How it works

  1. Unifi Protect Alarm Manger fires the loitering webhook
  2. Template binary sensor turns on immediately
  3. HomeKit Bridge sees the linked doorbell sensor trigger
  4. Apple TV pops the camera feed
  5. Binary sensor auto turns off after 5 seconds, ready for next alert
2 Likes