feat(blueprints): add fountain drink counter, anomaly alerts, and stats package#226
Conversation
…ts package - `fountain_drink_counter` blueprint: increments a counter on Pet drinking off->on transitions, with optional daily reset. - `fountain_no_drinks_alert` blueprint: fires when the binary sensor stays `off` for X hours. - `fountain_low_drinks_alert` / `fountain_high_drinks_alert` blueprints: daily checks against a 7-day median. - `petkit_fountain_stats.yaml` package: lifetime counter, daily/weekly/ monthly utility_meters, history_stats for drink time, daily snapshot template sensor, and 7-day median statistics sensor. - `docs/automations.md` covers quick-start, full setup, and alerts with troubleshooting and a calibration-period note.
b20b98c to
9bb2dc3
Compare
|
|
Hi @fredrik-lindseth
|
|
Hi @Jezza34000, thanks for checking. Yes,
The blueprint counts off->on transitions on If you'd prefer, I can update the docs to point cloud-only users at |
|
Yes you're right ! |




📝 Proposed Change / Description
Adds four importable HA blueprints and a package YAML for tracking fountain drinks locally and alerting on anomalies.
Blueprints
fountain_drink_counteroff/ontransition of thePet drinkingbinary sensor, with an optional daily reset.fountain_no_drinks_alertofffor X hours (default 12).fountain_low_drinks_alertfountain_high_drinks_alertPackage
docs/examples/petkit_fountain_stats.yamlwires up the supporting infrastructure: a non-resetting lifetime counter, daily/weekly/monthlyutility_metercycles, twohistory_statssensors for drink time, a trigger-template snapshot sensor that captures today's count at 23:55, and astatisticssensor that takes the 7-day median over those snapshots. The alert blueprints default to reading from this package's entities.docs/automations.mdcovers a quick-start (counter only), full setup (counter + meters + alerts), troubleshooting, the calibration period for statistical alerts, and multi-fountain notes.No Python changes.
Fixes: n/a
🔖 Type of change
🐾 Affected devices
The blueprints target the
Pet drinkingbinary sensor (occupancy device class) registered for the Fountain platform. Works regardless of whetherdetect_statuscomes from cloud-relay or local BLE.Specific type:
Pet drinkingsensor.🧪 How has this been tested?
Device(s) tested on:
PetKit Eversweet Max 2 Cordless (CTW3UV).
Other devices you own when the test was done:
None.
Test procedure:
petkit_fountain_stats.yamlinto<config>/packages/, replaced the binary_sensor placeholder.state: on.history_statsreflected uptime. Values survived a Home Assistant restart.automation.fountain_no_drinks_alertviaautomation.trigger. Action ran without errors. Statistical alerts can't be end-to-end tested without 7 days of history; their structure (templates, conditions, blueprint inputs) is validated via blueprint loading andpre-commit run -a.✅ Checklist
pre-commit run -ahooks and all checks passmain📸 Screenshots / Logs (optional)
Entity snapshot after restart with all blueprints loaded:
ℹ️ Additional context
binary_sensor.X_pet_drinking, which already exists onmain..pre-commit-config.yamlexcludes^blueprints/fromcheck-yaml(HA's!inputtag isn't a standard YAML constructor).category: blueprint) for auto-updates.Thanks for the helping paw! 🐾