hjdhjd / homebridge-unifi-protect

:video_camera: Complete HomeKit integration for all UniFi Protect device types with full support for most features including HomeKit Secure Video, and more. https://homebridge.io
Other
1.43k stars 88 forks source link

G4 Instant Camera streaming works but not HKSV auto snapshots neither event recording #1100

Closed ozitvogel closed 3 weeks ago

ozitvogel commented 3 weeks ago

Homebridge UniFi Protect Version

v7.1.2

Homebridge Platform and OS

Raspberry Pi 4, Raspbian GNU/Linux 11 (bullseye)

Homebridge Version

v1.8.4 (HAP v0.12.2)

Node Version

v20.12.0

UniFi OS Version

UDM Pro v4.0.6

UniFi Protect Controller Version

v4.0.33

Describe the problem

Facts:

It is like HomeKit does not ask for it. However the cameras are reported to be registered in HK (Stream and Record) and detections is set to all. Also, detection trigger does properly activate on movements in HK app.

Please note that the G4 Instant stream options in RTSPS are :

Med is selected by default by the Plugin for G4 Instants and High (1920x1080@30fps) for the G3s. High (2688x1512@30fps) seems not to be selected maybe because its resolution is not supported by HK ? Forcing any of them in the Plugin configuration does not help. I tried Plugins settings like HW acceleration on/off, Smart motion sensors on/off, transcoding vs transmuxing.

Notes:

Homebridge HBUP JSON configuration

{
    "controllers": [
        {
            "address": "192.168.1.1",
            "password": "HIDDEN",
            "username": "homebridge"
        }
    ],
    "name": "UniFi Protect",
    "options": [
        "Enable.Video.Transcode.Hardware",
        "Disable.Video.Transcode",
        "Disable.Video.Transcode.HighLatency",
        "Enable.Motion.SmartDetect.ObjectSensors.70A7415FB64F",
        "Enable.Motion.SmartDetect.70A7415FB237",
        "Enable.Motion.SmartDetect.ObjectSensors.70A7415FB237",
        "Enable.Motion.SmartDetect.70A7415FB64F"
    ],
    "verboseFfmpeg": true,
    "platform": "UniFi Protect"
}

Relevant log output

[15/08/2024 07:54:27] [UniFi Protect] GW Maison [UDM-PRO]: Connected to 192.168.1.1 (UniFi Protect 4.0.33 running on UniFi OS 4.0.6).
[15/08/2024 07:54:27] [UniFi Protect] GW Maison [UDM-PRO]: Discovered nvr: GW Maison [UDM Pro] (address: 192.168.1.1 mac: 68D79A551435).
[15/08/2024 07:54:27] [UniFi Protect] GW Maison [UDM-PRO]: Discovered camera: Piscine [G3 Dome] (address: 192.168.1.196 mac: FCECDA8FEAE4).
[15/08/2024 07:54:27] [UniFi Protect] GW Maison [UDM-PRO]: Discovered camera: Entrée [G3 Micro] (address: 192.168.1.116 mac: F09FC2C1E25D).
[15/08/2024 07:54:27] [UniFi Protect] GW Maison [UDM-PRO]: Discovered camera: Séjour [G3 Bullet] (address: 192.168.1.245 mac: FCECDA30C944).
[15/08/2024 07:54:27] [UniFi Protect] GW Maison [UDM-PRO]: Discovered camera: Cinéma [G4 Instant] (address: 192.168.1.101 mac: 70A7415FB64F).
[15/08/2024 07:54:27] [UniFi Protect] GW Maison [UDM-PRO]: Discovered camera: Cuisine [G4 Instant] (address: 192.168.1.177 mac: 70A7415FB237).
[15/08/2024 07:54:27] [UniFi Protect] Cinéma [G4 Instant]: Smart motion detection enabled: animal, person, vehicle.
[15/08/2024 07:54:27] [UniFi Protect] Cinéma [G4 Instant]: Smart motion contact sensors enabled: animal, person, vehicle.
[15/08/2024 07:54:27] [UniFi Protect] Cinéma [G4 Instant]: WARNING: Smart motion detection and HomeKit Secure Video provide overlapping functionality. Only HomeKit Secure Video, when event recording is enabled in the Home app, will be used to trigger motion event notifications for this camera. Smart motion contact sensors will continue to function using telemetry from UniFi Protect.
[15/08/2024 07:54:27] [UniFi Protect] Cuisine [G4 Instant]: Smart motion detection enabled: animal, person, vehicle.
[15/08/2024 07:54:27] [UniFi Protect] Cuisine [G4 Instant]: Smart motion contact sensors enabled: animal, person, vehicle.
[15/08/2024 07:54:27] [UniFi Protect] Cuisine [G4 Instant]: WARNING: Smart motion detection and HomeKit Secure Video provide overlapping functionality. Only HomeKit Secure Video, when event recording is enabled in the Home app, will be used to trigger motion event notifications for this camera. Smart motion contact sensors will continue to function using telemetry from UniFi Protect.
[15/08/2024 07:54:27] [UniFi Protect] GW Maison [UDM-PRO]: Hardware-accelerated transcoding enabled: Raspberry Pi hardware acceleration will be used for livestreaming. HomeKit Secure Video recordings are not supported by the hardware encoder and will use software transcoding instead.
[15/08/2024 07:54:30] [UniFi Protect] Piscine [G3 Dome]: HKSV: hardware-accelerated 1920x1080@30fps (High) [H264], 2,000 kbps (10 second timeshift buffer).
[15/08/2024 07:54:30] [UniFi Protect] Entrée [G3 Micro]: HKSV: hardware-accelerated 1920x1080@30fps (High) [H264], 2,000 kbps (10 second timeshift buffer).
[15/08/2024 07:54:30] [UniFi Protect] Séjour [G3 Bullet]: HKSV: hardware-accelerated 1920x1080@30fps (High) [H264], 2,000 kbps (10 second timeshift buffer).
[15/08/2024 07:54:30] [UniFi Protect] Cinéma [G4 Instant]: HKSV: hardware-accelerated 1280x720@30fps (Medium) [H264], 2,000 kbps (10 second timeshift buffer).
[15/08/2024 07:54:30] [UniFi Protect] Cuisine [G4 Instant]: HKSV: hardware-accelerated 1280x720@30fps (Medium) [H264], 2,000 kbps (10 second timeshift buffer).

Acknowledgment that you are only running UniFi OS and UniFi Protect releases from the Ubiquiti Official release channel

hjdhjd commented 3 weeks ago

I've heard a few reports of issues with G4 Instant. There's definitely an HBUP issue with respect to auto selecting the right stream by default (it should pick high), that'll be addressed in the next release.

That said, that's not the core issue here.

If you're having issues with snapshots, especially given the lower end nature of Pi4's limitations, you might want to disable high performance snapshots and see how that helps.

With respect to HKSV - I suspect this is a latency issue in part due to the hardware limitations of the Pi4. HKSV is very sensitive to latency...it really wants things as quickly as possible and in a certain form. It's also occasionally just plain quirky. You might want to try combinations of enabling and disabling HKSV on the G4 Instant and/or rebooting your HomeKit hubs. I find ATV hubs tend to work better than HomePods, but until iOS 18 we won't be able to tell HomeKit which to use as a hub.

None of this is satisfying, I recognize. I appreciate you raising it. It's on my radar. I'm going to run a few things in my environment with a G4 Instant as well to see what I can do. Hoping to get an update out in short order. Thanks again!

ozitvogel commented 3 weeks ago

Thanks for your quick reply.

Snapshots:

HKSV:

I would really love to help there (if it is even possible) as I love your work and followed your progress from the first revision: congrats for that.

hjdhjd commented 3 weeks ago

You can turn on logging for when HKSV events are requested through the webUI. There's nothing more to be shown beyond that. HKSV is a black box. HomeKit makes the request for an event or not.

ozitvogel commented 3 weeks ago

OK I did activate the logging options for all of my cameras. Motion events are properly reported for all cameras. HK simply does not ask for video for the G4 Instant cameras. I also added and removed all of my cameras and now HK does not update snapshot nor records motion for all other cameras so I believe this is a HK issue and not a plugin issue.

hjdhjd commented 3 weeks ago

Glad you satisfied your itch. As I mentioned, I’ll be addressing a couple of things on G4 Instants soon. Thanks again for the report. 😄

ozitvogel commented 3 weeks ago

My issue is now fixed. So that you know. I noticed that HK was reporting one of my HB Accessory - instead of an HB HUB - as the HUB serving my devices including some of my Ubiquiti cameras (!). So I recreated the HB HUB from scratch (+ one instance dedicated to the Ubiquiti cameras) and everything works fine now. Very strange that HK ends up in mixing an accessory and a HUB...

github-actions[bot] commented 2 weeks ago

This issue is locked to prevent necroposting on closed issues. Please create a new issue for related support requests, bug reports, or feature suggestions.