seaside1 / unifiprotect

openHAB UniFi Protect Addon
Eclipse Public License 2.0
21 stars 6 forks source link

Doorbell G4 Ring stops working Firmware 4.68.16 #17

Closed SchmidSP closed 5 months ago

SchmidSP commented 7 months ago

Early Access Firmware 4.68.16 Cloudkey Gen2* V 3.2.7 Protect V 2.10.10 No ring anymore Last ring message still ok. Only no signal on Doorbell Openhab 4.0.3 with unifiprotect-4.0.0-v1.2 If you need any Protocols just ask.

SchmidSP commented 7 months ago

Tested same behavior on Protect 2.9.42 offical.

seaside1 commented 7 months ago

Not sure how to handle this. I have updated to: UniFi OS: v3.2.7 Protect: 2.10.10

I get motion and ring events. However intermittently Ring is not working. I can't always reproduce this, if you can reproduce, could enable debug logging, and pm your bootstrap.json and the logs (espcially the frames containing ring notification). Edit: Last 10 ring notifications worked on my doorbell.

SchmidSP commented 7 months ago

Send bootsrap & log via openhab community See row 2557 2023-12-05 11:28:23.601 [DEBUG] [rnal.model.UniFiProtectCameraChannel] - Failed to load channel: is-ringing

seaside1 commented 7 months ago

Thanks I'll try to take a look. Funny thing is that i can't reproduce this with my doorbell now, it always seem to work.

seaside1 commented 7 months ago

Hi! So I have looked at the logs and also done tests on my system. The logs seem to miss the doorbell events, so either it is not connected or there is some glitch in the websocket api. When this happens, does the doorbell work? I mean can you see in the UniFiProtect app that you have a ring-event? For me it seems to work now, and it is more stable.

SchmidSP commented 7 months ago

Hi. Yes App and Homebridge Unifiy Protect Connector (for Homekit) receive the ring Signal. When I restart the Openhab binding I receive one or two time a ring. After that it stop working. Did you need further logs? I'm now for testing on 2.10.11. Thanks.

SchmidSP commented 7 months ago

Addition: I also see the in the Openhab log a few times after ring the last ring: Ring was a few seconds before then A few seconds later: 2023-12-18 19:51:14.330 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'G4DBLastRing' changed from 2023-12-18T17:24:45.423+0100 to 2023-12-18T19:50:42.406+0100

SchmidSP commented 7 months ago

restart unify nvr thing, ring works again:

2023-12-18 19:54:46.240 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'unifiprotect:nvr:96ec58672e' changed from INITIALIZING to ONLINE 2023-12-18 19:54:46.254 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'unifiprotect:g4doorbell:9c94e07c1d' changed from UNINITIALIZED (BRIDGE_UNINITIALIZED) to INITIALIZING 2023-12-18 19:54:46.264 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'unifiprotect:g4doorbell:9c94e07c1d' changed from INITIALIZING to ONLINE 2023-12-18 19:54:46.377 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'CKG2PNvrUptime' changed from 1723832400 to 1723862400 2023-12-18 19:54:46.383 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'CKG2PNvrLastSeen' changed from 2023-12-18T19:54:09.392+0100 to 2023-12-18T19:54:39.393+0100 2023-12-18 19:54:46.399 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'CKG2PNvrCpuLoad' changed from 13.600000000000001 to 7.8 2023-12-18 19:54:46.419 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'CKG2PNvrMemAvailable' changed from 598072 to 598148 2023-12-18 19:54:46.423 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'CKG2PNvrMemTotal' changed from 170316 to 177688 2023-12-18 19:54:46.435 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'G4DBLastSeen' changed from 2023-12-18T19:53:20.054+0100 to 2023-12-18T19:54:25.058+0100

2023-12-18 19:55:05.371 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'G4DBIsRinging' changed from ON to OFF

Stop working after a few hours again...

seaside1 commented 7 months ago

When it stops working, does motion detection still work?

SchmidSP commented 7 months ago

I have to check. Must wait till the error start again.

SchmidSP commented 7 months ago

Checked. Also no Motion. See event.log and openhab.log attached. events.log openhab.log

SchmidSP commented 7 months ago

More Logs (with debug enabled) to help. openhab.log

Successful Ring after restart working: 2023-12-20 14:21:13.033

Failed Ring 1 hour later no signal: 2023-12-20 15:23:13.xxx

SchmidSP commented 7 months ago

Password changed ;) after debug.

Magicsplash commented 6 months ago

Have you managed to get any progress with this one?

I'm experiencing a similar problem where the 'is-ringing', motion-detection etc. all stop responding. The 'last-ring' and 'last-seen' will still, strangely enough, work.

Could it be the NVR websocket disconnecting due to a time-out to be the main culprit?

Cheers.

To add, only a reboot of the openhab service fixes things.

SchmidSP commented 6 months ago

Hi, any news or could I assist with more Information?

seaside1 commented 6 months ago

So I have not managed to work that much on it. Some short notes:

Since I also experience this problem I will continue to look into getting a solution up and running. Possibly using more than one single websocket could be a solution as long as they are shut down properly .

SchmidSP commented 6 months ago

Hi, maybe it helps. I also use unifyprotect homebridge plugin (https://github.com/hjdhjd/homebridge-unifi-protect). The homebridge plugin works very stable with websocket connection. Maybe you find something that help you. Another Idea, disconnect and restart the websocket connection every 10 min could solve the problem until we know what the trigger is. I will test the new unifi build and give you feedback.

seaside1 commented 6 months ago

Yes I know about both homebridge and homeassistant solution since start of this project. I like you suggestion, you can try https://github.com/seaside1/unifiprotect/releases/tag/unifiprotect-4.0.0-v1.3 Which will restart the binding each 10 mins if the force watch dog option in NVR is set to true (default).

This would just be a temporary solution until I can find the root cause.

SchmidSP commented 5 months ago

Hi,

thanks. Test with 4.0.0-v1.3 started.

SchmidSP commented 5 months ago

Unfortunately bad news. Even with the Watchdog 10 minute restart on (hook watchdog is on), "ringing" stops working after a few Minutes. Any ideas?

seaside1 commented 5 months ago

I have experienced this myself as well. Although it takes around 4-7 days for me to get failure. The reinit is not working, so I have refactored it. I'll try a bit locally if it seems to work I will release a pre-release of it.

seaside1 commented 5 months ago

That last build was a mess. I'm leaning towards that this issue occurs when your token is no longer valid. The normal NVR flows, like getting snapshots etc, will login again creating a new token. When this happens the websocket should probably be reinitialized. I have written some code that does this. My second approach would be to use another httpClient just for the websocket, but use the same token and cookies.

If my first approach does not work, I will try the second. This is somewhat slow to test, like I said my system is usually fine for at least a couple of days before the socket stops working.

SchmidSP commented 5 months ago

Hi, maybe I can help you. Just let me know what you need for support. I can do testing and debugging for you if you want.

seaside1 commented 5 months ago

Rework the websocket, maybe you can test? This seems a lot more stable in my system. The watchdog is removed though. https://github.com/seaside1/unifiprotect/releases/tag/unifiprotect-4.0.0-v1.3

SchmidSP commented 5 months ago

Installed. Give you feedback in a few days.

SchmidSP commented 5 months ago

Feedback: Works now since 2 days. Websocket stable. Ring signal working. Can't see any errors in logs. Thanks a lot for this great work!

marioschouten commented 5 months ago

Been running v13 since it was released, don't have a G4 camera but it solved my other issues and just wanted to say thank you very much for the great work. Very much appriciated.

seaside1 commented 5 months ago

Thanks for the feedback. Closing this one for now.