From 8b3ccbeb9ff5ed0812473af356a0d03e4390720e Mon Sep 17 00:00:00 2001 From: Adam Outler Date: Mon, 27 Dec 2021 12:11:18 -0500 Subject: [PATCH] Adding received and delivered KWH readings. --- custom_components/fpl/fplapi.py | 2 ++ custom_components/fpl/sensor.py | 2 ++ custom_components/fpl/sensor_KWHSensor.py | 24 +++++++++++++++++++++++ 3 files changed, 28 insertions(+) diff --git a/custom_components/fpl/fplapi.py b/custom_components/fpl/fplapi.py index 0e2b778..3265f81 100644 --- a/custom_components/fpl/fplapi.py +++ b/custom_components/fpl/fplapi.py @@ -310,6 +310,8 @@ class FplApi(object): data["projectedKWH"] = r["CurrentUsage"]["projectedKWH"] data["dailyAverageKWH"] = r["CurrentUsage"]["dailyAverageKWH"] data["billToDateKWH"] = r["CurrentUsage"]["billToDateKWH"] + data["recMtrReading"] = r["CurrentUsage"]["recMtrReading"] + data["delMtrReading"] = r["CurrentUsage"]["delMtrReading"] return data async def __getDataFromApplianceUsage(self, account, lastBilledDate) -> dict: diff --git a/custom_components/fpl/sensor.py b/custom_components/fpl/sensor.py index 616653c..a868e1e 100644 --- a/custom_components/fpl/sensor.py +++ b/custom_components/fpl/sensor.py @@ -4,6 +4,8 @@ from .sensor_KWHSensor import ( ProjectedKWHSensor, DailyAverageKWHSensor, BillToDateKWHSensor, + NetReceivedKWHSensor, + NetDeliveredKWHSensor, ) from .sensor_DatesSensor import ( CurrentBillDateSensor, diff --git a/custom_components/fpl/sensor_KWHSensor.py b/custom_components/fpl/sensor_KWHSensor.py index b360e4d..ba2d24a 100644 --- a/custom_components/fpl/sensor_KWHSensor.py +++ b/custom_components/fpl/sensor_KWHSensor.py @@ -38,3 +38,27 @@ class BillToDateKWHSensor(FplEntity): @property def icon(self): return "mdi:flash" + +class NetReceivedKWHSensor(FplEntity): + def __init__(self, coordinator, config, account): + super().__init__(coordinator, config, account, "Received Meter Reading KWH") + + @property + def state(self): + return self.getData("recMtrReading") + + @property + def icon(self): + return "mdi:flash" + +class NetDeliveredKWHSensor(FplEntity): + def __init__(self, coordinator, config, account): + super().__init__(coordinator, config, account, "Delivered Meter Reading KWH") + + @property + def state(self): + return self.getData("delMtrReading") + + @property + def icon(self): + return "mdi:flash"