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
73.54k stars 30.72k forks source link

Unable to connect to surepetcare.io: Wrong credentials! #38204

Closed ntsiro closed 3 years ago

ntsiro commented 4 years ago

The problem

I have a working installation of the surepetcare flap and hub. this is a working configuration which is accessible through the mobile app and surepet website (https://www.surepetcare.io/auth/login).

My username and password authenticate me on the surepetcare.io website but through the homeassistant component I get "Unable to connect to surepetcare.io: Wrong credentials!"

Environment

Problem-relevant configuration.yaml

surepetcare:
  username: !secret sure-user
  password: !secret sure-password
  flaps: [XXXX]
  pets: [XXXX]

logger:
  default: critical
  logs:
    surepy: debug
    homeassistant.components.surepetcare: debug

Traceback/Error logs

2020-07-25 15:55:28 DEBUG (MainThread) [surepy] initialization completed | vars(): {'self': <surepy.SurePetcare object at 0x7f98de6790>, 'email': 'XXXX', 'password': 'XXXX', 'loop': <_UnixSelectorEventLoop running=True closed=False debug=False>, 'session': <aiohttp.client.ClientSession object at 0x7f9a37f670>, 'auth_token': None, 'api_timeout': 15}
2020-07-25 15:55:28 DEBUG (MainThread) [surepy] self._auth_token: None
2020-07-25 15:55:30 ERROR (MainThread) [homeassistant.components.surepetcare] Unable to connect to surepetcare.io: Wrong credentials!

Additional information

I am not sure if this still relates to the timeout issue previously reported but I think I am now using the latest version of surepy (0.2.5).

I have read https://github.com/home-assistant/core/issues/33515 and https://github.com/home-assistant/home-assistant.io/pull/13236 also https://github.com/home-assistant/core/issues/32583

I have also added debug logging (see results in section above) and don't get much other than no auth_token and then the surepetcare.io error.

ntsiro commented 4 years ago

@benleb any chance you could help me to debug this ? much appreciated

probot-home-assistant[bot] commented 4 years ago

Hey there @benleb, mind taking a look at this issue as its been labeled with an integration (surepetcare) you are listed as a codeowner for? Thanks! (message by CodeOwnersMention)

mdehaas commented 4 years ago

Hi,

I was also experiencing this issue with 0.116.4. I have just upgraded to 0.117.0 and it is working for me now. Most likely this is the effect of Upgrade surepy to 0.2.6 #40964

2020-10-29 16:20:54 DEBUG (MainThread) [surepy] initialization completed | vars(): {'self': <surepy.SurePetcare object at 0x6c3e38e0>, 'email': 'o***s@b***s.nl', 'password': 'z***Q', 'loop': <_UnixSelectorEventLoop running=True closed=False debug=False>, 'session': <aiohttp.client.ClientSession object at 0x6de517a8>, 'auth_token': None, 'api_timeout': 15} 2020-10-29 16:21:09 ERROR (MainThread) [homeassistant.components.surepetcare] Unable to connect to surepetcare.io: Wrong ! 2020-10-29 16:21:09 ERROR (MainThread) [homeassistant.setup] Setup failed for surepetcare: Integration failed to initialize.

benleb commented 4 years ago

Hi,

I was also experiencing this issue with 0.116.4. I have just upgraded to 0.117.0 and it is working for me now. Most likely this is the effect of Upgrade surepy to 0.2.6 #40964

2020-10-29 16:20:54 DEBUG (MainThread) [surepy] initialization completed | vars(): {'self': <surepy.SurePetcare object at 0x6c3e38e0>, 'email': 'o***s@b***s.nl', 'password': 'z***Q', 'loop': <_UnixSelectorEventLoop running=True closed=False debug=False>, 'session': <aiohttp.client.ClientSession object at 0x6de517a8>, 'auth_token': None, 'api_timeout': 15} 2020-10-29 16:21:09 ERROR (MainThread) [homeassistant.components.surepetcare] Unable to connect to surepetcare.io: Wrong ! 2020-10-29 16:21:09 ERROR (MainThread) [homeassistant.setup] Setup failed for surepetcare: Integration failed to initialize.

this isn’t the same log message

but I agree... anyone still experiencing this with 0.117 or greater!?

BranchyMcBranchface commented 3 years ago

@benleb, yes - still seeing this in 0.117.6

ichesworth commented 3 years ago

I'm seeing the same problem on RPi3 running hassio installation. The integration sometimes works, sometimes doesn't. Usually doesn't straight after a full reboot but can sometimes work if I do a restart within the HA ui. 2020-11-17 20:34:56 DEBUG (MainThread) [surepy] self._auth_token: None 2020-11-17 20:35:11 DEBUG (MainThread) [surepy] Timeout while calling https://app.api.surehub.io/api/auth/login: 2020-11-17 20:35:11 ERROR (MainThread) [homeassistant.components.surepetcare] Unable to connect to surepetcare.io: Wrong !

doogstar commented 3 years ago

I also have the exact same issue in 0.118.3 - I've only just got the cat flap so was excited to get it integrated, but getting the same message in logs with timeout to auth that @ichesworth has and the Wrong ! message.

benleb commented 3 years ago

New idea... you could try if it helps to further increase the api timeout here?

ichesworth commented 3 years ago

I'm not a HA expert, but I don't think I can access that file on a hassio installation? I certainly can't see it if I do a find / -name const.py when I ssh in.

mdehaas commented 3 years ago

I was a bit to soon. The integration is not working anymore...

2020-11-25 18:29:47 DEBUG (MainThread) [surepy] initialization completed | vars(): {'self': <surepy.SurePetcare object at 0x6d634bb0>, 'email': 'o***s@b***s.nl', 'password': 'z***Q', 'loop': <_UnixSelectorEventLoop running=True closed=False debug=False>, 'session': <aiohttp.client.ClientSession object at 0x6ebb5100>, 'auth_token': None, 'api_timeout': 15} 2020-11-25 18:29:47 DEBUG (MainThread) [surepy] self._auth_token: None

2020-11-25 18:30:02 DEBUG (MainThread) [surepy] Timeout while calling https://app.api.surehub.io/api/auth/login: 2020-11-25 18:30:02 ERROR (MainThread) [homeassistant.components.surepetcare] Unable to connect to surepetcare.io: Wrong ! 2020-11-25 18:30:02 ERROR (MainThread) [homeassistant.setup] Setup failed for surepetcare: Integration failed to initialize.

benleb commented 3 years ago

Seems their API is down again? The Sure Petcare App is also broken, so let's wait some hours and check again...

TazUk commented 3 years ago

@benleb FYI Just upgraded to 0.118.3 and had this "Wrong!" error on first HA 0.118.3 startup, however after a restart of HA I was able to successfully load the integration.

Based on their tweets etc Surepet was impacted by a regional AWS failure yesterday (taking out their company website, the app etc completely). For most of today (UK time) I've been seeing intermittent surepet sensor update failures logged in HA which are probably just AWS aftershocks.

benleb commented 3 years ago

Ah nice info! Thanks!

ichesworth commented 3 years ago

I'm still seeing the 'Wrong !' errors (running 118.4 on hassio): was fine for a while but I rebooted this morning and getting the errors again. Sometimes works if I just restart Homeassistant rather than the full OS so I think it could do with a longer timeout especially on devices with less CPU power (I'm on a Pi3)

ichesworth commented 3 years ago

I have cloned the surepetcare component and installed it into custom_components, editing the timeout to 45 and it now seems to survive every reboot so looks like it definitely needs a bit more time on my system.

Would be great if this could be done in the main branch or make it as an option in the config.

badguy99 commented 3 years ago

Same for me, I was hitting this all the time - at least the last 10 restart - on the last two versions (currently on Home Assistant 2020.12.6). I've changed the timeout to 30 seconds, and it has been ok since. I've got 7 pets - microchips have migrated a bit on some of our cats, and now it is hit or miss if the cat flap picks them up, so some "pets" are actually just the RFID tags that go on their collars, so they have the RFID tag and embedded microchip. Along with 2 feeds and one cat flap. In case the number of devices makes any difference.

doogstar commented 3 years ago

Is there a bozos guide to overriding the timeout? Running hass.io on a Pi and have never had the sure petcare integration load at all.

On Tue, 15 Dec 2020, 22:42 badguy99, notifications@github.com wrote:

Same for me, I was hitting this all the time - at least the last 10 restart - on the last two versions (currently on Home Assistant 2020.12.6). I've changed the timeout to 30 seconds, and it has been ok since. I've got 7 pets - microchips have migrated a bit on some of our cats, and now it is hit or miss if the cat flap picks them up, so some "pets" are actually just the RFID tags that go on their collars, so they have the RFID tag and embedded microchip. Along with 2 feeds and one cat flap. In case the number of devices makes any difference.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/home-assistant/core/issues/38204#issuecomment-745613445, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAQKNHV7QYQJEXB3A26LIWDSU7Q6BANCNFSM4PHQFCTA .

benleb commented 3 years ago

@MartinHjelmare I know you try to avoid configurable timeouts (see https://github.com/home-assistant/core/pull/34944 if you can't remember :P), but shouldn't we make an exception in this case? or what would be your suggestion to finally solve this problem?

MartinHjelmare commented 3 years ago

Can we increase the timeout to 60 seconds?

benleb commented 3 years ago

Okay, will do a PR tomorrow 👍

benleb commented 3 years ago

@MartinHjelmare https://github.com/home-assistant/core/pull/44316 should be an easy review ;)