core icon indicating copy to clipboard operation
core copied to clipboard

Sure Petcare Integration setup not working

Open Malaber opened this issue 1 year ago • 24 comments

The problem

When trying to setup the Sure Petcare Integration, I get the error "Failed to connect". The credentials are correct though and I would assume the error would be something else if they mismatched.

What version of Home Assistant Core has the issue?

core-2023.11.3

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Container

Integration causing the issue

Sure Petcare

Link to integration documentation on our website

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

Diagnostics information

I cannot provide data as I am trying to setup the device and therefore do not have it in hass yet.

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No log entry while clicking the button and getting the error message.

Additional information

No response

Malaber avatar Jan 04 '24 16:01 Malaber

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

Code owner commands

Code owners of surepetcare can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Renames the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign surepetcare Removes the current integration label and assignees on the issue, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


surepetcare documentation surepetcare source (message by IssueLinks)

home-assistant[bot] avatar Jan 04 '24 16:01 home-assistant[bot]

Hi, I faced similar issues with my surepet integration yesterday - and I had the feeling, that also the app was responding very slow. Right now, I think there was / is an issue with the cloud service.

You COULD cross-check this by adding the SureHA custom integration. Both, the SureHA and the SurePetcare Component are using "SurePy" - the library, which connects to the Cloud Service.

Please try the setup another time to check, if the issue is still present or not.

ChristophCaina avatar Jan 05 '24 05:01 ChristophCaina

The problem still exists. But I did some research, apparently the API changed recently. https://community.home-assistant.io/t/sureflap-connect-pet-door/41488/705

How do I get a newer version of surepy? Will that just be included with a newer HASS version? Or can I update manually?

You COULD cross-check this by adding the SureHA custom integration. Both, the SureHA and the SurePetcare Component are using "SurePy" - the library, which connects to the Cloud Service.

I am quite new to HASS and have not found how to install the SureHA integration. I am willing to try it of course, just did not figure out how to yet.

Malaber avatar Jan 05 '24 09:01 Malaber

Hey :) I don't think that the API change, mentioned in that link is causing the issues. I am also using SurePetcare for a couple of days now - and do not face such issues at the moment.

Yesterday, there were some outages ... but either due to network issues or due to issues on the cloud service in generall.

From what I know, the SurePetcare integration is using the latest version of SurePy So there isn't much for you to update atm.

To try SureHA, you can use the HomeAssistant Community Store - but this would also depend on how you have HomeAssistant installed (OS, Core, Supervised, etc.)

ChristophCaina avatar Jan 05 '24 10:01 ChristophCaina

I am running HASS on docker container(s). I installed HACS and downloaded the SureHA integration from the HACS store. But now I don't know how to proceed. The installation window said after installation and restart I should visit /config/custom_components/sureha but this page is empty.

Malaber avatar Jan 05 '24 11:01 Malaber

You can Just Check If it is available in your device list (Like Sure petcare)

Screenshot_20240105-123951

ChristophCaina avatar Jan 05 '24 11:01 ChristophCaina

update: Maybe, there IS a bigger issue. The issues I've noticed yesterday evening when the cat entered the house remains today. The "home" status will not be updated - and also not the "away" status when the cat left the house again.

I switched debug level on for surepetcare and sureha and will provide updates when I see something relevant.

ChristophCaina avatar Jan 05 '24 17:01 ChristophCaina

+1 this has been broken for me for a couple of weeks. I try to log in and I get

Config entry 'Sure Petcare' for surepetcare integration could not authenticate: Invalid username/password 8:30:54 PM – (WARNING) config_entries.py - message first occurred at January 3, 2024 at 11:40:52 PM and shows up 5 times

password has been validated by logging in using the app and the password.

Here’s what I get with SureHA using HACS:

Success! Created configuration for Sure Petcare.

We found the following devices:

[my devices]

bobjoylove avatar Jan 09 '24 04:01 bobjoylove

@bobjoylove can you maybe open an issue in SurePy? I bet, that you should get the same error when you are trying to use the SurePetcare core integration?

I don't really know if the login issue is related - but it might be, that there was a change when surepy reads the household information, since this is throwing an 404 (not found) error.

ChristophCaina avatar Jan 09 '24 07:01 ChristophCaina

I also have problems with my Sure Petcare integration in HA. Since January 3rd I get no response and the following errors in the logs: Logger: surepy.client Source: components/surepetcare/init.py:209 First occurred: 24. januar 2024 kl. 20:27:43 (846 occurrences) Last logged: 15:19:44

🐾 [38;2;255;26;102m·[0m GET app.api.surehub.io/api/me/start: 401 | <ClientResponse(https://app.api.surehub.io/api/me/start) [401 Unauthorized]> <CIMultiDictProxy('Date': 'Thu, 25 Jan 2024 14:14:20 GMT', 'Content-Length': '0', 'Connection': 'keep-alive', 'Server': 'nginx', 'Access-Control-Allow-Origin': '*', 'WWW-Authenticate': 'Bearer error="invalid_token", error_description="The token expired at '01/03/2024 23:48:52'"', 'Strict-Transport-Security': 'max-age=31536000; includeSubdomains; preload', 'X-Frame-Options': 'DENY', 'X-Content-Type-Options': 'nosniff', 'X-XSS-Protection': '1; mode=block')>

I tried working around this by adding the SureHA through HACS, but when sending in validated user / pass combination the SureHA just exits with a blank / white message like so:

image

andersovreseth avatar Jan 25 '24 14:01 andersovreseth

It almost looks like having no local access to my own hardware is a bad idea..

Malaber avatar Jan 25 '24 15:01 Malaber

Yes you are right about that, but what alternatives do I really have? Vender control

andersovreseth avatar Jan 25 '24 18:01 andersovreseth

what a mess -.- seems would be coolest to review all api calls and adapt to the „new“ sure petcare api… will try to find some hours this weekend ✊

On Thu, Jan 25, 2024 at 19:06 andersovreseth @.***> wrote:

Yes you are right about that, but what alternatives do I really have? Vender control

— Reply to this email directly, view it on GitHub https://github.com/home-assistant/core/issues/107147#issuecomment-1910728408, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAD5HZIPJEG5FCAN6NIFFCDYQKNIVAVCNFSM6AAAAABBNGAABGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMJQG4ZDQNBQHA . You are receiving this because you were mentioned.Message ID: @.***>

benleb avatar Jan 25 '24 18:01 benleb

Yes you are right about that, but what alternatives do I really have?

First of all I am blaming vendors, not you. Secondly; we 'just' have to reverse engineer the protocol used by the hub like pethublocal tried to.

Malaber avatar Jan 25 '24 19:01 Malaber

https://github.com/benleb/surepy/issues/208 no luck on that part yet either.

riemers avatar Jan 31 '24 13:01 riemers

Yes you are right about that, but what alternatives do I really have?

First of all I am blaming vendors, not you. Secondly; we 'just' have to reverse engineer the protocol used by the hub like pethublocal tried to.

Yes, this would be excellent. For me I would stille like to be able to use the flap "standalone", so a requirement would then be that the HA integration can talk to a local API but that the hub at the same time can talk to surecares own service. I this makes sense.

andersovreseth avatar Jan 31 '24 15:01 andersovreseth

Why do you need the hub to talk to sure simultaneously?

Malaber avatar Jan 31 '24 21:01 Malaber

Suddenly stopped working two days ago whilst I was away (last entry in battery monitor was 20:15 28/1/24 UT), I had not changed anything before I went away. Looks like the authentication model has changed.

2024-02-01 14:48:12.373 ERROR (MainThread) [surepy.client] 🐾 [38;2;255;26;102m·[0m GET app.api.surehub.io/api/me/start: 401 | <ClientResponse(https://app.api.surehub.io/api/me/start) [401 Unauthorized]> 2024-02-01 14:48:13.245 WARNING (MainThread) [homeassistant.config_entries] Config entry 'Sure Petcare' for surepetcare integration could not authenticate: Invalid username/password

neutronwrangler avatar Feb 01 '24 14:02 neutronwrangler

Why do you need the hub to talk to sure simultaneously?

So that I can also keep the "native" app from Sure working in addition to my own setup in IOS Home app via HA.

andersovreseth avatar Feb 01 '24 15:02 andersovreseth

I have had this Integration running for some months now. It stopped working a couple of weeks ago. I checked that I can log in using a browser at https://surepetcare.io/dashboard using the same e-mail address and password I am using when configuring the Integration. I have enabled debugging and then run the "Reconfigure" which ends up with Failed to setup. Here is som cleaned up log. One thing that stands out for me is this: The token expired at 01/22/2024 13:28:09

2024-02-07 15:19:17.596 DEBUG (MainThread) [surepy.client] initialization completed | vars(): {'self': <surepy.client.SureAPIClient object at 0x7fc86f677250>, 'email': '[email protected]', 'password': 'passwordwashere', 'auth_token': None, 'api_timeout': 60, 'session': <aiohttp.client.ClientSession object at 0x7fc8b23adb50>, 'surepy_version': '0.9.0', 'token': None}
2024-02-07 15:19:17.596 DEBUG (MainThread) [surepy] initialization completed | vars(): {'self': <surepy.Surepy object at 0x7fc87b740510>, 'email': '[email protected]', 'password': 'passwordwashere', 'auth_token': None, 'api_timeout': 60, 'session': <aiohttp.client.ClientSession object at 0x7fc8b23adb50>}
2024-02-07 15:19:18.096 DEBUG (MainThread) [surepy.client] initialization completed | vars(): {'self': <surepy.client.SureAPIClient object at 0x7fc8600f9050>, 'email': '[email protected]', 'password': 'passwordwashere', 'auth_token': 'longtokenwashere', 'api_timeout': 60, 'session': <aiohttp.client.ClientSession object at 0x7fc8b23adb50>, 'surepy_version': '0.9.0'}
2024-02-07 15:19:18.097 DEBUG (MainThread) [surepy] initialization completed | vars(): {'self': <surepy.Surepy object at 0x7fc872090350>, 'email': '[email protected]', 'password': 'passwordwashere', 'auth_token': 'longtokenwashere', 'api_timeout': 60, 'session': <aiohttp.client.ClientSession object at 0x7fc8b23adb50>}
2024-02-07 15:19:18.307 ERROR (MainThread) [surepy.client] 🐾 [38;2;255;26;102m·[0m GET app.api.surehub.io/api/me/start: 401 | <ClientResponse(https://app.api.surehub.io/api/me/start) [401 Unauthorized]>
<CIMultiDictProxy('Date': 'Wed, 07 Feb 2024 14:19:18 GMT', 'Content-Length': '0', 'Connection': 'keep-alive', 'Server': 'nginx', 'Access-Control-Allow-Origin': '*', 'WWW-Authenticate': 'Bearer error="invalid_token", error_description="The token expired at \'01/22/2024 13:28:09\'"', 'Strict-Transport-Security': 'max-age=31536000; includeSubdomains; preload', 'X-Frame-Options': 'DENY', 'X-Content-Type-Options': 'nosniff', 'X-XSS-Protection': '1; mode=block')>

2024-02-07 15:19:18.827 DEBUG (MainThread) [surepy.client] 🐾 [38;2;0;255;0m·[0m GET app.api.surehub.io/api/me/start | 6
2024-02-07 15:19:18.827 DEBUG (MainThread) [homeassistant.components.surepetcare] Finished fetching surepetcare data in 0.730 seconds (success: False)
2024-02-07 15:19:18.827 WARNING (MainThread) [homeassistant.config_entries] Config entry 'Sure Petcare' for surepetcare integration could not authenticate: Invalid username/password

jbruntt avatar Feb 07 '24 15:02 jbruntt

@benleb did you have any time to look at this at all?

andersovreseth avatar Feb 07 '24 15:02 andersovreseth

@benleb did you have any time to look at this at all?

I have just run all my updates and it is now working by the looks of things

dynamiccarrots avatar Feb 07 '24 16:02 dynamiccarrots

@benleb did you have any time to look at this at all?

I have just run all my updates and it is now working by the looks of things

How did you reauthenicate, or did you not have to?

I've just updated and on restart had the same error, when clicking on the link and re-entering the password I get the same dialog with only Sure Petcare and CLOSE

Is there another way?

neutronwrangler avatar Feb 07 '24 21:02 neutronwrangler

Is the right way to update to download the dev version of the Sureha integration in HACS and then restart HA? Or is there another way to get the latest code?

andersovreseth avatar Feb 07 '24 22:02 andersovreseth

I had the same problem. Removing the integration and reinstalling the integration worked fine.

Timmo3 avatar Feb 09 '24 20:02 Timmo3

I can confirm that removing the integration, re-adding and authenticating fixes the problem.

All entities and history are preserved, except of course the history when it could not connect.

neutronwrangler avatar Feb 11 '24 11:02 neutronwrangler

Worked for me too!

Mattheo1985 avatar Feb 11 '24 21:02 Mattheo1985

Worked for me as well.

jbruntt avatar Feb 19 '24 11:02 jbruntt

My integration stopped working a few days ago. Can confirm removing and adding again worked for me too.

dirkjanvanvliet avatar Feb 22 '24 15:02 dirkjanvanvliet

For me it does not work, I still get "Failed to connect" (And yes, I checked my password 5 times, it is correct, also it would probably say "incorrect password" or something like that if that was the problem) and see nothing in the logfile.

Malaber avatar Feb 29 '24 21:02 Malaber