Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Camera Snapshots stop updating after awhile #1274

Closed
1 task done
Morac2 opened this issue Jul 27, 2023 · 13 comments
Closed
1 task done

Camera Snapshots stop updating after awhile #1274

Morac2 opened this issue Jul 27, 2023 · 13 comments
Labels
bug Something isn't working HomeKit Issue with HomeKit, not the ring plugin

Comments

@Morac2
Copy link

Morac2 commented Jul 27, 2023

Is there an existing issue for this?

  • I have searched the existing issues

Describe The Bug

I have a Ring Doorbell and an indoor camera. After about a week, the snapshot for both stops updating. Restarting HomeBridge doesn’t fix this. Neither does moving the plug-in to a child bridge and restarting that.

The only work around I’ve found is to hide the cameras in the plug-in settings, restart HomeBridge (or the child bridge) and then unhide them and restart again. This fixes them until the problem occurs again.

I have cameras from Blink also using HomeBridge and don’t see this problem with them.

To Reproduce

Add cameras and wait

Expected behavior

Camera snapshots should update within about 30 seconds when open Home app

Relevant log output

No response

Screenshots

No response

Homebridge Ring Config

{
    "bridge": {
        "name": "Homebridge 21EA",
        "username": "",
        "port": 51015,
        "pin": "",
        "advertiser": "avahi"
    },
    "accessories": [
        {
            "name": "Airthings View Pro",
            "clientId": "",
            "clientSecret": "",
            "serialNumber": "",
            "co2DetectedThreshold": 2000,
            "accessory": "Airthings",
            "_bridge": {
                "username": "",
                "port": 31008
            }
        },
        {
            "name": "Airthings Wave Plus",
            "clientId": "",
            "clientSecret": "",
            "serialNumber": "",
            "co2DetectedThreshold": 2000,
            "accessory": "Airthings",
            "_bridge": {
                "username": ""
            }
        }
    ],
    "platforms": [
        {
            "name": "Config",
            "port": 8581,
            "auth": "form",
            "theme": "auto",
            "tempUnits": "f",
            "lang": "auto",
            "platform": "config"
        },
        {
            "refreshToken": "",
            "_bridge": {
                "username": "",
                "port": 43546
            },
            "platform": "Ring"
        },
        {
            "name": "TplinkSmarthome",
            "addCustomCharacteristics": true,
            "deviceTypes": [
                "plug",
                "bulb"
            ],
            "platform": "TplinkSmarthome",
            "_bridge": {
                "username": "",
                "port": 56092
            }
        },
        {
            "name": "Blink",
            "username": "",
            "password": "",
            "pin": …,
            "hide-alarm": true,
            "hide-manual-arm-switch": true,
            "disable-thumbnail-refresh": false,
            "enable-startup-diagnostic": false,
            "platform": "Blink",
            "_bridge": {
                "username": "",
                "port": 58245
            }
        }
    ]
}

Additional context

HomeBridge seems to be using a cached version of the cameras. Hiding and unhiding them removes them from cache and refreshes them.

OS

Linux Homebridge (Raspberry PI)

Node.js Version

V18.16.0

NPM Version

9.5.1

Homebridge/HOOBs Version

v1.6.1

Homebridge Ring Plugin Version

v11.8.0

Operating System

Linux Homebridge 6.1.21-v7+

@Morac2 Morac2 added the bug Something isn't working label Jul 27, 2023
@Morac2
Copy link
Author

Morac2 commented Aug 1, 2023

I found an easier work around. I delete the cameras from the cache in the HomeBridge settings. Once I do that, the camera updates. I did that this morning when the cameras were 16 hours out of date and weren’t updating.

@Morac2
Copy link
Author

Morac2 commented Aug 2, 2023

I want to also mention that when the snapshots stop updating, live camera also stops working. It just spins forever. The fact that clearing the cache fixes this seems to indicate a problem on the HomeBridge/plugin side rather than the HomeKit side.

I also have Blink cameras and while they don’t support live view in HomeBridge, they do support snapshots which work flawlessly. As such that would appear to eliminate HomeBridge as a problem which leaves the Ring plugin.

Another thing I’ve noticed is that the last snapshot time differs on different devices. As such it doesn’t seem like the cache is providing images.

@dgreif
Copy link
Owner

dgreif commented Aug 2, 2023

@Morac2 thanks for the updated info! This definitely sounds like a HomeKit issue, and not something we can fix at the homebridge/plugin level. Glad you got it working! I don't think there is anything else for us to look into at the point.

@dgreif dgreif closed this as not planned Won't fix, can't repro, duplicate, stale Aug 2, 2023
@dgreif dgreif added the HomeKit Issue with HomeKit, not the ring plugin label Aug 2, 2023
@Morac2
Copy link
Author

Morac2 commented Aug 2, 2023

@dgreif I’m not sure how this is a HomeKit issue when clearing the cache fixes it temporarily and it only affects Ring cameras and not Blink cameras (different plugin).

@tsightler
Copy link
Collaborator

tsightler commented Aug 2, 2023

@Morac2 You didn't provide any logs, do they happen to show anything interesting, for example, when it's working vs not and when you delete the cache? There's not much to go on with just an open issue.

I took a quick look at the Blink plugin vs this one and there's not much difference here. It appears that there's a call to handleSnapshotRequest() in both cases, and they simply return a snapshot via the appropriate API.

I wonder if perhaps the cameras are going offline or maybe a request is getting stuck since you say that streaming is also not working, and maybe removing them from the cache somehow refreshes them. But logs might tell something. If not, it's really very difficult to know what to do here.

@Morac2
Copy link
Author

Morac2 commented Aug 2, 2023

There are no logs at all when it stops working. If I reboot homebridge there’s logs saying the camera was read from the cache but that’s it. When it works I see a lot of stuff in the logs. Next time it happens I’ll grab them.

One other thing to mention is that the mDNS for HomeBridge changes periodically from http://homebridge.local to http://homebridge-2.local/ until I restart the Avahi service. I don’t know if the plug-in uses that or not, but that’s usually when I also notice the Ring cameras stop updating.

@Morac2
Copy link
Author

Morac2 commented Aug 2, 2023

Correction. There’s only log data when viewing a ring camera live. There’s no log data when the snapshot updates.

@Morac2
Copy link
Author

Morac2 commented Aug 2, 2023

@tsightler so I checked and the Ring plug-in never logs anything whether or not the snapshots update. When I open a view with a Ring camera the last update time displays until the time when the snapshot updates and then it changes to 0 seconds.

In comparison, the Blink plug-in immediately updates the “update time” in Home (goes back to 0 seconds) when I go to a view with a Blink camera and then the log shows “refreshing snapshot”.

As such the reason I didn’t include any logs is that the Ring plugin doesn’t log anything for refreshing snapshots. The only time the plug-in logs anything is on HomeBridge boot up and if I open a live view of a Ring camera.

@Morac2
Copy link
Author

Morac2 commented Aug 3, 2023

So I noticed in the code that logging is only done in debug mode so I enabled that. And this is what shows up when it works. I’ll need to wait for it to break again.

It does seem to load the snapshot a lot. This was just one time opening the Home app.

[02/08/2023, 20:06:50] [homebridge-ring] No snapshot cached for Garage
[02/08/2023, 20:06:50] [homebridge-ring] Loading new snapshot into cache for Garage
[02/08/2023, 20:06:50] [homebridge-ring] No snapshot cached for Front Door
[02/08/2023, 20:06:50] [homebridge-ring] Loading new snapshot into cache for Front Door
[02/08/2023, 20:06:51] [homebridge-ring] Snapshot cached for Front Door (0.49s)
[02/08/2023, 20:06:51] [homebridge-ring] Snapshot cached for Garage (0.64s)
[02/08/2023, 20:06:55] [homebridge-ring] Used cached snapshot for Garage
[02/08/2023, 20:06:55] [homebridge-ring] Loading new snapshot into cache for Garage
[02/08/2023, 20:06:55] [homebridge-ring] Used cached snapshot for Front Door
[02/08/2023, 20:06:55] [homebridge-ring] Loading new snapshot into cache for Front Door
[02/08/2023, 20:06:56] [homebridge-ring] Snapshot cached for Garage (0.404s)
[02/08/2023, 20:06:56] [homebridge-ring] Snapshot cached for Front Door (0.466s)
[02/08/2023, 20:07:07] [homebridge-ring] Used cached snapshot for Garage
[02/08/2023, 20:07:07] [homebridge-ring] Loading new snapshot into cache for Garage
[02/08/2023, 20:07:07] [homebridge-ring] Used cached snapshot for Front Door
[02/08/2023, 20:07:07] [homebridge-ring] Loading new snapshot into cache for Front Door
[02/08/2023, 20:07:10] [homebridge-ring] Snapshot cached for Garage (3.272s)
[02/08/2023, 20:07:12] [homebridge-ring] Snapshot cached for Front Door (5.138s)

@tsightler
Copy link
Collaborator

That seems about right, it should settle in to about once every 10s or so for each camera, which it seemed to do.

@Morac2
Copy link
Author

Morac2 commented Aug 5, 2023

I think this is a combination HomeKit, HomeBridge problem. Today I noticed the Ring cameras weren't updating, but only on my iPad and iPhone. The cameras worked on my Apple TV and Mac, which I hadn't used to access them previously. I noticed this when someone Rang my doorbell.

I checked HomeBridge and the mDNS name had changed again from homebridge.local to homebridge-2.local. Restarting the avahi-daemon server fixed that, but when that happens my iPhone and iPad no longer trigger requests to the Ring cameras. I tried turning Wifi off and on, but that didn't fix it. I had to restart the iOS devices to get them to work with the Ring cameras (Blink still works fine), so something must be caching on the Apple side.

I have a feeling if I could solve the problem with the homebridge switching mDNS names that would solve the Ring plugin problem. I tried setting a CRON job to restart the avahi-daemon nightly, but that didn't help.

@tsightler
Copy link
Collaborator

I think I might have seen this in my environment as well. My wife's iPad would stop refreshing snapshots unless I performed some manual action to get it going again (usually I could just swipe down from the top to force a refresh and it would come back, but sometimes not even that). It seems like switching from Bonjour-HAP to Ciao for the mDNS Advertiser may have resolved it for me, at least, it hasn't reproduced since then.

It still sometimes takes 15-20 seconds for that first snapshot to refresh when I open the Home app, but it eventually picks up on its own, whereas before it wouldn't refresh no matter how long it was left there. I saw some other reports for other camera platforms and similar recommendations, so maybe worth a shot if you are still seeing this.

@dgreif
Copy link
Owner

dgreif commented Aug 19, 2023

It's also worth reading through https://github.com/dgreif/ring/wiki/Snapshot-Limitations if you haven't already. TL;DR - there are a lot of compromises and caching that we do for snapshot due to limitations both by Ring and homebridge/HomeKit. It's entirely possible there is a bug in there somewhere, but in general it's never going to perform perfectly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working HomeKit Issue with HomeKit, not the ring plugin
Projects
None yet
Development

No branches or pull requests

3 participants