Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No data from api #65

Open
flashi81 opened this issue Dec 5, 2024 · 20 comments
Open

No data from api #65

flashi81 opened this issue Dec 5, 2024 · 20 comments

Comments

@flashi81
Copy link

flashi81 commented Dec 5, 2024

Since yesterday I got no data from the api regarding the cat location. It states 'not_home' but on the Sure Petcare App the cat is in state 'home'. Could you please check.

Thx in advance!

@pupe666
Copy link

pupe666 commented Dec 5, 2024

Same here. Let me know if I can help with logs or something else.

@flashi81
Copy link
Author

flashi81 commented Dec 5, 2024

I played a bit and it seems that also surepy gets no data to 'where' state.
Furthermore I sent a few http request to the "app-api.production.surehub.io" endpoint.

There is also no 'where' state in JSON response., The web app has also only a questionmark in the pets location.
The mobile app works fine, maybe it has another endpoint or they deliver only to the app via header selection (X-App-Version=browser). I could not compare the request from the mobile app cause of proxy routing ...

@Alex-ala
Copy link

Alex-ala commented Dec 5, 2024

This does not seem to be an issue with either sureha or surepy.
Testing around a bit, the pets that did pass through my flap today have no ["position"]["where"] in SurePets api response.
Actually they don't have a "position" at all:

{'id': xxx, 'name': 'Durin', 'gender': 1, 'date_of_birth': '2022-07-07T00:00:00+00:00', 'weight': '99000', 'comments': '', 'breed_id': 333, 'food_type_id': 1, 'household_id': xxx, 'species_id': 1, 'spayed': 1, 'tag_id': xxx, 'version': 4, 'created_at': '2022-09-18T06:11:52+00:00', 'updated_at': '2022-09-25T15:44:23+00:00', 'conditions': [{'id': 1, 'version': 0, 'created_at': '2022-09-18T06:14:04+00:00', 'updated_at': '2022-09-18T06:14:04+00:00'}], 'tag': {'id': xxx, 'tag': 'xxxxxxx', 'supported_product_ids': [3, 4, 6, 8, 32], 'version': 318, 'created_at': '2022-09-18T06:11:52+00:00', 'updated_at': '2022-11-09T07:38:26+00:00'}, 'status': {}}

This is also in-line with the SurePet app, where affected pets have both buttons "Change location to Inside" and "Change location to outside".

So I assume its again an outage or incident on SurePets cloud side.

@flashi81
Copy link
Author

flashi81 commented Dec 6, 2024

I disagree, because the android app works well. There is the correct location presented. I think there is another endpoint or header value in place which delivers the 'where' state - let's shift to that endpoint.

@Alex-ala
Copy link

Alex-ala commented Dec 6, 2024

Hm seems like the app does something correct.
Testing with mitmproxy on my iOS app, I see the correct state of the pet. This comes from a call to
https://app-api.production.surehub.io/api/dashboard/pet?Pet_Id=xxx&Pet_Id=xxx&Pet_Id=xxx&Pet_Id=xxx&Pet_Id=xxx&Pet_Id=xxx&Pet_Id=xxx&From=2024-12-05T23:00:00.000Z&dayshistory=7&with%5B%5D=photo&with%5B%5D=breed&with%5B%5D=conditions&with%5B%5D=tag&with%5B%5D=food_type&with%5B%5D=species&with%5B%5D=position&with%5B%5D=status
This yields data including a "where": 1 within movement.

However, the app still still allows me to set both inside and outside although the pet is shown as inside.
The webapp at https://www.surepetcare.io/dashboard does not show any location state and also allows for setting both options.

In addition to that, active pets that haven't used the flap in a while (got some spare test-rfids) are still shown the previous location within the api endpoint used by sureha.

This inconsistency seems weird to me.

@chrisg30
Copy link

chrisg30 commented Dec 6, 2024

I'm using the official HA SurePetCare integration and while searching for alternatives, came across sureha. I haven't installed it yet but was looking for install instructions and found this issue reported.

I noticed yesterday that one of my cats is stuck 'away', but on the SureCare app, it's showing status normally. I logged into https://www.surepetcare.io/ and my problem cat's status is a ? symbol.

So I think the issue is on the SureFlap side of things. I've opened a case with support - awaiting an answer.

@flashi81
Copy link
Author

flashi81 commented Dec 6, 2024

Hm seems like the app does something correct. Testing with mitmproxy on my iOS app, I see the correct state of the pet. This comes from a call to https://app-api.production.surehub.io/api/dashboard/pet?Pet_Id=xxx&Pet_Id=xxx&Pet_Id=xxx&Pet_Id=xxx&Pet_Id=xxx&Pet_Id=xxx&Pet_Id=xxx&From=2024-12-05T23:00:00.000Z&dayshistory=7&with%5B%5D=photo&with%5B%5D=breed&with%5B%5D=conditions&with%5B%5D=tag&with%5B%5D=food_type&with%5B%5D=species&with%5B%5D=position&with%5B%5D=status This yields data including a "where": 1 within movement.

However, the app still still allows me to set both inside and outside although the pet is shown as inside. The webapp at https://www.surepetcare.io/dashboard does not show any location state and also allows for setting both options.

In addition to that, active pets that haven't used the flap in a while (got some spare test-rfids) are still shown the previous location within the api endpoint used by sureha.

This inconsistency seems weird to me.

Could you please provide the whole request (also headers). In case of a post request, please also provide the body.

@Alex-ala
Copy link

Alex-ala commented Dec 6, 2024

Sure:

This is the first request containing data about the device/household and assigned pets:

Details

GET https://app-api.production.surehub.io/api/device?with%5B0%5D=children&with%5B1%5D=tags&with%5B2%5D=control&with%5B3%5D=status&householdid=xxx
HTTP/2.0
x-datadog-parent-id: xxx
tracestate: dd=s:0;o:rum;p:xxx
accept: application/json, text/plain, */*
spc-client-type: react
authorization: Bearer xxx
x-datadog-sampling-priority: 0
x-datadog-trace-id: xxx
accept-encoding: gzip, deflate, br
accept-language: en
if-none-match: "xxx"
user-agent: SurePetcare/77 CFNetwork/1568.200.51 Darwin/24.1.0
x-datadog-origin: rum
traceparent: xxx
content-length: 0

HTTP/2.0 200 
date: Fri, 06 Dec 2024 17:55:19 GMT
content-type: application/json; charset=utf-8
server: nginx
etag: "aXX4JlrYCvWezkpcIApow0hxxcs"
api-supported-versions: 1.0
strict-transport-security: max-age=31536000; includeSubdomains; preload
x-frame-options: DENY
x-content-type-options: nosniff
x-xss-protection: 1; mode=block
content-length: 2188

{"data":[{"id":xxx,"product_id":1,"household_id":xxx,"name":"xxx","serial_number":"xxx","mac_address":"xxx","version":58088,"created_at":"2019-12-06T10:03:19+00:00","updated_at":"2024-12-06T17:54:28+00:00","last_new_event_at":"2024-12-06T17:54:27+00:00","control":{"led_mode":0,"pairing_mode":0},"status":{"pairing_mode":0,"led_mode":0,"version":{"device":{"hardware":"3.0","firmware":"233.364"}},"online":true},"tags":[]},{"id":xxx,"parent_device_id":xxx,"product_id":6,"household_id":xxx,"index":0,"name":"Durins Tor","serial_number":"xxx","mac_address":"xxx","version":42213,"created_at":"2021-02-04T07:50:29+00:00","updated_at":"2024-12-06T16:56:16+00:00","pairing_at":"2021-09-14T16:14:26+00:00","last_new_event_at":"2024-12-06T16:56:15+00:00","control":{"curfew":[{"enabled":false,"lock_time":"22:00","unlock_time":"22:01"}],"locking":1,"fast_polling":false},"status":{"battery":5.355,"learn_mode":false,"locking":{"mode":1},"signal":{"device_rssi":-84,"hub_rssi":-70},"version":{"device":{"hardware":"10","firmware":"335.422"}},"online":true},"tags":[{"id":xxx,"device_id":xxx,"index":1,"profile":2,"version":91,"created_at":"2023-10-15T08:34:51+00:00","updated_at":"2024-12-06T07:07:14+00:00"},{"id":xxx,"device_id":xxx,"index":6,"profile":3,"version":2,"created_at":"2024-10-19T04:23:13+00:00","updated_at":"2024-10-30T19:32:15+00:00"},{"id":xxx,"device_id":xxx,"index":2,"profile":2,"version":0,"created_at":"2023-09-03T10:03:10+00:00","updated_at":"2023-09-03T10:03:10+00:00"},{"id":xxx,"device_id":xxx,"index":3,"profile":2,"version":1,"created_at":"2024-12-01T10:15:23+00:00","updated_at":"2024-12-01T10:15:23+00:00"},{"id":xxx,"device_id":xxx,"index":4,"profile":2,"version":23,"created_at":"2023-10-15T08:36:19+00:00","updated_at":"2024-12-03T05:26:51+00:00"},{"id":xxx,"device_id":xxx,"index":5,"profile":2,"version":3,"created_at":"2023-10-15T08:34:44+00:00","updated_at":"2023-10-20T06:02:56+00:00"},{"id":xxx,"device_id":xxx,"index":7,"profile":2,"version":2,"created_at":"2023-09-03T10:01:37+00:00","updated_at":"2023-10-15T08:30:30+00:00"}]}],"meta":{"count":2}}

followed by this request containing the pets state (again, this is only within the app, the webapp does not do this and show inconsistent states):

Details

GET https://app-api.production.surehub.io/api/dashboard/pet?Pet_Id=xxx&Pet_Id=xxx&Pet_Id=xxx&Pet_Id=xxx&Pet_Id=xxx&Pet_Id=xxx&Pet_Id=xxx&From=2024-12-05T23:00:00.000Z&dayshistory=7&with%5B%5D=photo&with%5B%5D=breed&with%5B%5D=conditions&with%5B%5D=tag&with%5B%5D=food_type&with%5B%5D=species&with%5B%5D=position&with%5B%5D=status HTTP/2.0
x-datadog-parent-id: xxx
tracestate: dd=s:0;o:rum;p:xxx
accept: application/json, text/plain, */*
spc-client-type: react
authorization: Bearer xxx
x-datadog-sampling-priority: 0
x-datadog-trace-id: xxx
accept-encoding: gzip, deflate, br
accept-language: en
if-none-match: "xxx"
user-agent: SurePetcare/77 CFNetwork/1568.200.51 Darwin/24.1.0
x-datadog-origin: rum
traceparent: xxx
content-length: 0


HTTP/2.0 200 
date: Fri, 06 Dec 2024 17:55:30 GMT
content-type: application/json; charset=utf-8
server: nginx
etag: "8QO8L1T2rktxOXWLwn-3eElrOFM"
api-supported-versions: 1.0
strict-transport-security: max-age=31536000; includeSubdomains; preload
x-frame-options: DENY
x-content-type-options: nosniff
x-xss-protection: 1; mode=block
content-length: 13922

Response payload (stripped to just one pet and one day of historical data for readability:

Details

{
    "data": [
        {
            "pet_id":xxx,
            "movement": {
                "date": "2024-12-05T23:00:00+00:00",
                "where": 1,
                "time_outside": "07:31:29",
                "since": "2024-12-06T14:30:13+00:00",
                "trips_outside": 4,
                "entries": 6,
                "activity": [
                    {
                        "date": "2024-11-28T23:00:00+00:00",
                        "time_outside": "08:37:12"
                    }
                ]
            },
            "drinking": {
                "date": "2024-12-05T23:00:00+00:00",
                "substance_type": 1,
                "total_consumption": 0,
                "number_of_visits": 0,
                "consumption_time": 0,
                "activity": [
                    {
                        "total_consumption": 0,
                        "date": "2024-11-28T23:00:00+00:00"
                    }
                ]
            },
            "feeding": {
                "date": "2024-12-05T23:00:00+00:00",
                "substance_type": 2,
                "total_consumption": 0,
                "number_of_visits": 0,
                "consumption_time": 0,
                "activity": [
                    {
                        "total_consumption": 0,
                        "date": "2024-11-28T23:00:00+00:00"
                    }
                ]
            },
            "consumption_habit": [],
            "consumption_alert": []
        }
    ]
}

@Stono
Copy link

Stono commented Dec 7, 2024

Screenshot_20241207-062847
Same here. Pet just shows permanently away, app shows correctly. No logs in HA indicating any issues

@WoBBeLnl
Copy link

WoBBeLnl commented Dec 7, 2024

Same here, SureHA and Sure Petcare HA integration show away but the https://surepetcare.io/ shows unknown as mentioned before. It's something with their API it seems. Weirdly enough the app works for me.

Cannot find the API request containing the unknown/away on surepetcare.io so I cannot double check it.

I also reported it to Sure Petcare. Let's hope we get something fixed out of it :-)

@rjclocks
Copy link

rjclocks commented Dec 9, 2024

Location data is available correctly on the Sure Pet phone app, but not the https://surepetcare.io/ web app page.

I have chased this with Sure Petcare and been told the following:

The web app is no longer supported. For real time information and up to date movements, you will need to refer to the current mobile App.
A new web app will be available in future updates.

It seems that they are altering the way that their data is exposed and that is messing with all the integrations based on the original web calls and data structures.

@rjclocks
Copy link

rjclocks commented Dec 9, 2024

Currently the 'timeline' data is still available, so you could process the last movements and identify which pet is in/out from this, but is it a hack rather than a solution.

@Laho812
Copy link

Laho812 commented Dec 10, 2024

I got the same reply from sure petcare:

Thank you for your feedback. 

Here below is the advice from our Connect expert:

The old version of the webapp is no longer supported. Customers are asked to use the new mobile app, as some features will soon stop working, and will be replaced by the new app.   

In this case, the old webapp displays the wrong information. The new app should display the correct information. 

Thank you for your understanding.

@WoBBeLnl
Copy link

WoBBeLnl commented Dec 10, 2024

Lol, I only got a reply to re-pair my cat flap 🤣

But this means the app API should be investigated to fix the issue (and probably for all things bc the web app is deprecated)

@Laho812
Copy link

Laho812 commented Dec 10, 2024

I found a link to a sure petcare API in the surepy discussion. Looks like they created a new v2 API: https://app-api.beta.surehub.io/index.html?urls.primaryName=V2

/api/v2/timeline and /api/v2/report/household/{householdId}/pet/{petId}/aggregate have an attribute movements which contains direction and side information. Maybe it's possible to get the pet location this way.

@chrisg30
Copy link

chrisg30 commented Dec 10, 2024

My HA status just started working for one of my cats that was stuck away. I'm using the official SurePetCare integration but maybe it fixed sureha as well? Also the web portal surepetcare.io is also now reflecting his status correctly as well, no more ? there.

@WoBBeLnl
Copy link

Here as well 👍

@Pegi68
Copy link

Pegi68 commented Dec 10, 2024

Yes, it works again ;-)

@Laho812
Copy link

Laho812 commented Dec 11, 2024

I asked them if they plan to continue the web version cause they told me the old one is discontinued.
Here is the answer:

If you have a problem with the question mark, you will be asked to use the mobile app for the near future.

We were supposed to launch the new web app in spring 2025. I cannot give you a more precise date at the moment. 

Thank you very much. 

@neuroticsin
Copy link

Still nothing for the SureFeed which has been down as well.. app works good, but api is not allowed as the token is invalid?? which token, as that can't be set anywhere or am i missing something

Logger: surepy.client
Bron: custom_components/sureha/__init__.py:112
integratie: SureHA ([documentatie](https://github.com/benleb/sureha), [problemen](https://github.com/benleb/sureha/issues))
Eerst voorgekomen: 10 december 2024 om 19:21:38 (1 gebeurtenissen)
Laatst gelogd: 10 december 2024 om 19:21:38

🐾 �[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': 'Tue, 10 Dec 2024 18:21:38 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 \'12/09/2024 22:25:41\'"', 'Strict-Transport-Security': 'max-age=31536000; includeSubdomains; preload', 'X-Frame-Options': 'DENY', 'X-Content-Type-Options': 'nosniff', 'X-XSS-Protection': '1; mode=block')>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants