Ring integration setup fails

Word of caution for folks…after updating to the OAuth2 implementation in ring-doorbell 0.2.8 library, it appears my Hassio box is now making about 3000 DNS queries a minute to oauth.ring.com. Here are the graphs from my Pi Hole:

The server in blue is my Hassio box.

After disabling the Ring.com integration it fell back to the baseline.
I’m not willing to have that volume of traffic just to have Ring…

Rob, just checked mine and I’m not seeing any uptick in DNS queries after making the above changes. I have adguard and not pihole, but I ran a query to search for that DNS query but only had a few. Not that this helps you, but just wanted to comment that it doesn’t appear to be a common issue.

Not knowing your setup
Have you tried with a static entry in the host file
Resolve it internal so it doesnt forget and never needs to ask outside where to go.

Harry, appreciated, but it shouldn’t be making that volume of requests, regardless of if it’s internally resolved or hitting my DNS server, it’s a LOT of requests, which indicates something is wrong. The only change I made to my config was turning off the Ring integration, you can see it immediately went back to baseline…

All of this traffic is coming from HA, almost none from my actual Ring cameras which are also communicating with the cloud.

Yes but why is your system forgetting where it just was, part of any dns from server to pc, is to cache the recent query so they don’t have to go looking for it again.
What I’m say is. Is it the ring or is it your system.
But either way is there actual traffic or just the Queries.

I was going to Suggest you message Marcelo code owner or Steve Gombos who did the OAuth2 code there may be a loop in the code he added.
Part of the reason why it fell over before was cause there was unnecessary request being made every time it pass through the request code.
But I just saw you opened a request.
:hugs:

That would be due to the oauth.ring.com TTL being only 2 seconds.

While your system will cache it, it’s only cached until the TTL expires.

That would explain it.

1 Like

No that doesn’t explain it. It explains why it’s not caching it, but not why it needs it multiple times a second.

Why does HA need to make a DNS request to oauth.ring.com 1000s of times a minute? That doesn’t make sense. I’m also not seeing this same behavior from my cameras, or from the Ring app on my phone…just HA.

Before you suggest that it’s streaming to the cloud, the only time it should need to get to oauth.ring.com is to refresh the token. After that the token itself is passed with the API calls to a totally different FQDN.

1 Like

I was specifically answering to Harry13 about why it’s not caching that’s all. I am also getting the same DNS lookup flood you are.

image

1 Like

Can you test 0.2.6
See if it doing it with that code
We can then narrow down the code changes and find the unnecessary requests.

Okay, thanks. I logged an issue on Github with the python-ring-doorbell library about this, hopefully the author will take a look at it.

From what I can tell in the logs, it’s just updating the sensor every 10 seconds:

2019-12-28 13:32:06 DEBUG (SyncWorker_11) [homeassistant.components.ring] Updating Ring Hub component
2019-12-28 13:32:06 DEBUG (SyncWorker_11) [homeassistant.components.ring] Updating camera Front Door
2019-12-28 13:32:07 DEBUG (MainThread) [homeassistant.components.ring.camera] Updating Ring camera Front Door (callback)
2019-12-28 13:32:07 DEBUG (SyncWorker_13) [homeassistant.components.ring.sensor] Updating data from Front Door Last Activity sensor
2019-12-28 13:32:07 DEBUG (SyncWorker_15) [homeassistant.components.ring.camera] Checking if Ring DoorBell needs to refresh video_url
2019-12-28 13:32:07 DEBUG (SyncWorker_2) [homeassistant.components.ring.sensor] Updating data from Front Door Battery sensor
2019-12-28 13:32:07 DEBUG (SyncWorker_6) [homeassistant.components.ring.sensor] Updating data from Front Door WiFi Signal Strength sensor
2019-12-28 13:32:07 DEBUG (SyncWorker_5) [homeassistant.components.ring.sensor] Updating data from Front Door WiFi Signal Category sensor
2019-12-28 13:32:07 DEBUG (SyncWorker_8) [homeassistant.components.ring.sensor] Updating data from Front Door Last Motion sensor
2019-12-28 13:32:08 DEBUG (SyncWorker_7) [homeassistant.components.ring.sensor] Updating data from Front Door Last Ding sensor
2019-12-28 13:32:11 DEBUG (SyncWorker_13) [homeassistant.components.ring.sensor] Updating data from Front Door Volume sensor

I see that there is now (on GitHub) 0.103.5 with the comment:-
Bump ring to 0.2.8 to fix Oauth issues
Please excuse my ignorance but can someone answer the following questions for me?
1/ Will I have to set up 2FA on my Ring account?
2/ Will I have to change my configuration.yaml entry?
Currently simply…

ring:
username: YOUR_USERNAME
password: YOUR_PASSWORD

Which would be fine, but I only have 3 Ring devices, if each of them were updating every 10 seconds, worst case that would be 18 updates a minute. I’m seeing 100x that traffic.

Additionally, those updates shouldn’t need to be calling oauth.ring.com, as they’d already have a valid token to submit the API call…

No.
No.

In fact, if you do set up 2FA on your Ring account, you’ll probably break the integration.

Thanks Rob.
This was the case when it was working (before a restart) with 0.103.4 too.

No he added code for it.
Don’t no if it works.
Same as Alexa media player

I cannot test it yet. I use docker-compose and the new version was only uploaded 30 minutes ago.
(docker-compose pull does not get it yet)

I’m getting the same with 0.103.4 …

I just read through the auth.py code in the python-ring-doorbell library. I see the OAuth2 code that was added, but see no reference to 2FA.