Ring integration setup fails

I agree the token shouldn’t be expired so quickly and therefor needing to be refreshed each call.
Clearly a bug, but one I can currently live with. :stuck_out_tongue:

auth.py

def fetch_token(self, username: str, password: str,
                    auth_callback: Callable[[], str] = None):
        """Initial token fetch with username/password & 2FA"""
        try:
            return self.__fetch_token(username, password)

        except MissingTokenError:
            if not auth_callback:
                raise

            return self.__fetch_token(username, password, auth_callback())

    def __fetch_token(self, username: str, password: str,
                      auth_code: str = None):
        """Private fetch token method"""
        if auth_code:
            headers = {}
            headers['2fa-support'] = 'true'
            headers['2fa-code'] = auth_code

I believe the 2FA part will be coded into Home Assistant by balloob per his comment on github.

Missed it, you’re right!
It appears to be there, but the parent component module will also need to be updated to give us a way to enter the code.

I think once Paulus get the API partner with ring.
HA with have proper API access, may get live feeds too, we can only hope :slightly_smiling_face:. But it will mean that the Oauth2 will be done via HA’s linking service

1 Like

Great stuff guys. I do not understand the intricacies of the problem or the fix but I can confirm that I just ran

docker-compose pull

then

docker-compose up -d

Then refreshed after a short delay and Ring on Home Assistant works again.

Correct

Now that 103.5 has been release that is now another way to update

I updated the version. Now the api client errors have stopped and I get a code. How do I use that i configure it?

I did the doc referencing that.

Thanks

You can’t its not fully implemented
What you can do is this

  • Turn Of 2FA
  • delete pickle if it exists
  • reboot
  • Ring Up and Connect and pickle file exists
  • Turn On 2FA
    The ring component will not need 2FA as it now has the OAuth2 Tokens

Or

  • Leave 2FA on
  • add an additional user
  • use that user for HA
3 Likes

Thank you. I’m seeing the spike in dns queries on my pihole as well. I shut down the Ring integration (again) till this get resolved.

I see the same behavior on my pi hole. I would not expect that this many is needed. Maybe once in a few minuten would do the trick.

Hoe they can change this behavior in the next update.

A quick fix would be to add an entry to your local dns to resolve the lookup internally.

Wouldn’t this be a problem when the integration actually needs to refresh the token?

Just got this integration setup today and now getting large volume of traffic on the network.

HA is generating between 2-4 TCP sessions per second to the Ring API host servers (104.17.128.1). This seems somewhat excessive!
Screenshot_20191229-232852|298x500
These are not DNS queries as others have seen, rather requests on port 443 to ring.api.com

The integration itself is working as expected, just hammering the network.

Is this normal ?

PS. Changing the scan_interval to 60 seconds made no difference to the number of sessions.

I upgraded to 0.103 yesterday and, now like Rob, I am seeing high amounts of DNS requests to oauth.ring.com in pihole.

What gives?

However, it’s also, definitely, making DNS queries to oauth.ring.com. On the order of 50/second. The underlying library author, https://github.com/tchellomello/python-ring-doorbell, is aware of it and I submitted an Issue that is being investigated.

I’m still on 103.4
I’m not seeing any excessive traffic.
Are you all on 103.5 ?

Yep, I’m on 0.103.5 and have excessive traffic…

1 Like

Same this is just today https://i.imgur.com/MPkUuAh.png

Just a quick update…
The author of the python-ring-doorbell library has identified the issue with the excessive DNS queries. It has to do with the Token Refresh timer not being set properly. He is working on correcting the problem and has a temporary working solution. It should be available “shortly”.

8 Likes