Skip to content

Commit 0c0385f

Browse files
fix(#96): check wetFeedingPlan data for Polar feeding plan state (#249)
* fix(#96): check wetFeedingPlan data for Polar feeding plan state instead of dry feeder flag * fix: add comment documenting wet plan heuristic --------- Co-authored-by: Jamie Jones <29973406+jjjonesjr33@users.noreply.github.com>
1 parent 4aeffa4 commit 0c0385f

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

custom_components/petlibro/devices/feeders/polar_wet_food_feeder.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,13 @@ def electric_quantity(self) -> float:
7474

7575
@property
7676
def feeding_plan_state(self) -> bool:
77-
"""Return the state of the feeding plan."""
78-
return bool(self._data.get("enableFeedingPlan", False))
77+
"""Return the state of the feeding plan from wetFeedingPlan data."""
78+
wet_plan = self._data.get("wetFeedingPlan", {})
79+
# API does not provide an explicit enabled flag for wet plans; non-empty plan = enabled
80+
if not wet_plan or not wet_plan.get("templateName"):
81+
return False
82+
plan_entries = wet_plan.get("plan", [])
83+
return bool(plan_entries)
7984

8085
@property
8186
def food_low(self) -> bool:

0 commit comments

Comments
 (0)