RobertD502 / home-assistant-petkit

Home Assistant integration for PetKit devices
MIT License
213 stars 32 forks source link

PetKit Error 97: App is out of date, please upgrade #85

Closed lasry1 closed 1 week ago

lasry1 commented 2 weeks ago

Hi, i’ve encountered an error recently without changing anything in HomeAssistant. Is it just me or the Petkit app has been upgraded and now isn’t working for everyone?

Logger: custom_components.petkit Source: custom_components/petkit/util.py:48 integration: PetKit (documentation, issues) First occurred: 09:21:23 (1 occurrences) Last logged: 09:21:23

Unknown PetKit Error: PetKit Error 97: App is out of date, please upgrade

Nafania commented 2 weeks ago

Same issue here

Judufu commented 2 weeks ago

Same here

ejfn commented 2 weeks ago

Same here

HVPereira commented 2 weeks ago

Yes unfortunatelly i'm facing the same problem

willliamchan commented 2 weeks ago

Yes same here too.

alexpelli commented 2 weeks ago

same here

Theetjuh commented 2 weeks ago

Indeed, the same issue

fr00sch commented 2 weeks ago

Same issue

emahassio commented 2 weeks ago

Sams here, considering everything is at last version ... Someone got a solution?

superpower10 commented 2 weeks ago

Same

Millyto22 commented 2 weeks ago

Hi everyone, got the very same error myself as well, since this morning

This error originated from a custom integration.

Logger: custom_components.petkit Source: helpers/update_coordinator.py:386 integration: PetKit (documentation, issues) First occurred: 08:49:59 (1 occurrences) Last logged: 08:49:59

Error fetching petkit data: PetKit Error 97: App is out of date, please upgrade

kirashogun commented 2 weeks ago

Same error here

GentleHoneyLover commented 2 weeks ago

I also have this issue since today…

MaLo-89 commented 2 weeks ago

Same here

johntheth1rd commented 2 weeks ago

Same here

mrkaqz commented 2 weeks ago

Yes, same error this morning

ioannispelelis commented 2 weeks ago

Same since 04/11/2024 12:22 UTC

Tomaz69170 commented 2 weeks ago

Same here This morning it started at 8am UTC

geertmeersman commented 2 weeks ago

The problem is located in the PetKitAIO library. I have made a fix, will create a fork this evening or sooner if I find some time

Nafania commented 2 weeks ago

@RobertD502 thank you very much for quick support!

Theetjuh commented 2 weeks ago

Hhmm it doesn’t seem to fix for me, do others have the same issue?

DieterKoblenz commented 2 weeks ago

Hhmm it doesn’t seem to fix for me, do others have the same issue?

It does work for me. Are you sure you installed .12 with the hotfix? I had to manually reload HACS to find the newest version.

And many thanks Robert for your lightning fast response!

Theetjuh commented 2 weeks ago

Hhmm it doesn’t seem to fix for me, do others have the same issue?

It does work for me. Are you sure you installed .12 with the hotfix? I had to manually reload HACS to find the newest version.

And many thanks Robert for your lightning fast response!

Yeah got 0.1.12 running, indeed needed to refresh HACS manually. For further debug, region set is ‘Netherlands’.

Millyto22 commented 2 weeks ago

Hhmm it doesn’t seem to fix for me, do others have the same issue?

It does work for me. Are you sure you installed .12 with the hotfix? I had to manually reload HACS to find the newest version.

And many thanks Robert for your lightning fast response!

Managed to get .12,but unfortunately now I cannot add the devices anymore, as when i connect my account system tells me there are no devices under my account. any ideas?

Cyrelion commented 2 weeks ago

Same here, no device under my account.

adriannow commented 2 weeks ago

Same here:

Logger: custom_components.petkit
Source: custom_components/petkit/util.py:57
integration: petkit ([documentation](https://github.com/RobertD502/home-assistant-petkit/blob/main/README.md), [issues](https://github.com/RobertD502/home-assistant-petkit/issues))
First occurred: 4:53:30 PM (5 occurrences)
Last logged: 5:09:18 PM

Could not retrieve any devices from PetKit servers
RobertD502 commented 2 weeks ago

Are you using the main account for the integration? One of the API changes requires sending a group id in the devices requests which is by default the user ID. This is likely where the issue is.

fr00sch commented 2 weeks ago

I have the same Problem.

Cyrelion commented 2 weeks ago

I've a main account for HomeAssistant that owns all the devices and have a private account that is invited for administration via the App

Theetjuh commented 2 weeks ago

I've a main account for HomeAssistant that owns all the devices and have a private account that is invited for administration via the App

I got exactly the same

RobertD502 commented 2 weeks ago

Will be fixed. It's a groupId issue.

ioannispelelis commented 2 weeks ago

FYI i updated to v0.1.12. integration was always connected via a secondary account and the Petkit Freshelements Mini Pro started working again after update and restart image

willliamchan commented 2 weeks ago

Problem solved with the hotfix, thank you!

adriannow commented 2 weeks ago

Are you using the main account for the integration? One of the API changes requires sending a group id in the devices requests which is by default the user ID. This is likely where the issue is.

I only have one main account (I don't use Petkit app on the phone, after adding it to HA).

emahassio commented 2 weeks ago

FIXES with Hotfix!!!

@RobertD502 my cat has very serious health problems and for me it is vitally important to be able to monitor him 24 hours a day, his life is at stake. A thousand thanks!! ❤️❤️❤️❤️

lasry1 commented 2 weeks ago

Unfortunately It doesn't fix it for me.

I deleted the integration out of desperation and now when i try to add it it always shows 'No devices found on account'

I only use a single account and i have previously logged out of the Petkit app before trying to add it.

I also have deleted and installed the hot fix version of the integration and still displays the same message when trying to add it

ITElite22 commented 2 weeks ago

Ive still problems... it says the account doesnt have any devices. But i tried it with the main (which i used before) and with the secondary account which i use to look into the app.

My login is at Germany

GentleHoneyLover commented 2 weeks ago

Same situation as @lasry1 and @ITElite22 — "No devices found on account" when trying to add the integration. My country is also Germany.

geertmeersman commented 2 weeks ago

Origin of the issue is identified, @RobertD502 will provide a fix soon, nothing related to Germany ;-)

nberardi commented 2 weeks ago

I deleted the integration out of desperation and now when i try to add it it always shows 'No devices found on account'

I am having the same issue. The latest update doesn't resolve my issue. I am using the primary account by the way.

nberardi commented 2 weeks ago

Origin of the issue is identified, @RobertD502 will provide a fix soon, nothing related to Germany ;-)

I am not sure I understand your response. Are you saying that the current issues not resolved by the fix 3 hours ago, is a regional issue? As I am in the United States, and I am still having issues.

Ledfoot775 commented 2 weeks ago

I had the same issue, and all resolved with the hotfix (my region is Australia FYI)

You're a legend and thanks!

geertmeersman commented 2 weeks ago

Origin of the issue is identified, @RobertD502 will provide a fix soon, nothing related to Germany ;-)

I am not sure I understand your response. Are you saying that the current issues not resolved by the fix 3 hours ago, is a regional issue? As I am in the United States, and I am still having issues.

The fix fixed the original issue linked to the App version, which was "out of date" The one you are referring to is that the device list is empty, but this is being fixed, just stay tuned

RobertD502 commented 2 weeks ago

0.1.12.1 has been released and should end today's saga

rubin110 commented 2 weeks ago

For posterity's sake, here's some logging...

2024-11-04 14:03:31.602 DEBUG (MainThread) [custom_components.petkit] Found the following PetKit devices/pets: PetKitData(user_id='REDACTED', feeders={}, litter_boxes={}, water_fountains={}, pets={}, purifiers={})
2024-11-04 14:03:31.602 DEBUG (MainThread) [custom_components.petkit] Finished fetching petkit data in 0.602 seconds (success: True)

My cats didn't get fed this morning, my bad. I'm sitting down right now to setup some unavailable entity notifications. Seems like a good thing to do while the kind and dapper @RobertD502 volunteers their own personal time to figure out a fix.

Thanks Dr. Drinovac!

PS, if you're handy with a soldering iron there is an ESPHome config for the Solo to get the device off of the cloud service and accessible locally.

Edit: Lol I typed all of that up right when the next fix got posted. :D

rubin110 commented 2 weeks ago

Sadly with 0.1.12.1 I'm getting this fresh new error...

2024-11-04 14:41:51.122 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/aiohttp/web_protocol.py", line 477, in _handle_request
    resp = await request_handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/web_app.py", line 559, in _handle
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/web_middlewares.py", line 117, in impl
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 92, in security_filter_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 83, in forwarded_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 26, in request_context_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 85, in ban_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 242, in auth_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/headers.py", line 32, in headers_middleware
    response = await handler(request)
               ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/http.py", line 73, in handle
    result = await handler(request, **request.match_info)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/decorators.py", line 81, in with_admin
    return await func(self, request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 222, in post
    return await super().post(request, flow_id)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 74, in wrapper
    return await method(view, request, data, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 122, in post
    result = await self._flow_mgr.async_configure(flow_id, data)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 370, in async_configure
    result = await self._async_configure(flow_id, user_input)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 417, in _async_configure
    result = await self._async_handle_step(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 520, in _async_handle_step
    result: _FlowResultT = await getattr(flow, method)(user_input)
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/petkit/config_flow.py", line 127, in async_step_user
    await async_validate_api(self.hass, email, password, region, timezone)
  File "/config/custom_components/petkit/util.py", line 33, in async_validate_api
    devices_query = await client.get_device_roster()
                          ^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'PetKitClient' object has no attribute 'get_device_roster'. Did you mean: 'get_device_rosters'?

Making that change leads me to...

  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 520, in _async_handle_step
    result: _FlowResultT = await getattr(flow, method)(user_input)
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/petkit/config_flow.py", line 127, in async_step_user
    await async_validate_api(self.hass, email, password, region, timezone)
  File "/config/custom_components/petkit/util.py", line 54, in async_validate_api
    devices: dict[str] Any] = devices_query['result']['devices]
                              ~~~~~~~~~~~~~^^^^^^^^^^
KeyError: 'result'
adriannow commented 2 weeks ago

On 0.1.12.1 I'm getting Unknown error occurred when trying to set up integration. Same output as @rubin110

RobertD502 commented 2 weeks ago

For posterity's sake, here's some logging...

2024-11-04 14:03:31.602 DEBUG (MainThread) [custom_components.petkit] Found the following PetKit devices/pets: PetKitData(user_id='REDACTED', feeders={}, litter_boxes={}, water_fountains={}, pets={}, purifiers={})
2024-11-04 14:03:31.602 DEBUG (MainThread) [custom_components.petkit] Finished fetching petkit data in 0.602 seconds (success: True)

My cats didn't get fed this morning, my bad. I'm sitting down right now to setup some unavailable entity notifications. Seems like a good thing to do while the kind and dapper @RobertD502 volunteers their own personal time to figure out a fix.

Thanks Dr. Drinovac!

PS, if you're handy with a soldering iron there is an ESPHome config for the Solo to get the device off of the cloud service and accessible locally.

Edit: Lol I typed all of that up right when the next fix got posted. :D

Highly recommend NOT using Home Assistant automations as a way of creating a feeding schedule. Set up feeding schedules through the petkit app as this gets stored locally on the device - in the event the feeder can't reach PetKit's servers (API is down or you're experiencing an internet outage), feedings will continue to dispense according to the schedule.

RobertD502 commented 2 weeks ago

@adriannow @rubin110

That's my bad. Didn't realize one of the functions I use in the config flow is the exact one I had changed the name of in the backend - didn't come across this error since my account was already set up in HA. One moment. Will throw out another release.

adriannow commented 2 weeks ago

@RobertD502 No problem, thank you for quickly addressing the update in API.