Skip to content

Commit ef7e258

Browse files
authored
Merge pull request #5 from brookwarner/bugfix-missing-some-fields-from-response
Add account balance and amount due to sensor attributes
2 parents 2b5c4bc + 513c654 commit ef7e258

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
@@ -241,9 +241,14 @@ async def process_data(self, response):
241241
"billing_period_from": latest_period.get("billingPeriodFromDate"),
242242
"billing_period_to": latest_period.get("billingPeriodToDate"),
243243
"reading_type": latest_period.get("readingType"),
244+
"account_balance": latest_period.get("accountBalance"),
245+
"amount_due": latest_period.get("amountDue"),
244246
"household_efficiency_band": latest_period.get("statistics", {})
245247
.get("efficiency", {})
246248
.get("currentHouseholdBand"),
249+
"usage_to_lower_band": latest_period.get("statistics", {})
250+
.get("efficiency", {})
251+
.get("usageToLowerBand"),
247252
"current_period_cost": round(cost_breakdown["total"], 2),
248253
"current_period_cost_consumption": round(cost_breakdown["consumption"], 2),
249254
"current_period_cost_wastewater": round(cost_breakdown["wastewater"], 2),
@@ -449,6 +454,9 @@ async def process_daily_data(self, response):
449454
"wastewater_rate_per_1000L": self._wastewater_rate,
450455
"endpoint": self._endpoint,
451456
"cost_currency": "NZD",
457+
"account_balance": parsed_data.get("accountBalance"),
458+
"amount_due": parsed_data.get("amountDue"),
459+
"reading_type": parsed_data.get("readingType"),
452460
"currentPeriodAverage": statistic_data.get("currentPeriodAverage"),
453461
"differenceToPreviousPeriod": statistic_data.get(
454462
"differenceToPreviousPeriod"

0 commit comments

Comments
 (0)