Petkit Local for ESP32-C3
An ESP32 display project for ESP32-C3.
Parts and sourceBefore you start
Confirm board compatibility and supported firmware targets in the upstream documentation.
Upstream README
π± PetKit ESPHome β Fresh Element Solo + Eversweet 3 Pro
Free your PetKit devices from the cloud! Custom ESPHome firmware for the PetKit Fresh Element Solo pet feeder that also acts as a BLE bridge to the PetKit Eversweet 3 Pro water fountain β both devices fully local in Home Assistant, no PetKit servers, no app, no cloud. π«βοΈ
The feeder's own ESP32 is reflashed with ESPHome, and it talks to the fountain over Bluetooth Low Energy using the reverse-engineered PetKit W5 protocol.

π― Choose Your Build Path
This project offers two options depending on which devices you have:
π’ Option 1: Feeder + Fountain Bridge (recommended)
Best for: Owners of both devices β one ESP32 controls everything
| Aspect | Details |
|---|---|
| Difficulty | ββ Moderate (opening the feeder + soldering-free serial flash) |
| Hardware | None to buy β uses the feeder's built-in ESP32-D0WD |
| Config File | petkit-fresh-element-solo.yaml |
| Result | Feeder + fountain as one ESPHome device in HA and one web UI |
The fountain itself is not modified at all β the feeder connects to it over BLE in the background and relays everything.
π΅ Option 2: Fountain Only (standalone ESP32-C3)
Best for: Fountain-only owners, or if the feeder is out of BLE range of the fountain
| Aspect | Details |
|---|---|
| Difficulty | β Easy (flash a dev board, nothing is opened) |
| Hardware | Any ESP32-C3 dev board (~β¬3-5), e.g. ESP32-C3-DevKitM-1 / SuperMini |
| Config File | petkit-eversweet-3-pro.yaml |
| Result | Fountain monitoring + control via a small BLE-to-WiFi bridge |
π‘ Recommendation: If you own both devices, go with Option 1 β zero extra hardware and everything lives in a single device. Just make sure the feeder stands within BLE range of the fountain.
β¨ Features
Feeder (Fresh Element Solo)
- π½οΈ Manual dispensing β button in HA / web UI, physical button still works
- π
Flexible feeding schedule in one text field:
07:00=2, 12:30=1, 18:00=2(any minute, not just full hours) with an Apply/validate button and live "next feeding" status - π Low food detection β compares pellets-per-scoop against a threshold, warns via sound + HA event
- π§ Desiccant tracking β 30-day replacement counter, warning sensor, HA event, one-tap reset
- π Robust timekeeping β NTP (Google + pool fallbacks) and Home Assistant as a secondary time source, runtime-selectable timezone, manual sync button, live clock display
- π΄ Last feeding sensor β shows the most recent feeding as
2 serving(s) at 19:00; its state is unique per feeding, making it a reliable Home Assistant trigger (no ESPHome event permission needed) - π RTTTL melodies (mutable), status LED, dispensed-food statistics
Fountain (Eversweet 3 Pro, via BLE)
- β‘ Power on / pause and Normal / Smart mode
- π¨ Warnings: water missing, filter due, breakdown
- π§½ Filter reset button β sends the native BLE reset command (cmd 222), filter counter resets inside the fountain itself
- π Filter usage %, pump runtime, voltage, serial, firmware version
- π Auto-reconnect + periodic polling (default 120 s)
Web UI
ESPHome web server v3 with sorting groups β entities organized into Feeding / Fountain / Settings / Diagnostics sections.
π¦ Repository Contents
| File | Description |
|---|---|
petkit-fresh-element-solo.yaml |
Option 1: feeder + fountain bridge (feeder's ESP32) |
petkit-eversweet-3-pro.yaml |
Option 2: fountain-only standalone reader (ESP32-C3) |
secrets.yaml.example |
Template for your WiFi / API / OTA secrets |
backup/esp32_stock_backup_SANITIZED.bin |
Stock PetKit firmware dump (personal data removed) β last-resort restore |
ha/automations.yaml |
Ready-made HA notification automations (copy & adapt) |
img/ |
Photos / screenshots |
π§ Option 1: Flashing the Feeder
What's inside

The Fresh Element Solo is built around an ESP32-D0WD (dual core, 4 MB flash) β perfect for ESPHome. Pinout and hardware photos are documented on the ESPHome devices page: π https://devices.esphome.io/devices/petkit-fresh-element-solo-pet-feeder/
| GPIO | Function |
|---|---|
| GPIO5 | Status LED |
| GPIO16 | Buzzer (RTTTL) |
| GPIO34 | Manual feed button |
| GPIO27 | Motor rotation sensor |
| GPIO14 | Food (pellet) sensor |
| GPIO33 | Sensor enable |
| GPIO18/17/19 | Motor forward / reverse / enable |
Step 0 β β οΈ BACK UP THE STOCK FIRMWARE FIRST
Before flashing anything, dump the original 4 MB flash so you can always go back:
esptool --chip esp32 --port COM6 --baud 460800 read-flash 0 0x400000 esp32_backup.bin

Connect a USB-serial adapter (3.3 V logic!) to the feeder board's serial pads: GND, TX, RX β and hold GPIO0 low on power-up to enter the bootloader.
β‘ Power tip: do not power the ESP32 from the USB-serial adapter's 3V3 pin β it cannot supply the WiFi+BLE current spikes and the board will brownout-loop. Power the board from the feeder's own PSU and connect only GND/TX/RX to the adapter. In my case, powering the ESP32 from the adapter's 3V3 pin was sufficient only for flashing the firmware. To test or run the firmware afterward, I powered the board from its regular power supply.
β‘ **Important: Do not power the board from both the feeder's power supply and the USB-to-serial adapter's 3V3 output at the same time. Powering the board from two different sources simultaneously can damage the ESP32 or the USB-to-serial adapter.
Step 1 β Prepare secrets
Copy secrets.yaml.example to secrets.yaml in your ESPHome config folder and fill in your values.
Step 2 β Set your fountain's MAC
In petkit-fresh-element-solo.yaml, set fountain_mac (substitutions at the top) to your fountain's BLE MAC. Find it with any BLE scanner app (nRF Connect) β the fountain advertises as a PetKit device.
Step 3 β Flash
esphome run petkit-fresh-element-solo.yaml
First flash goes over serial; every update after that is OTA. π
Step 4 β Verify
- Feeder time shows the current time within seconds (NTP sync)
- Fountain Online turns on after ~10-15 s (BLE handshake: cmd 213 β 73 β 86)
- Press Dispense food β scoops turn, statistics update
π§ Option 2: Standalone Fountain Reader
- Get any ESP32-C3 dev board
- Set
fountain_macinpetkit-eversweet-3-pro.yaml esphome run petkit-eversweet-3-pro.yaml- Place the board within BLE range of the fountain
π‘ PetKit BLE Protocol (short version)
Frame format used by W5-series fountains:
FA FC FD | cmd | type | seq | len | 00 | data... | FB
| Cmd | Purpose |
|---|---|
| 213 | Get device details (device ID, serial) |
| 73 | Init device (register secret) |
| 86 | Sync |
| 200 | Firmware version |
| 210 | Device state (power, mode, warnings, filter %, runtime) |
| 66 | Battery / voltage |
| 220 | Set power + mode |
| 222 | Reset filter counter |
β οΈ Important quirks:
- The init command (73) re-registers the BLE secret β the PetKit phone app loses control of the fountain until you power-cycle the fountain.
- Only one BLE central can be connected to the fountain at a time.
πΎ Stock Firmware Backup & Restore
backup/esp32_stock_backup_SANITIZED.bin is a full 4 MB dump of the original PetKit feeder firmware (hardware revision with ESP32-D0WD, serial prefix 2024). Personal data has been erased from it: the NVS, WiFi credentials, device serial, device ID/secrets, account binding, schedule and server-info partitions are blanked (0xFF).
To restore a feeder to stock:
esptool --chip esp32 --port COM6 --baud 460800 write-flash 0 esp32_stock_backup_SANITIZED.bin
After restoring, set the feeder up again through the PetKit app (it will re-provision WiFi and re-register the device).
β οΈ Disclaimer: this image is provided as a last resort for the community. Always make your own backup before flashing β your dump contains your device's factory identity partitions, which this sanitized image does not. Restoring this image to a different hardware revision may not work. Use at your own risk.
π If you publish your own dump: sanitize it first. A raw dump contains your WiFi password in plaintext, your device serial, and your PetKit account binding.
π Home Assistant
The device appears automatically via the ESPHome integration. Useful events for automations:
| Event | Fired when |
|---|---|
esphome.feeder_food_dispensed |
Food was dispensed (with scoop count) |
esphome.feeder_food_low |
Hopper is running low |
esphome.feeder_desiccant_due |
Desiccant is 30+ days old |
π¬ Ready-made notification automations
The repo ships with ha/automations.yaml β five Home Assitant automations. Copy the blocks into your automations.yaml (or paste into the UI editor in YAML mode), then adjust the entity IDs (HA may prefix them with your area name β check Developer Tools β States) and the notify targets.
- π§ Water low β fountain out of water (debounced, only when the BLE link is alive)
- π° Filter due β early warning at 95% used + the fountain's own alarm, with the live percentage in the message
- π§ Desiccant due β 30-day reminder with reset instructions
- π½οΈ Food low β hopper running low, includes the actual pellet count
- π» Food dispensed β confirmation of every feeding, with humor scaled to portion size (triggered by the Last feeding sensor, whose timestamped state changes on every dispense)
π Credits
This project stands on the shoulders of great community work:
- n6rdv / n6ham β ESPHome Fresh Element Solo config β the original feeder GPIO mapping and base configuration this project extends
- RobertD502 β home-assistant-petkit β the definitive PetKit integration and protocol knowledge
- PetKit Custom Integration thread β Home Assistant Community β discussion, testing and device insights
- phldgmn β ha-petkit-ble / PetkitW5BLEMQTT β reverse-engineered W5 BLE command set, including the filter reset (cmd 222)
- ESPHome β the platform that makes all of this possible
π License
Released into the public domain under The Unlicense β no ownership, no restrictions. Do whatever makes your cats happy. πΎ
This project builds on the community work listed in the Credits section above; those projects keep their own respective licenses.
β οΈ Disclaimer
Flashing custom firmware voids your warranty and carries a small risk of bricking the device. Feeding hardware keeps animals alive β always verify scheduled feedings work after every firmware change, and keep the physical manual-feed path tested. This project is not affiliated with PetKit.