😻 Petkit integration

Petkit Integration for Home Assistant

:tada: Bring your Petkit devices to Home Assistant!

Manage and monitor your Petkit feeders, litter boxes, fountains, purifiers, and more all from the comfort of your smart home dashboard.

:white_check_mark: Picture and Video Support!

The latest update brings image and video support to Home Assistant for devices equipped with cameras.

  • View pictures and recorded video clips directly in the Media tab of Home Assistant.
  • Keep track of your pets’ activities with ease, all from your smart home setup.

I hope you enjoy using this integration to bring your Petkit devices into Home Assistant! :blush:
If you need help, have suggestions, or want to request new features, feel free to reach out
I’m here to help! :wink:

1 Like

Thanks for this integration, it’s been very helpful with our two Element feeders and our Pura Max litter!

Only issue that I have is that I don’t see the raw_distribution_data sensor needed for the feeder schedule card.

Is this because I’m using a secondary account (ā€œfamily memberā€) for the integration, rather than my main account?

Hi @maxmouchet,
It’s because the feeding plan data given by the API is different for this feeder and i don’t have implemented it in my code :slight_smile:

Thank you so much for this amazing integration! :upside_down_face::raised_hands: Am I correct in understanding that you can monitor just one fountain with it, without needing any other devices in your home? With the other HACS integration from Petkit, you absolutely need an additional device because the transmission only works that way.

@Purpleturtle
You can monitor as many fountains as you want,
My integration does not use native bluetooth, you just need a device that serves as a relay (this is Petkit’s BLE relay function) with either a feeder or a litterbox that serves as a sort of ā€œbridgeā€ between foutain and API.

Thanks! Good to know this is not a limitation due to the account type :slight_smile: I’ll try to capture the API requests/replies from the app if I have some time.

I already have the API requests/responses for this feeder, I just haven’t implemented it :slight_smile:
There are so many devices and so many differences that I can’t support all features on all devices.

1 Like

Great work thank you! I also have the Element Solo feeder, so if you decide to get the schedule setup for this I would appreciate it :slight_smile:

Hi Jezza,

I have two of the PuraX litter boxes, and now since I have seen your integration, I would like to get a Petkit feeder and a Petkit fountain.

Before I make my feeder purchase, is there an easy way for me to determine which Petkit models have the feeding plan data fully integrated into your integration?

If there is not a way to determine that, can some of you end users chime in to tell me which models show the feeding schedule in HA?

Thank you Jezza for the integration!

Hi @PlayedIn

So I haven’t exactly listed the models supported or not, what I am certain of is that the 2 models currently on sale on the Petkit’s site are 100% supported (YumShare Dual-Hopper & YumShare Solo) the old models are not (Fresh Element, Fresh Element Mini, etc.)

1 Like

Is it possible to integrate a bluetooth fountain without any apps/logins?

It’s possible, but my integration is based on the API and not on a native Bluetooth connection. Developing a native bluetooth connection will require a lot of work, I don’t plan to do this

1 Like

Is that why my water level and filter status often switch to ā€œUnavailableā€? Because I don’t have a second Wifi device? I was really hoping this integration would connect through my HA bluetooth dongle

Yes, without another device acting as a Bluetooth relay, the only way to receive updates is by connecting directly with your own smartphone to get the latest information.

However, I can see that there is a high demand for having Bluetooth fountains work locally without necessarily requiring a Bluetooth relay and without going through the cloud via an API.

I will look into this topic and integrate this functionality into my integration.

Stay tuned on my GitHub repository for updates! :blush:

4 Likes

Just bought the PETKIT EVERSWEET MAX. I’ll stay tuned…

1 Like

Hi I just added this integration and I’m so excited by it!

It was running about 24 hours for four devices (Purobot Ultra, two Eversweet Maxes and YumShare DualHopper) and one pet with everything looking good, then started getting various errors in the logs and is not working. The first was an error that looks to be around retrieving video and getting ā€œLow App versionā€ error from the PetKit servers:

Traceback (most recent call last):
  File "/config/custom_components/petkit/coordinator.py", line 216, in _async_update_media_files
    await dl_mgt.download_file(media, self.media_type)
  File "/usr/local/lib/python3.13/site-packages/pypetkitapi/media.py", line 526, in download_file
    await self._get_video_m3u8()
  File "/usr/local/lib/python3.13/site-packages/pypetkitapi/media.py", line 543, in _get_video_m3u8
    aes_key, iv_key, segments_lst = await self._get_m3u8_segments()
                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/pypetkitapi/media.py", line 584, in _get_m3u8_segments
    video_data = await self.client.get_cloud_video(self.file_data.video)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/pypetkitapi/client.py", line 585, in get_cloud_video
    response = await self.req.request(
               ^^^^^^^^^^^^^^^^^^^^^^^
    ...<3 lines>...
    )
    ^
  File "/usr/local/lib/python3.13/site-packages/pypetkitapi/client.py", line 767, in request
    return await self._handle_response(resp, _url)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/pypetkitapi/client.py", line 809, in _handle_response
    raise PypetkitError(
        f"Request failed code : {error_code}, details : {error_msg} url : {url}"
    )
pypetkitapi.exceptions.PypetkitError: Request failed code : 1513, details : Low App version. Please update the App. url : https://api.petkt.com/latest/d4sh/cloud/video?startTime=1742197451&deviceId=10010283&userId=100738927&mark=1742197443

I tried disabling video and pictures and reloading the integration. I now routinely get this error:

Traceback (most recent call last):
  File "/config/custom_components/petkit/coordinator.py", line 307, in _async_update_bluetooth_connection
    if await self.config.runtime_data.client.bluetooth_manager.open_ble_connection(
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        device_id
        ^^^^^^^^^
    ):
    ^
  File "/usr/local/lib/python3.13/site-packages/pypetkitapi/bluetooth.py", line 118, in open_ble_connection
    response = await self.client.req.request(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<8 lines>...
    )
    ^
  File "/usr/local/lib/python3.13/site-packages/pypetkitapi/client.py", line 767, in request
    return await self._handle_response(resp, _url)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/pypetkitapi/client.py", line 801, in _handle_response
    raise PetkitSessionExpiredError(f"Session expired: {error_msg}")
pypetkitapi.exceptions.PetkitSessionExpiredError: Session expired: Login session expired. Please log in again.

And most of my sensors are unavailble or 0 or other not valid values, including the pet’s weight, etc.

EDIT: I’ve now also noticed that at exactly midnight each night, all my sensors go to invalid states (0, unknown, etc.). This has happened two nights in a row. I’m turning up logging and trying to see what happens tonight, will report.

EDIT2: Is it possible that a number of the litter box settings reset at midnight, including the pet’s weight? I haven’t specifically seen documentation indicating this may be the case, but if I reload the integration today nothing has happened but also my pet hasn’t visited yet.

Hi @tman98,

Sorry for the late reply, I was away for a few days.

  • Could you confirm the version you’re using?
  • Regarding the sensors that reset at midnight, that’s how the API is designed. It’s the same behavior you see in the Petkit app each day starts fresh at 0 or remains unknown if no data is available.

Hey,

I was wondering if I can connect the Purifier without any other Petkit devices?

Hi @zirotto
Depend on what purifier you’re talking about ? :
Air MagiCube → Yes
Air Smart Spray → I’m working on it…

Hi @Jezza34000, regarding my EDIT/EDIT2 items above (wanted to come back to this because I eventually figured it out), the integration returns state fields of ā€œUnavailableā€ with a capitalized first letter which is non-standard in Home Assistant, most sensors return all lowercase. It’s hard to debug this because Home Assistant capitalizes the first letter in the logbook so it’s tough to see if an integration is itself returning a capitalized state. Moving now to lowercase states would also then break people depending on your integration to have capitalized states at this point, so not an easy migration path to get this resolved.