Skip to content

Commit

Permalink
Add Total Generation statistic
Browse files Browse the repository at this point in the history
  • Loading branch information
Poshy163 committed Nov 12, 2024
1 parent 4efcaa0 commit 16e27d3
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions custom_components/alphaess/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ async def _async_update_data(self):

inverterdata["Total Load"] = await safe_get(_sumdata, "eload")
inverterdata["Total Income"] = await safe_get(_sumdata, "totalIncome")
inverterdata["Total Generation"] = await safe_get(_sumdata, "epvtotal")

self_data = {
"Self Consumption": await safe_get(_sumdata, "eselfConsumption"),
Expand Down
1 change: 1 addition & 0 deletions custom_components/alphaess/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,4 @@ class AlphaESSNames(str, Enum):
ChargeTime2 = "Charging Period 2"
DischargeTime2 = "Discharge Period 2"
ChargeRange = "Charging Range"
Total_Generation = "Total Generation"
14 changes: 14 additions & 0 deletions custom_components/alphaess/sensorlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,13 @@
device_class=SensorDeviceClass.POWER,
state_class=SensorStateClass.MEASUREMENT,
),
AlphaESSSensorDescription(
key=AlphaESSNames.Total_Generation,
name="Total Generation",
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
),
AlphaESSSensorDescription(
key=AlphaESSNames.Income,
name="Total Income",
Expand Down Expand Up @@ -340,6 +347,13 @@
device_class=SensorDeviceClass.POWER,
state_class=SensorStateClass.MEASUREMENT,
),
AlphaESSSensorDescription(
key=AlphaESSNames.Total_Generation,
name="Total Generation",
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
),
AlphaESSSensorDescription(
key=AlphaESSNames.Income,
name="Total Income",
Expand Down

0 comments on commit 16e27d3

Please sign in to comment.