Skip to content

Commit

Permalink
Merge pull request #14 from tijsverkoyen/13-total_increasing
Browse files Browse the repository at this point in the history
Use total_increasing for total yields
  • Loading branch information
tijsverkoyen authored Nov 21, 2022
2 parents 5d7c90b + b1ade6f commit f7ac873
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import datetime

from homeassistant.helpers.update_coordinator import CoordinatorEntity
from homeassistant.components.sensor import STATE_CLASS_MEASUREMENT, SensorEntity
from homeassistant.components.sensor import STATE_CLASS_MEASUREMENT, STATE_CLASS_TOTAL_INCREASING, SensorEntity
from homeassistant.components.binary_sensor import DEVICE_CLASS_CONNECTIVITY, BinarySensorEntity
from homeassistant.const import DEVICE_CLASS_VOLTAGE, ELECTRIC_POTENTIAL_VOLT, DEVICE_CLASS_CURRENT, \
ELECTRIC_CURRENT_AMPERE, DEVICE_CLASS_ENERGY, DEVICE_CLASS_TEMPERATURE, \
Expand Down Expand Up @@ -170,6 +170,10 @@ def unit_of_measurement(self) -> str:
@property
def state_class(self) -> str:
return STATE_CLASS_MEASUREMENT
class FusionSolarRealtimeDeviceDataEnergyTotalIncreasingSensor(FusionSolarRealtimeDeviceDataEnergySensor):
@property
def state_class(self) -> str:
return STATE_CLASS_TOTAL_INCREASING


class FusionSolarRealtimeDeviceDataTemperatureSensor(FusionSolarRealtimeDeviceDataSensor):
Expand Down
8 changes: 4 additions & 4 deletions custom_components/fusion_solar/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ async def async_update_device_real_kpi_data():
'name': 'Active power'},
{'class': 'FusionSolarRealtimeDeviceDataReactivePowerSensor', 'attribute': 'reactive_power',
'name': 'Reactive output power'},
{'class': 'FusionSolarRealtimeDeviceDataEnergySensor', 'attribute': 'day_cap', 'name': 'Yield Today'},
{'class': 'FusionSolarRealtimeDeviceDataEnergyTotalIncreasingSensor', 'attribute': 'day_cap', 'name': 'Yield Today'},
{'class': 'FusionSolarRealtimeDeviceDataPowerSensor', 'attribute': 'mppt_power',
'name': 'MPPT total input power'},
{'class': 'FusionSolarRealtimeDeviceDataVoltageSensor', 'attribute': 'pv1_u',
Expand Down Expand Up @@ -469,7 +469,7 @@ async def async_update_device_real_kpi_data():
'name': 'PV23 input current'},
{'class': 'FusionSolarRealtimeDeviceDataCurrentSensor', 'attribute': 'pv24_i',
'name': 'PV24 input current'},
{'class': 'FusionSolarRealtimeDeviceDataEnergySensor', 'attribute': 'total_cap', 'name': 'Total yield'},
{'class': 'FusionSolarRealtimeDeviceDataEnergyTotalIncreasingSensor', 'attribute': 'total_cap', 'name': 'Total yield'},
{'class': 'FusionSolarRealtimeDeviceDataTimestampSensor', 'attribute': 'open_time',
'name': 'Inverter startup time'},
{'class': 'FusionSolarRealtimeDeviceDataTimestampSensor', 'attribute': 'close_time',
Expand Down Expand Up @@ -623,7 +623,7 @@ async def async_update_device_real_kpi_data():
'name': 'Active power'},
{'class': 'FusionSolarRealtimeDeviceDataReactivePowerSensor', 'attribute': 'reactive_power',
'name': 'Reactive output power'},
{'class': 'FusionSolarRealtimeDeviceDataEnergySensor', 'attribute': 'day_cap', 'name': 'Yield Today'},
{'class': 'FusionSolarRealtimeDeviceDataEnergyTotalIncreasingSensor', 'attribute': 'day_cap', 'name': 'Yield Today'},
{'class': 'FusionSolarRealtimeDeviceDataPowerSensor', 'attribute': 'mppt_power',
'name': 'MPPT total input power'},
{'class': 'FusionSolarRealtimeDeviceDataVoltageSensor', 'attribute': 'pv1_u',
Expand Down Expand Up @@ -658,7 +658,7 @@ async def async_update_device_real_kpi_data():
'name': 'PV7 input current'},
{'class': 'FusionSolarRealtimeDeviceDataCurrentSensor', 'attribute': 'pv8_i',
'name': 'PV8 input current'},
{'class': 'FusionSolarRealtimeDeviceDataEnergySensor', 'attribute': 'total_cap', 'name': 'Total yield'},
{'class': 'FusionSolarRealtimeDeviceDataEnergyTotalIncreasingSensor', 'attribute': 'total_cap', 'name': 'Total yield'},
{'class': 'FusionSolarRealtimeDeviceDataTimestampSensor', 'attribute': 'open_time',
'name': 'Inverter startup time'},
{'class': 'FusionSolarRealtimeDeviceDataTimestampSensor', 'attribute': 'close_time',
Expand Down

0 comments on commit f7ac873

Please sign in to comment.