From 3c930b82d0961a76649ba6d078d02b86590fd0a9 Mon Sep 17 00:00:00 2001 From: Vincent Wolsink Date: Wed, 2 Oct 2024 10:22:11 +0200 Subject: [PATCH] Consumption counters can be negative in certain configurations --- custom_components/enphase_envoy/const.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/custom_components/enphase_envoy/const.py b/custom_components/enphase_envoy/const.py index 5df269a..c63470b 100644 --- a/custom_components/enphase_envoy/const.py +++ b/custom_components/enphase_envoy/const.py @@ -128,7 +128,7 @@ def get_model_name(model, hardware_id): key="daily_consumption", name="Today's Energy Consumption", native_unit_of_measurement=UnitOfEnergy.WATT_HOUR, - state_class=SensorStateClass.TOTAL_INCREASING, + state_class=SensorStateClass.TOTAL, device_class=SensorDeviceClass.ENERGY, suggested_display_precision=0, ), @@ -136,7 +136,7 @@ def get_model_name(model, hardware_id): key="lifetime_consumption", name="Lifetime Energy Consumption", native_unit_of_measurement=UnitOfEnergy.WATT_HOUR, - state_class=SensorStateClass.TOTAL_INCREASING, + state_class=SensorStateClass.TOTAL, device_class=SensorDeviceClass.ENERGY, suggested_display_precision=0, ), @@ -385,7 +385,7 @@ def get_model_name(model, hardware_id): key=f"daily_consumption_{phase}", name=f"Today's Energy Consumption {phase.upper()}", native_unit_of_measurement=UnitOfEnergy.WATT_HOUR, - state_class=SensorStateClass.TOTAL_INCREASING, + state_class=SensorStateClass.TOTAL, device_class=SensorDeviceClass.ENERGY, suggested_display_precision=0, ), @@ -393,7 +393,7 @@ def get_model_name(model, hardware_id): key=f"lifetime_consumption_{phase}", name=f"Lifetime Energy Consumption {phase.upper()}", native_unit_of_measurement=UnitOfEnergy.WATT_HOUR, - state_class=SensorStateClass.TOTAL_INCREASING, + state_class=SensorStateClass.TOTAL, device_class=SensorDeviceClass.ENERGY, suggested_display_precision=0, ),