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.45k stars 93 forks source link

Package camera snapshot is occasionally taken from the main camera #1058

Closed landlord11 closed 5 months ago

landlord11 commented 6 months ago

Homebridge UniFi Protect Version

v6.20.0, v6.19.0

Homebridge Platform and OS

macOS Sonoma

Homebridge Version

v1.7.0

Node Version

v20.8.0

UniFi OS Version

v3.2.12

UniFi Protect Controller Version

v3.0.22

Describe the problem

I have a G4 Doorbell Pro. Occasionally the snapshot for the package camera is pulled from the main camera. This started with the snapshot handling changes in v6.19.0 and was not a problem before then. Opening the camera feed always streams the correct feed for the package camera, and afterwards the snapshot is correct.

I attached a video clip of the Home app showing the problem. I cropped it to only show the doorbell camera (top) and package camera (bottom). I tap on the bottom camera, the feed starts after a few seconds and switches to the package camera feed, then I close out and the bottom camera snapshot is correct.

https://github.com/hjdhjd/homebridge-unifi-protect/assets/5098739/7a84d752-7946-4f9b-85d7-3a635eb02376

Homebridge HBUP JSON configuration

"controllers": [
                {
                    "address": "xxxxx",
                    "doorbellMessages": [
                        {
                            "duration": 0,
                            "message": "Be right there"
                        },
                        {
                            "duration": 0,
                            "message": "Leave package on table"
                        }
                    ],
                    "password": "xxxxx",
                    "username": "xxxxx"
                }
            ],
            "options": [
                "Enable.Device.StatusLed.602232609815",
                "Enable.Log.Motion.602232609815",
                "Enable.Audio.Filter.Noise.D021F992113F",
                "Enable.Audio.Filter.Noise.D021F992120D",
                "Enable.Audio.Filter.Noise.FftNr.D021F992120D.97",
                "Enable.Audio.Filter.Noise.FftNr.D021F992113F.97",
                "Enable.Audio.Filter.Noise.602232609815",
                "Enable.Audio.Filter.Noise.FftNr.D021F9921187.97",
                "Enable.Audio.Filter.Noise.HighPass.D021F9921187.400",
                "Enable.Audio.Filter.Noise.LowPass.D021F9921187.1500",
                "Enable.Audio.Filter.Noise.HighPass.D021F992120D.400",
                "Enable.Audio.Filter.Noise.LowPass.D021F992120D.1500",
                "Enable.Audio.Filter.Noise.HighPass.D021F992113F.400",
                "Enable.Audio.Filter.Noise.LowPass.D021F992113F.1500",
                "Enable.Video.Stream.Only.High.602232609815",
                "Enable.Video.Transcode.Hardware.602232609815"
            ],
            "verboseFfmpeg": false,
            "_bridge": {
                "name": "Homebridge Unifi",
                "username": "xxxxx",
                "port": 12345
            },
            "platform": "UniFi Protect"

Relevant log output

I don't see anything relevant in the logs, just various motion detection events.

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

hjdhjd commented 5 months ago

Thanks for the report. This is a bug in the last 2-3 recent UniFi Protect firmware releases and not an HBUP issue. Hopefully it'll be fixed in the next Protect firmware or two. In the meantime, you can forcibly reboot the doorbell and that should do the trick. Frustrating, to be sure I'm afraid.

This did not start with 6.19.0, though I understand the instinct to assume correlation = causation. 😄

If you suspect it's the new high performance snapshots causing the issue, you can disable it in the HBUP webUI for the doorbell. That will revert to the old behavior.

If you still see the issue after trying that, you can A/B test by reverting to 6.18. You can also further take a look at the native Protect app itself and use that as a further correlation point.

I experience this issue myself, so I'm keenly aware of the current Protect firmware buginess, but always open to hearing about other experiences, and if there's a regression in HBUP I'd love to address it. In my testing, this issue is on the Protect controller - Protect is occasionally passing information for the wrong camera. This has been an on-again, off-again issue with various Protect firmware releases over the past few months and has been validated by looking at the native Protect app and native Protect webUI as well.

landlord11 commented 5 months ago

Sure, I can try those things. But just to be clear, the package camera video stream is correct, which I showed in the video I attached. The package camera is showing correctly in Protect, too. I don’t need to reboot the doorbell to fix the video stream. It’s only the Home snapshot that is incorrect, and the snapshot corrects itself when I tap on the package camera in the Home app to view its video stream.

Best, Brian

On Apr 7, 2024, at 12:17 AM, hjdhjd @.***> wrote:

Thanks for the report. This is a bug in the last 2-3 recent UniFi Protect firmware releases and not an HBUP issue. Hopefully it'll be fixed in the next Protect firmware or two. In the meantime, you can forcibly reboot the doorbell and that should do the trick. Frustrating, to be sure I'm afraid.

This did not start with 6.19.0, though I understand the instinct to assume correlation = causation. 😄

If you suspect it's simply high performance snapshots causing the issue, you can disable those in the webUI for the doorbell. That will revert to the old behavior. If you still think it's an issue after trying that, you can A/B test by reverting to 6.18. You can also further take a look at the native Protect app itself and use that as a further correlation point.

I experience this issue myself, so I'm keenly aware of the current Protect firmware buginess, but always open to hearing about other experiences.

— Reply to this email directly, view it on GitHub https://github.com/hjdhjd/homebridge-unifi-protect/issues/1058#issuecomment-2041304168, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABG4Z433YVVUIBZ76CSVBXTY4DCEPAVCNFSM6AAAAABF242WUOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANBRGMYDIMJWHA. You are receiving this because you authored the thread.

hjdhjd commented 5 months ago

I completely understood what you were saying. 😄

As I said - I experience the same issue. My comments stand as well regarding the issue's root cause, though I welcome more data points, always.

landlord11 commented 5 months ago

Understood. Here are some screenshots after some testing this morning that I thought might be helpful:

  1. Shows that Protect shows the correct feeds while Home has the wrong snapshot:

Screenshot 2024-04-07 at 11 32 44 AM

  1. I installed the Protect GA update that was prompting, no change:

Screenshot 2024-04-07 at 11 40 32 AM

  1. I restarted the Doorbell, this is during the restart:

Screenshot 2024-04-07 at 11 42 05 AM

  1. After Doorbell restart, no change:

Screenshot 2024-04-07 at 11 43 06 AM

  1. I restarted HBUP, which fixed the issue:

Screenshot 2024-04-07 at 11 46 34 AM

Next I'm going to try disabling high performance snapshots for the doorbell.

hjdhjd commented 5 months ago

I should add, and apologies I was tired when I responded previously and not quite complete in my response: the package camera snapshots are already generated using the Protect snapshot API, rather than high-performance snapshots. The nature of the package camera capabilities makes utilizing high performance snapshots for package cameras take longer than HomeKit will allow for a snapshot.

TL;DR: changing the setting isn’t likely to impact much of anything here, though I’m curious to see what comes back. Package cameras take a special path through HBUP due to their unique constraints.

What you’re showing in the screenshots you shared are a bit misleading however: the Protect webUI uses it’s own internal cached view of a snapshot when it’s unable to generate one in a timely manner using it’s own snapshot API. It’s part of Ubiquiti’s apparent challenges/workarounds with respect to snapshots. They’ve stated in their own support forums that snapshot functionality is intentionally being scaled back for performance/functional reasons, leading me to develop a more performant solution for HBUP/HomeKit. Package cameras will remain an outlier.

Really TL;DR: don’t expect the situation to change or improve unless Protect makes their snapshot API a bit more robust - they historically treat the package camera as an outlier and regressions are commonplace unfortunately. But always welcome feedback.

hjdhjd commented 5 months ago

One last note...if you have a definitively on-demand reproducible use case, I'd love to see it so I can take a deeper look and see how I can adapt further to some of the controller quirks these days. Thanks again for taking the time!

landlord11 commented 5 months ago

No worries at all about being tired. It’s good to know the package camera is still handled the “old” way. I haven’t yet figured out an exact path to force the snapshot to come back incorrect, but it happens regularly.

Is the Protect WebUI showing a snapshot? The main camera is live video in the screenshot but I didn’t confirm whether the package camera is live. Although at 1 fps maybe there isn’t much of a distinction. Your response made me think I should see the same problem in Protect as in the Home app.

I know other people had been reporting this sort of issue over the last few months but I thought those were problems with the video stream and not just the package camera snapshots. And in my case I don’t need to restart the doorbell or Protect to fix it. But I wasn’t following that too closely since I wasn’t seeing a problem myself, so I certainly may have misunderstood/misremembered.

I’ll circle back if I come up with a definitive way to trigger the problem. And I’ll let you know results of testing with high performance snapshots disabled and, if necessary, rolling back to v6.18.

On Apr 7, 2024, at 8:15 PM, hjdhjd @.***> wrote:

One last note...if you have a definitively on-demand reproducible use case, I'd love to see it so I can take a deeper look and see how I can adapt further to some of the controller quirks these days. Thanks again for taking the time!

— Reply to this email directly, view it on GitHub https://github.com/hjdhjd/homebridge-unifi-protect/issues/1058#issuecomment-2041659855, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABG4Z423AH65WKUK3RA6SZLY4HORLAVCNFSM6AAAAABF242WUOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANBRGY2TSOBVGU. You are receiving this because you authored the thread.

github-actions[bot] commented 5 months 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.