Skip to content

Feature/Per-Pet RFID Fountain Drinking Sensors (#92) - #229

Merged
jjjonesjr33 merged 6 commits into
jjjonesjr33:devfrom
jasoncronje:Feature/RFID-Fountain-Per-Pet-Drinking-Sensors
May 20, 2026
Merged

Feature/Per-Pet RFID Fountain Drinking Sensors (#92)#229
jjjonesjr33 merged 6 commits into
jjjonesjr33:devfrom
jasoncronje:Feature/RFID-Fountain-Per-Pet-Drinking-Sensors

Conversation

@jasoncronje

@jasoncronje jasoncronje commented May 3, 2026

Copy link
Copy Markdown
Contributor

Proposed change:

Closes #92.

Adds three per-pet drinking sensors for the Dockstream Smart RFID Fountain (PLWF305), sourced from the wearListV2 API endpoint. Sensors appear under each pet's Home Assistant device:

  • Today's Fountain Drinking Count — number of drinking sessions today
  • Today's Fountain Water Consumption — total ml today (respects user's water unit preference)
  • Today's Fountain Drinking Time — total seconds spent drinking today

How it works

  • New device_wear_list(device_sn) method on PetLibroAPI follows the existing 10-second cache pattern used by get_device_real_info and friends.
  • Pet.refresh() now also queries wearListV2 for any RFID fountains the pet is bound to, then aggregates per-pet drinking stats (sums across multiple fountains if applicable).
  • Three new PL_PetSensorEntity entries in PET_ENTITY_MAP expose the data, with translations for all 13 supported languages.

Shared account handling

getBoundDevices returns empty for shared (non-owner) accounts, so the implementation also falls back to the hub's loaded RFID fountain devices. The wearListV2 response is filtered by petId so only the relevant pet's data is used. This mirrors the workaround pattern recommended in the issue thread.

Edge cases handled

  • API returns null for pets that haven't drunk today → treated as 0
  • wearListV2 call fails → logged and skipped, pet refresh continues
  • Pet bound to multiple RFID fountains → values summed correctly (each fountain is a separate API call so no double-counting)
  • Multiple pets share a fountain → 10-second cache deduplicates calls within a refresh cycle

Files changed

  • custom_components/petlibro/api.py — new device_wear_list() method
  • custom_components/petlibro/pets/__init__.py — updated refresh(), 3 new properties
  • custom_components/petlibro/pets/entity.py — 3 new sensor descriptions in PET_ENTITY_MAP
  • custom_components/petlibro/translations/*.json — 3 new translation keys across 13 files

Testing

Verified live on a personal HA dev instance with a Dockstream Smart RFID Fountain bound to two cats:

  • Pet with active RFID drinking: shows real values (e.g., 5 sessions, 56ml, 210s)
  • Pet without drinking activity today: shows 0 (matches Petlibro app behavior)
  • Aggregation across multiple fountains works correctly
  • 10-second cache avoids duplicate API calls when multiple pets share a fountain

Notes

  • Sensors are visible for all pets, not just RFID-bound ones (the existing entity_registry_enabled_default_fn plumbing on pet entities has an or super() fallback that prevents disabling — keeping behavior consistent with other pet entities).
  • Built and tested against HA 2026.4.x.

Screenshots

macshot-clipboard-0ED22D79-B890-4F1A-9BE1-A5D54D764C83 macshot-clipboard-6004B5FF-3536-426F-82CE-6231453AAF6E

Shared accounts return empty from getBoundDevices, so also check the
hub's loaded devices for DockstreamSmartRFIDFountain instances. The
wearListV2 response filters by petId so only matching data is used.
…llbacks

The base PL_PetEntity.entity_registry_enabled_default property uses an
'or super()' fallback that defaults to True, meaning these callbacks
could never actually disable entities. Remove them rather than ship
dead code.
@jasoncronje

Copy link
Copy Markdown
Contributor Author

Resolved all conflicts. Since I only have one fountain, I requested that someone else from #92 test with multiple fountains.

@C4-Dimitri

Copy link
Copy Markdown
Contributor

@FeliGoblin, FYI

@meeowgler

Copy link
Copy Markdown

I have 5 RFID fountains and 5 pets. Using the latest commits to jasoncronje:Feature/RFID-Fountain-Per-Pet-Drinking-Sensors, all 5 of my pets appear correctly and the sums all look correct!

@jjjonesjr33 jjjonesjr33 added the Enhancement New feature or request label May 20, 2026
@github-project-automation github-project-automation Bot moved this to To triage in Petlibro May 20, 2026
@jjjonesjr33
jjjonesjr33 self-requested a review May 20, 2026 09:43
@jjjonesjr33 jjjonesjr33 moved this from To triage to In review in Petlibro May 20, 2026

@jjjonesjr33 jjjonesjr33 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, great work @jasoncronje will load this into a pre-release

@jjjonesjr33
jjjonesjr33 merged commit 1a7c5d6 into jjjonesjr33:dev May 20, 2026
2 checks passed
@github-project-automation github-project-automation Bot moved this from In review to Done in Petlibro May 20, 2026
@jjjonesjr33 jjjonesjr33 added the Completed Completed tasks label May 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Completed Completed tasks Enhancement New feature or request

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[Feature Request]: Dockstream RFID Smart Fountain - Sensor for each pets drinking amount/time/count

4 participants