MCPcopy Index your code
hub / github.com/RobertD502/home-assistant-petkit

github.com/RobertD502/home-assistant-petkit @0.1.14

Chat with this repo
repository ↗ · DeepWiki ↗ · release 0.1.14 ↗ · + Follow
1,486 symbols 2,075 edges 16 files 1,364 documented · 92%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

PetKit Home Assistant Integration

Custom Home Assistant component for controlling and monitoring PetKit devices and pets.

Current version GitHub GitHub manifest.json dynamic (path) Total lines count

Buy Me A Coffee Donate using Liberapay

A lot of work has been put into creating the backend and this integration. If you enjoy this integration, consider donating by clicking on one of the supported methods above.

*All proceeds go towards helping a local animal rescue.


Discord Server

Discord

Join the Home Assistant PetKit discord server to follow development news or to share ideas with other users.

Currently Supported Devices

Feeders - Fresh Element Infinity - Fresh Element Solo - Fresh Element Mini Pro - Fresh Element Gemini - Fresh Element

[!CAUTION] YumShare feeders are NOT currently supported, but will be in the future. Once they are supported this message will be removed.

Litter Boxes - Pura X Litter Box - Pura MAX / MAX 2 Litter Box with/without Pura Air deodorizer

Purifiers - Air Magicube

Water Fountains - Eversweet Solo 2 Water Fountain - Eversweet 3 Pro Water Fountain - Eversweet 3 Pro (UVC Version) Water Fountain - Eversweet 5 Mini Water Fountain

Prior To Installation

  • This integration requires using your PetKit account email (number for PetKit China accounts) and password. Third-party account sign-in methods (Facebook, Apple, Twitter) are not supported.

[!CAUTION] If using another PetKit integration that uses the petkit domain, you will need to delete it prior to installing this integration. You'll also need to remove any mention of it from your configuration.yaml file.

[!CAUTION] If you are running Home Assistant as a Docker container, the TZ environment variable must be set.

Important - Please Read:

PetKit Account & Family Sharing Feature:

[!IMPORTANT] - PetKit accounts can only be logged in on one device at a time. Using a single account for both this integration and the mobile app will result in getting signed out of one of them. You can avoid this by creating a secondary account and sharing the devices/pets to it using the family sharing feature. You may use the primary account or the secondary account with this integration. However, as development was done using a primary account, if you use your secondary account with this integration, I cannot guarantee that all features work.

If you have a water fountain:

[!NOTE] Getting the most recent data from your water fountain, as well as controlling the water fountain, requires that the BLE relay is set up within the PetKit app. Otherwise, you will not be able to control the water fountain as it requires another compatible PetKit device acting as a BLE relay and data will only be as recent as the last time your phone connected to the water fountain.

[!CAUTION] If you have a Pura MAX litter box acting as a BLE relay for your water fountain, you may want to disable the Use PetKit BLE relay (if available) option. A bug exists in the Pura Max firmware that causes the litter box to eventually become unresponsive and needing a reboot if both the integration and PetKit mobile app are in use.

Installation

With HACS

Open your Home Assistant instance and open a repository inside the Home Assistant Community Store.

[!Tip] If you are unable to use the button above, manually search for PetKit in HACS.

Manual

Copy the petkit directory, from custom_components in this repository, and place it inside your Home Assistant Core installation's custom_components directory. Restart Home Assistant prior to moving on to the Setup section.

[!WARNING] If installing manually, in order to be alerted about new releases, you will need to subscribe to releases from this repository.

Setup

Open your Home Assistant instance and start setting up a new integration.

[!Tip] If you are unable to use the button above, follow the steps below: 1. Navigate to the Home Assistant Integrations page (Settings --> Devices & Services) 2. Click the + ADD INTEGRATION button in the lower right-hand corner 3. Search for PetKit

[!Caution] * Be sure to select the country associated with your account (Hong Kong users should select Hong Kong, not China). * During setup, set the timezone option to Set Automatically. If the tzlocal library isn't able to fetch your timezone, please manually select your timezone.

The current polling interval is set to 2 minutes (120 seconds). If you would like to set a different polling interval, change the polling interval option (via the UI). Keep in mind, setting the polling interval too short may result in your account getting rate limited/blocked.

Devices

Each PetKit device and pet is represented as a device in Home Assistant. Within each device are several entities described below.

Feeders


Fresh Element Infinity (click to expand)

Each Feeder has the following entities:

Entity Entity Type Additional Comments
Call pet Button Only available if your feeder is online (connected to PetKit's servers).
Cancel manual feed Button - Only available if your feeder is online (connected to PetKit's servers).
  • Will cancel a manual feeding that is currently in progress. | | Indicator light | Switch | Only available if your feeder is online (connected to PetKit's servers). | | Manual Feed | Number | - Only available if your feeder is online (connected to PetKit's servers).

  • Select the amount of food, in grams, you'd like to dispense immediately.

  • Note: valid amount ranges from 5-200 grams in increments of 1 gram. | | Desiccant days remaining | Sensor | Number of days left before the desiccant needs to be replaced. | | Food level | Binary Sensor | Allows for determining if there is a food shortage. | | Child lock | Switch | Only available if your feeder is online (connected to PetKit's servers). | | Do not disturb | Switch | Only available if your feeder is online (connected to PetKit's servers). | | Reset desiccant | Button | - Allows you to reset the desiccant back to 30 days after replacing it.

  • Only available if your feeder is online (connected to PetKit's servers). | | Sound | Select | - Allows you to select which sound is played when calling your pet.

  • Default sound is selected if no self-recorded sounds are available or selected.

  • Only available if your feeder is online (connected to PetKit's servers). | | Surplus | Number | - Allows for selecting weight in bowl that is considered to be surplus.

  • If a surplus amount is selected and surplus control is enabled, planned feedings will stop when the weight of food detected in the bowl is equal to the surplus amount.

  • Only available if your feeder is online (connected to PetKit's servers). | | Surplus control | Switch | - Enable or disable surplus control.

  • Only available if your feeder is online (connected to PetKit's servers). | | System notification sound | Switch | - Enable or disable system notification sound.

  • Only available if your feeder is online (connected to PetKit's servers). | | Voice with dispense | Switch | - Enable or disable sound (selected in Sound entity) to play with every feeding.

  • Only available if your feeder is online (connected to PetKit's servers). | | Volume | Number | - Allows for controlling feeder sound volume.

  • Only available if your feeder is online (connected to PetKit's servers).

Core symbols most depended-on inside this repo

result_to_description
called by 2
custom_components/petkit/sensor.py
result_to_description
called by 2
custom_components/petkit/sensor.py
async_validate_api
called by 2
custom_components/petkit/util.py
sub_events_to_description
called by 1
custom_components/petkit/sensor.py
async_added_to_hass
called by 1
custom_components/petkit/sensor.py
grab_recent_weight
called by 1
custom_components/petkit/sensor.py
grab_recent_duration
called by 1
custom_components/petkit/sensor.py
sub_events_to_description
called by 1
custom_components/petkit/sensor.py

Shape

Method 1,344
Class 127
Function 15

Languages

Python100%

Modules by API surface

custom_components/petkit/sensor.py569 symbols
custom_components/petkit/switch.py359 symbols
custom_components/petkit/button.py205 symbols
custom_components/petkit/number.py120 symbols
custom_components/petkit/binary_sensor.py103 symbols
custom_components/petkit/select.py78 symbols
custom_components/petkit/fan.py16 symbols
custom_components/petkit/text.py15 symbols
custom_components/petkit/config_flow.py9 symbols
custom_components/petkit/__init__.py5 symbols
custom_components/petkit/coordinator.py3 symbols
custom_components/petkit/util.py2 symbols

For agents

$ claude mcp add home-assistant-petkit \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page