RobertD502 / home-assistant-petkit

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

Would it be possible to support trackers via API pooling? #57

Closed igorsantos07 closed 8 months ago

igorsantos07 commented 9 months ago

I used to run https://github.com/hasscc/petkit, but the stats support was very poor and today I realized the project got completely abandoned.

I was wondering if it would be possible to integrate collar tracker support to this project, using API pooling as that other project did - but of course, with the entries being proper statistical entities haha

Cheers!

RobertD502 commented 9 months ago

I'm assuming you're referring to the PetKit Fit collar? I don't have any plans to support it in the near future as I haven't had much time lately and need to get the new YumShare feeders integrated first.

Out of curiosity...are you able to use the family share feature to share the collar with a second account? This is important since the primary account will need to be used with the integration - if you can't use the secondary account to connect to the collar via bluetooth (using the PetKit app), then the info pulled by the API will never be updated.

igorsantos07 commented 9 months ago

Yep, correct, the collars!

Given the other integration was mostly useless, there's some time I don't use the collars again, but I can take them out of the wardrobe and put them to use, if you want a tester.

IIRC it was a frequently requested feature in the Petkit forums - no, there was no way to share the collars, and I doubt it changed in the last 12 months. That said, as I mentioned earlier, the other integration was able to bring information onto HA without any extra configuration in regards to secondary accounts and all. The problems were:

You can see in the aptly numbered issue 42 more details about missing features and a screenshot of actual data - I couldn't find a correlation between updated values and times/reasons for update.

I'm surprised they never deactivated those forums; it's a live testament to how terrible their products seem to be :joy:

RobertD502 commented 9 months ago

The old integration was able to do what it did because it used the old API - PETKIT has changed their system and that is why users of newer devices such as water fountains weren't able to get any info from the old integration since that API didn't support newer devices. The new API doesn't allow one account to be used on multiple devices (i.e., you can't use the same account with this integration and the PETKIT app).

If you were to use this integration, you will HAVE to use the primary account with the integration. This means that you will not be able to use the PETKIT app at the same time with the same account. As a result, once you use the account connected to the collar with this integration, the data from the API will reflect the data that was available the last time the account was used with their app and connected to the collar via Bluetooth. You will not be able to get updated data from the collar since it requires using their app to initiate a Bluetooth connection to the collar to then send updated info to their servers.

PETKIT has made some changes to their family share feature (devices that you previously couldn't share, such as water fountains, can now be shared). I'd download the app, create a secondary account, sign in with your primary account, add the secondary account to the "family", log into the app using the secondary account and see if the collar is accessible to the secondary account. If it isn't, then adding support for the collar doesn't make much sense on account the data being stale and never being updated once you start using the account with this integration.

Regarding the update frequency: the integration wouldn't have any control over that. All it does is poll the API at a set interval. If the collar can be shared with a secondary account, new data would only become available to the API when the collar connects to your phone (via Bluetooth using the PETKIT app) as your phone is what will send the new data from the collar to the PETKIT servers.

github-actions[bot] commented 8 months ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] commented 8 months ago

This issue was closed because it has been stalled for 5 days with no activity.