RobertD502 / home-assistant-petkit

Home Assistant integration for PetKit devices
MIT License
156 stars 24 forks source link

Issues on pura max #68

Open override80 opened 1 month ago

override80 commented 1 month ago

Hi @RobertD502 , since I added a Eversweet 3 fountain i'm experiencing issues with my pura max. Sometimes the cat litter just hangs, sometimes it restarts in the middle of a reset, sometimes it does not do the automatic cleaning. Sometimes it just shuts down and I have to unplug and plug it back to make it work. I honestly doubt that it's related to this integration, it seems more like a firmware issue or hardware problem.

Are you aware of any possible issue connected to BLE Relay and/or Pura Max like this ones?

RobertD502 commented 1 month ago

Yes, this has been brought up in discord where we have narrowed it down to the BLE relay - the current default polling interval (2 minutes) causes the Pura Max to lock up. This issue is caused by the firmware in the Pura Max and it not being able to handle initiating the BLE relay every 2 minutes. If one of the feeders is used to act as the BLE relay, they don't lock up like the Pura Max.

It is unlikely that they are aware that this issue exists in the Pura Max firmware since their regular users are not using the PetKit app every 2 minutes to trigger the Pura Max to initiate a BLE relay to the water fountain.

To get around this, change the polling interval to 7 minutes. I've already completed the fix for this issue and it will be in the next release - in the next release, you can change the polling interval back to 2 minutes since the library will have a separate time check that will only initiate the BLE relay if it has been 7 minutes since the last time the BLE relay has been initiated (this way you can still get new data from your devices every 2 minutes and only check for new water fountain data every 7 minutes).

override80 commented 1 month ago

Thank you for the feedback! I raised the polling interval to 420s and wait for the next release.

override80 commented 1 month ago

Hi @RobertD502 , i had to set it to 450s.

Sometimes I still have issues btw, automatic cleaning getting canceled, litter not cleaning... It seems that it's happening when getting data during cleaning.

RobertD502 commented 1 month ago

You still have issues when set to 450s?

Out of curiosity, after having changed the polling interval to both 420s and 450s, did you hard reboot the litter box (unplugged it from power and plugged it back in) either of those times? Changing the time interval without hard rebooting the litter box as well more than likely results in the issue persisting, albeit less frequently, because the litter box remains in a "bad" state.

override80 commented 1 month ago

Ouch! No i didn't! Let me try to disconnect and reconnect! Thanks

override80 commented 5 days ago

Hi @RobertD502 , it's still sporadically happening to me, even after setting the 450s timeout. I disabled the intergration for a week, today i enabled it again and the litter got stuck halfway up during a cleaning. Display off, no way to get it working except unplugging and replugging. Do you think there is something else i can try?

RobertD502 commented 4 days ago

Only thing you can do is keep bumping the time higher and higher until you find a sweet spot.

override80 commented 4 days ago

Yeah it was set up to 600 today and still happened - i should fine a safe value. Is the fix already available on main or should i wait for the release?

RobertD502 commented 4 days ago

Not available on the main repo. However, the next release will have a set time of 420 with an option to manually set it to a higher value. This way you will be able to set the BLE relay time to a higher value that is separate from the rest of the polling process.

Increasing the time is the only potential fix since the culprit is something within the Max firmware. Have you checked to see, using the app, if there is a firmware update?

override80 commented 4 days ago

Yes I did, unfortunately I'm on latest and still having the issue sometimes. Do you think that polling during cat litter operations could be the issue? For example, if I don't poll while cleaning, there will be no issues?

RobertD502 commented 4 days ago

You can also try changing your manifest.json file to use this content instead:

{
  "domain": "petkit",
  "name": "PetKit",
  "codeowners": [
    "@RobertD502"
  ],
  "config_flow": true,
  "dependencies": [],
  "documentation": "https://github.com/RobertD502/home-assistant-petkit/blob/main/README.md",
  "integration_type": "hub",
  "iot_class": "cloud_polling",
  "issue_tracker": "https://github.com/RobertD502/home-assistant-petkit/issues",
  "loggers": [
    "petkitaio"
  ],
  "requirements": [
    "git+https://github.com/RobertD502/petkitaio.git@main#petkitaio==0.1.10.6",
    "tzlocal>=4.2"
  ],
  "version": "0.1.10"
}

This will pull a version of petkitaio has a few Bluetooth changes and has the Bluetooth polling set to 420. However, since the BLE polling time option isn't yet integrated into the integration, to go above the 420s for the BLE relay, you'll need to adjust the regular polling time to go above 420s.

override80 commented 4 days ago

I'll give this manifest.json a try and see if it gets better! :crossed_fingers: Thanks!

RobertD502 commented 4 days ago

Yes I did, unfortunately I'm on latest and still having the issue sometimes. Do you think that polling during cat litter operations could be the issue? For example, if I don't poll while cleaning, there will be no issues?

Potentially, but since the data is obtained via polling (since PETKIT doesn't use push), you wouldn't know that the litter box is cleaning until you do a poll exactly at the time it is happening.

You could test to see if the BLE relay is causing the issue while the litter box is cleaning by performing manual tests - when the litter box is cleaning use the PETKIT app (with your phone's Bluetooth off to force it to use the remote relay for a water fountain) to initiate the BLE relay by clicking on the water fountain and noting the blue cloud icon. You'd have to do this during several cleaning cycles to be sure.