home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
72.23k stars 30.24k forks source link

Litter Robot Auth Timeout #83519

Closed kevinahuber closed 1 year ago

kevinahuber commented 1 year ago

The problem

Howdy! A month or so ago my litter robot integration produced an error (not recorded). In troubleshooting I removed the integration, and since have been unable to reauthenticate.

When entering incorrect credentials, the integration quickly returns an invalid credentials error. When entering the correct credentials, the integration spins for ~ 60s and then returns an unknown error, logs below.

✅ My credentials work with the Whisker App and Website, reset them and removed any potentially troublesome characters ❌ Restarted, no change ❌ No instances of litterrobot in my configuration.yaml ❌ Wiped my recorder db, no change

What version of Home Assistant Core has the issue?

2022.12.0

What was the last working version of Home Assistant Core?

2022.10

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Litter Robot

Link to integration documentation on our website

https://www.home-assistant.io/integrations/litterrobot/

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

2022-12-07 21:32:42.581 ERROR (MainThread) [homeassistant.components.litterrobot.config_flow] Unexpected exception:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/litterrobot/config_flow.py", line 86, in _async_validate_input
await account.connect(
File "/usr/local/lib/python3.10/site-packages/pylitterbot/account.py", line 68, in connect
await self.session.login(username=username, password=password)
File "/usr/local/lib/python3.10/site-packages/pylitterbot/session.py", line 178, in login
data = await self.post(
File "/usr/local/lib/python3.10/site-packages/pylitterbot/session.py", line 46, in post
return await self.request("POST", path, **kwargs)
File "/usr/local/lib/python3.10/site-packages/pylitterbot/session.py", line 212, in request
return await super().request(method, url, **kwargs)
File "/usr/local/lib/python3.10/site-packages/pylitterbot/session.py", line 80, in request
async with self.websession.request(method, url, **kwargs) as resp:
File "/usr/local/lib/python3.10/site-packages/aiohttp/client.py", line 1141, in __aenter__
self._resp = await self._coro
File "/usr/local/lib/python3.10/site-packages/aiohttp/client.py", line 467, in _request
with timer:
File "/usr/local/lib/python3.10/site-packages/aiohttp/helpers.py", line 720, in __exit__
raise asyncio.TimeoutError from None
asyncio.exceptions.TimeoutError
2022-12-07 21:33:42.580 ERROR (MainThread) [homeassistant.components.litterrobot.config_flow] Unexpected exception:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/litterrobot/config_flow.py", line 86, in _async_validate_input
await account.connect(
File "/usr/local/lib/python3.10/site-packages/pylitterbot/account.py", line 68, in connect
await self.session.login(username=username, password=password)
File "/usr/local/lib/python3.10/site-packages/pylitterbot/session.py", line 178, in login
data = await self.post(
File "/usr/local/lib/python3.10/site-packages/pylitterbot/session.py", line 46, in post
return await self.request("POST", path, **kwargs)
File "/usr/local/lib/python3.10/site-packages/pylitterbot/session.py", line 212, in request
return await super().request(method, url, **kwargs)
File "/usr/local/lib/python3.10/site-packages/pylitterbot/session.py", line 80, in request
async with self.websession.request(method, url, **kwargs) as resp:
File "/usr/local/lib/python3.10/site-packages/aiohttp/client.py", line 1141, in __aenter__
self._resp = await self._coro
File "/usr/local/lib/python3.10/site-packages/aiohttp/client.py", line 467, in _request
with timer:
File "/usr/local/lib/python3.10/site-packages/aiohttp/helpers.py", line 720, in __exit__
raise asyncio.TimeoutError from None

Additional information

No response

home-assistant[bot] commented 1 year ago

Hey there @natekspencer, @tkdrob, mind taking a look at this issue as it has been labeled with an integration (litterrobot) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `litterrobot` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Change the title of the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign litterrobot` Removes the current integration label and assignees on the issue, add the integration domain after the command.

(message by CodeOwnersMention)


litterrobot documentation litterrobot source (message by IssueLinks)

natekspencer commented 1 year ago

I'm not seeing anything here that indicates a problem with the litterrobot integration specifically aside from not catching the asyncio.TimeoutError. It looks like it times out on the request during login, which usually indicates some type of network issue. Do you have a firewall or adblocker or anything like that your HA instance is configured with or behind?

kevinahuber commented 1 year ago

Nothing profound, currently. Great question! Audited all of my network settings. The only thing I can think of is that I removed a network install of Pihole that had diagnostics sent to HA around the time things went sour with litterrobot. There might be a thread there 🤔

I've added a handful of integrations that have needed auth since without issue. Are there any alternate config flows or ways to increase the logs??

tkdrob commented 1 year ago

Pi-hole has caused problems for me personal in the past. I moved to AdGuard which seems to work better and has other features that Pi-hole does not.

natekspencer commented 1 year ago

No alternate config flow, they'd still end up making the same call anyway. The timeout is occurring in the aiohttp module, so you may be able to enable logs for that, but I'm not sure if that will work or how much that will help. You could try running the pylitterbot module directly on another computer to see if it all works fine. Or see if a trusted friend on another HA instance has issues with your account as well to help try and isolate the problem.

kevinahuber commented 1 year ago

@natekspencer Finally got around to testing! I am able to call the app- authenticated and ran a clean cycle. Same network, different machine and not through home assistant. So it's something with my HA 🤔

I also got a Feeder Robot, but this started happening before I added that.

kevinahuber commented 1 year ago

I also made a different account with no robots, that also has a timeout while authenticating through HA.

natekspencer commented 1 year ago

@kevinahuber another project I saw that had networking issues was due to ipv6. Might be worth checking out if your HA is configured for ipv6 and if that is interfering somehow?

kevinahuber commented 1 year ago

@natekspencer disabled it ip6 and it works again! Interesting 🤔 but works for me for now, closing

tkdrob commented 1 year ago

IPv6 can cause issues like that as there is no direct way for it to communicate with IPv4. At my job, we disable it whenever we hear about connectivity issues like that.