Skip to content

Commit 513c654

Browse files
committed
Add account balance and amount due to sensor attributes
Extended WatercareUsageSensor to include 'account_balance', 'amount_due', and 'reading_type' in the sensor attributes. Also added 'usage_to_lower_band' for efficiency statistics. This provides more detailed billing and usage information in the sensor state.
1 parent 2b16f03 commit 513c654

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

custom_components/watercare/sensor.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,14 @@ async def process_data(self, response):
191191
"billing_period_from": latest_period.get("billingPeriodFromDate"),
192192
"billing_period_to": latest_period.get("billingPeriodToDate"),
193193
"reading_type": latest_period.get("readingType"),
194+
"account_balance": latest_period.get("accountBalance"),
195+
"amount_due": latest_period.get("amountDue"),
194196
"household_efficiency_band": latest_period.get("statistics", {})
195197
.get("efficiency", {})
196198
.get("currentHouseholdBand"),
199+
"usage_to_lower_band": latest_period.get("statistics", {})
200+
.get("efficiency", {})
201+
.get("usageToLowerBand"),
197202
"current_period_cost": round(cost_breakdown["total"], 2),
198203
"current_period_cost_consumption": round(cost_breakdown["consumption"], 2),
199204
"current_period_cost_wastewater": round(cost_breakdown["wastewater"], 2),
@@ -401,6 +406,9 @@ async def process_daily_data(self, response):
401406
"wastewater_rate_per_1000L": self._wastewater_rate,
402407
"endpoint": self._endpoint,
403408
"cost_currency": "NZD",
409+
"account_balance": parsed_data.get("accountBalance"),
410+
"amount_due": parsed_data.get("amountDue"),
411+
"reading_type": parsed_data.get("readingType"),
404412
"currentPeriodAverage": statistic_data.get("currentPeriodAverage"),
405413
"differenceToPreviousPeriod": statistic_data.get(
406414
"differenceToPreviousPeriod"

0 commit comments

Comments
 (0)