diff --git a/custom_components/ferroamp/sensor.py b/custom_components/ferroamp/sensor.py index ea0fad1..ff4b2a3 100644 --- a/custom_components/ferroamp/sensor.py +++ b/custom_components/ferroamp/sensor.py @@ -1313,6 +1313,7 @@ def ehub_sensors(slug, interval, precision_battery, precision_current, precision interval, precision_energy, config_id, + state_class=SensorStateClass.TOTAL_INCREASING, ), ThreePhaseEnergyFerroampSensor( "Inverter Energy Consumed", @@ -1324,6 +1325,7 @@ def ehub_sensors(slug, interval, precision_battery, precision_current, precision interval, precision_energy, config_id, + state_class=SensorStateClass.TOTAL_INCREASING, ), ThreePhaseEnergyFerroampSensor( "Load Energy Produced", @@ -1335,6 +1337,7 @@ def ehub_sensors(slug, interval, precision_battery, precision_current, precision interval, precision_energy, config_id, + state_class=SensorStateClass.TOTAL_INCREASING, ), ThreePhaseEnergyFerroampSensor( "Load Energy Consumed", @@ -1346,6 +1349,7 @@ def ehub_sensors(slug, interval, precision_battery, precision_current, precision interval, precision_energy, config_id, + state_class=SensorStateClass.TOTAL_INCREASING, ), EnergyFerroampSensor( "Total Solar Energy", @@ -1493,7 +1497,7 @@ def ehub_sensors(slug, interval, precision_battery, precision_current, precision precision_current, config_id, ), - ThreePhaseMinFerroampSensor( + ThreePhaseMinFerroampSensor( "Available RMS current for load balancing", slug, "iavbl", diff --git a/tests/test_sensor.py b/tests/test_sensor.py index 9821609..ef3e85b 100644 --- a/tests/test_sensor.py +++ b/tests/test_sensor.py @@ -346,7 +346,7 @@ async def test_setting_ehub_sensor_values_via_mqtt_message(hass, mqtt_mock): 'device_class': 'energy', 'friendly_name': 'Inverter Energy Produced', 'icon': 'mdi:power-plug', - 'state_class': 'measurement', + 'state_class': 'total_increasing', 'unit_of_measurement': 'kWh' } @@ -359,7 +359,7 @@ async def test_setting_ehub_sensor_values_via_mqtt_message(hass, mqtt_mock): 'device_class': 'energy', 'friendly_name': 'Inverter Energy Consumed', 'icon': 'mdi:power-plug', - 'state_class': 'measurement', + 'state_class': 'total_increasing', 'unit_of_measurement': 'kWh' } @@ -372,7 +372,7 @@ async def test_setting_ehub_sensor_values_via_mqtt_message(hass, mqtt_mock): 'device_class': 'energy', 'friendly_name': 'Load Energy Produced', 'icon': 'mdi:power-plug', - 'state_class': 'measurement', + 'state_class': 'total_increasing', 'unit_of_measurement': 'kWh' } @@ -385,7 +385,7 @@ async def test_setting_ehub_sensor_values_via_mqtt_message(hass, mqtt_mock): 'device_class': 'energy', 'friendly_name': 'Load Energy Consumed', 'icon': 'mdi:power-plug', - 'state_class': 'measurement', + 'state_class': 'total_increasing', 'unit_of_measurement': 'kWh' }