pet-feeder
PetKit pet-feeder cap.
PetKit pet-feeder cap. Models the control + telemetry surface of a cloud-connected smart feeder as a single coherent slice — bowl food level, battery, desiccant life, feeding state + the four persisted settings (child-lock / indicator-light / feed-sound / volume).
Sources: native PetKit (nodepetkit FeederDevice). Reusable by any feeder integration that speaks the same food/desiccant/hopper surface.
kind: 'poll' — PetKit exposes only a cloud REST API (no push channel), so the provider refreshes the slice on a poll interval and eagerly after every command.
Dual-hopper feeders (D4S/D4SH) split the bowl into two independent hoppers. isDualHopper gates the two-hopper UI; food1/food2 carry the per-hopper levels (both null on single-hopper models, where foodLevel is the single reading). The manual-feed portion honours the PetKit hardware range 4–200 g in 1 g steps.
Device status is exposed both raw and decoded, mirroring PetKit's HA integration (RobertD502/py-petkit-api). status is the connectivity / power enum (normal / offline / on_batteries); error is the decoded human-readable fault message (null / no_error = healthy); errorCode keeps the raw device integer (0 / null = no error) so a provider that only has the numeric code stays lossless. A provider maps the library's fields onto these; any it cannot determine stays null.
PetKit manual-feed portion bounds (grams). Mirrors the HA manual_feed number entity (min 4, max 200, step 1, device_class weight).
At a glance
| Capability | pet-feeder |
| Provided by | The device's own driver provides it: each device registers its own provider. |
| Active providers per device | one |
| Device types | pet-feeder |
| Source | packages/types/src/capabilities/pet-feeder.cap.ts |
Methods
Every method takes the device id (deviceId) to address the device; the input tables below list the other fields.
| Method | Kind | Required of a provider | Access |
|---|---|---|---|
feed | mutation | yes | protected |
cancelFeed | mutation | yes | protected |
callPet | mutation | yes | protected |
playSound | mutation | yes | protected |
resetDesiccant | mutation | yes | protected |
markFoodReplenished | mutation | yes | protected |
setChildLock | mutation | yes | protected |
setIndicatorLight | mutation | yes | protected |
setFeedSound | mutation | yes | protected |
setVolume | mutation | yes | protected |
feed
mutation
Dispense food now. Single-hopper feeders take grams; dual-hopper feeders (D4S/D4SH) accept hopper1/hopper2 to target one or both hoppers. All portions honour the 4–200 g hardware range. At least one of the three must be present — the provider rejects an empty request.
Input
| Field | Type | Required | Description |
|---|---|---|---|
grams | number | no | |
hopper1 | number | no | |
hopper2 | number | no |
Output
Nothing.
Actions (offered in automations and on device cards)
| Action | Label | Sets |
|---|---|---|
petFeeder.feed | Feed | |
petFeeder.feedHoppers | Feed from both hoppers |
cancelFeed
mutation
Cancel an in-progress manual feed.
Input
No fields besides deviceId.
Output
Nothing.
Actions (offered in automations and on device cards)
| Action | Label | Sets |
|---|---|---|
petFeeder.cancelFeed | Cancel feeding |
callPet
mutation
Call the pet with the recorded prompt.
Input
No fields besides deviceId.
Output
Nothing.
Actions (offered in automations and on device cards)
| Action | Label | Sets |
|---|---|---|
petFeeder.callPet | Call pet |
playSound
mutation
Play a stored sound by id.
Input
| Field | Type | Required | Description |
|---|---|---|---|
soundId | number | yes |
Output
Nothing.
Actions (offered in automations and on device cards)
| Action | Label | Sets |
|---|---|---|
petFeeder.playSound | Play sound |
resetDesiccant
mutation
Reset the desiccant "days remaining" counter after replacing it.
Input
No fields besides deviceId.
Output
Nothing.
Actions (offered in automations and on device cards)
| Action | Label | Sets |
|---|---|---|
petFeeder.resetDesiccant | Desiccant replaced |
markFoodReplenished
mutation
Tell the PetKit cloud a hopper was refilled so it stops its low-food reminders (D4H/D4S/D4SH only — see supportsMarkRefilled). It does not change any sensor reading.
Input
No fields besides deviceId.
Output
Nothing.
Actions (offered in automations and on device cards)
| Action | Label | Sets |
|---|---|---|
petFeeder.foodReplenished | Food refilled |
setChildLock
mutation
Toggle the child-lock (manual-lock) setting.
Input
| Field | Type | Required | Description |
|---|---|---|---|
on | boolean | yes |
Output
Nothing.
Actions (offered in automations and on device cards)
| Action | Label | Sets |
|---|---|---|
petFeeder.childLockOn | Child lock on | childLock = true |
petFeeder.childLockOff | Child lock off | childLock = false |
setIndicatorLight
mutation
Toggle the front indicator light.
Input
| Field | Type | Required | Description |
|---|---|---|---|
on | boolean | yes |
Output
Nothing.
Actions (offered in automations and on device cards)
| Action | Label | Sets |
|---|---|---|
petFeeder.lightOn | Indicator light on | indicatorLight = true |
petFeeder.lightOff | Indicator light off | indicatorLight = false |
setFeedSound
mutation
Toggle the dispense chime.
Input
| Field | Type | Required | Description |
|---|---|---|---|
on | boolean | yes |
Output
Nothing.
Actions (offered in automations and on device cards)
| Action | Label | Sets |
|---|---|---|
petFeeder.feedSoundOn | Feeding sound on | feedSound = true |
petFeeder.feedSoundOff | Feeding sound off | feedSound = false |
setVolume
mutation
Set the speaker / prompt volume level.
Input
| Field | Type | Required | Description |
|---|---|---|---|
level | number | yes |
Output
Nothing.
Actions (offered in automations and on device cards)
| Action | Label | Sets |
|---|---|---|
petFeeder.volume | Set volume | volume = undefined |
Runtime state
The state Dominevo keeps for each device with this capability, readable without calling the provider.
Runtime-state slice — mirrored by the kernel. UI feeder cards read the full slice via device.state.petFeeder.value and refresh on every poll without re-querying the provider.
| Field | Type | Required | Description |
|---|---|---|---|
foodLevel | number | null | yes | Food in the TANK (hopper), as the feeder's own sensor reports it (state.food). A coarse level code, not grams — 0 is empty. The amount in the bowl is bowlFood. On dual-hopper models this is the combined reading; per-hopper levels live in food1/food2. Null when the device has not reported yet. |
bowlFood | number | null | yes | Food in the BOWL, a mass. Reported only by a feeder with a bowl scale; null when the model has none or its reading is of an unproven unit. |
eating | boolean | yes | True while the pet is eating (state.eating). |
supportsMarkRefilled | boolean | yes | Whether markFoodReplenished does anything on this model. When false the client must not offer it. |
food1 | number | null | yes | Hopper-1 food level (grams) on dual-hopper feeders; null on single-hopper models. |
food2 | number | null | yes | Hopper-2 food level (grams) on dual-hopper feeders; null on single-hopper models. |
lowFood | boolean | yes | Derived low-food flag — mirrors the HA food_level binary_sensor (device_class: problem, on = low). True when the tank reports empty, or, on a dual-hopper model, when EITHER hopper is empty. |
batteryPower | number | null | yes | Battery charge 0..100 (%). On a feeder running on mains this is the BACKUP battery's charge, not the power source. Null when the device has no battery reading. |
powerSource | "mains" | "battery" | null | yes | What the feeder is powered from right now: mains (plugged in, the battery is only a backup) or battery. Null when the device does not report it. |
desiccantLeftDays | number | null | yes | Desiccant life remaining, stored in seconds. Providers convert from the days the feeder reports. Null when the model has no desiccant sensor. |
feeding | boolean | yes | True while a feed is in progress. |
status | "normal" | "offline" | "on_batteries" | null | yes | Decoded connectivity / power status (HA petkit device-status enum). Null until the device has reported a status. |
error | string | null | yes | Decoded human-readable fault message. Null (or the device's no_error sentinel) means healthy; a non-null string is an active fault. Pairs with errorCode for consumers that want the raw integer. |
errorCode | number | null | yes | Raw device error code (0 / null = no error). |
isDualHopper | boolean | yes | True for D4S/D4SH dual-hopper hardware — gates the per-hopper UI. |
childLock | boolean | yes | Child-lock (manual-lock) setting — buttons on the unit are disabled. |
indicatorLight | boolean | yes | Front indicator-light setting. |
feedSound | boolean | yes | Play a chime when dispensing. |
volume | number | yes | Speaker / prompt volume level (device-scaled integer). |
lastFeedGrams | number | null | yes | Portion (grams) of the last manual feed sent from a single-hopper stepper — the default the next manual feed starts from. Persisted per device by the provider; null until a manual feed has been sent. |
lastFeedHopper1 | number | null | yes | Hopper-1 portion of the last manual feed (dual-hopper); null until sent. |
lastFeedHopper2 | number | null | yes | Hopper-2 portion of the last manual feed (dual-hopper); null until sent. |
lastFetchedAt | number | yes | Ms epoch when the slice was last refreshed from the cloud. |