Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Releases: Opcodeffm/petkit-local

v2.1.0 — CTW3 fountain support + food-level estimation

29 Apr 08:33
@Opcodeffm Opcodeffm

Choose a tag to compare

First public release with multi-device support. The integration now
covers both the Petkit Fresh Element Solo (D4) feeder and the
Eversweet Max 2 Cordless (CTW3) water fountain.

Note: repo was renamed from petkit-feeder-local to petkit-local.
The integration's Python domain stays petkit_feeder for backward
compatibility with existing installs; only the user-visible display
name changed from "Petkit Feeder Local" to "Petkit Local".

✨ New: CTW3 fountain integration

The Eversweet Max 2 Cordless has no Wi-Fi — it is BLE-relayed through
the D4 feeder, so adding the fountain requires the D4 to already be
running this integration locally.

Onboarding (Settings → Devices & Services → Petkit Local →
Configure → Add water fountain) offers three authentication paths:

  • Email + password — single /user/login call, password never
    stored on disk.
  • Session token paste — for Apple / Google / WeChat sign-in users
    who don't have a password we can use.
  • Manual entry — direct (id, mac, secret) for users with offline-
    extracted credentials.

After authentication, MAC + SN (visible in the official Petkit app)
fetch the device's cloud-assigned secret once, then the fountain
runs entirely locally. A daily refresh tick at 03:30 keeps the
session token alive.

Fountain entities: drinks today (count, last duration, total),
pump runtime today, battery + filter remaining, mode select
(Smart / Normal / Intermittent), power switch, lamp + brightness,
motion sensors, DND master.

🍽️ New: Food-level estimation (D4)

The D4 firmware reports the food container as a 4-state ENUM
(unknown / empty / low / ok — verified via APK decomp); previous
versions only surfaced binary. New sensors:

  • sensor.*_futterbehalter / _food_container — 4-state ENUM
  • sensor.*_food_remaining_estimated — continuous %, counts
    grams dispensed since last refill against a configurable tank
    capacity (default 1700 g).
  • sensor.*_food_remaining_grams (diagnostic, opt-in)

New services:

  • petkit_feeder.set_food_full — mark tank as freshly filled.
  • petkit_feeder.set_food_tank_capacity — override capacity (g).

Auto-refill detection fires when the firmware ENUM transitions
empty → non-empty.

🛠 D4 fixes & UX

  • Schedule now lives in HA, not the feeder's flash. Absorbs the
    D4 firmware's periodic heap-watchdog stalls (a feed scheduled at
    12:30 will fire even if the firmware is currently stuck — it
    catches up on next heartbeat). Power-failure caveat documented
    in README
    — UPS the HA host if you need cross-outage robustness.
  • Online detection threshold increased 60 s → 180 s to tolerate
    brief firmware-busy windows.
  • Manual feed amount picker is now a dropdown (10 / 20 / 50 g —
    matches the auger's discrete step) instead of a 1–200 g slider.
  • Manual feed buttons show a persistent_notification on press
    for visible queueing feedback.

🔒 Security disclosure refresh

  • F-01 retitled "Unauthenticated Remote Device Control via HTTP
    Command Channel" — the attack invokes existing device commands,
    not arbitrary code execution. CWE stays CWE-306. (Thanks to
    external review for the wording correction.)
  • CVE_SUBMISSIONS.md and SECURITY.md cross-linked properly; CVE
    IDs requested from MITRE on 2026年04月23日, awaiting assignment.
  • Disclosure status now documents the no-vendor-contact decision
    as a deliberate timeline choice (no security contact, no
    security.txt, no coordinated-disclosure program from Petkit).

📦 Internals

  • 181 unit tests, all green. Tests live under tests/ to avoid
    shadowing stdlib select / time modules.
  • petkit_cloud.py module: async helper around /user/login,
    /user/refreshsession, /user/details2, /ctw3/signup. Endpoint
    shapes verified live against the real Petkit-EU cloud with a
    throwaway test account.
  • fountain_server.py module: BLE relay state machine with
    per-fountain Link tracking and persistent-mode option.
  • New transparent banner in README header; new social-preview
    image at docs/logos/social-preview.png (×ばつ640, <1 MB).

Compatibility

  • HA 2024.1+
  • Python 3.11+
  • Tested against D4 firmware 1.267 + CTW3 firmware 1.11

Install via HACS (custom repository)

  1. HACS → Integrations → ⋮ → Custom repositories
  2. URL: https://github.com/Opcodeffm/petkit-local, Category: Integration
  3. Install Petkit Local, restart Home Assistant
  4. Settings → Devices & Services → Add Integration → "Petkit Local"

See README for network setup, BLE provisioning, and
fountain onboarding details.

Assets 2
Loading

AltStyle によって変換されたページ (->オリジナル) /