From a5f852738927ae1fe289d12bb5ce04ff61cd11c6 Mon Sep 17 00:00:00 2001 From: Tom Scholten Date: Sat, 4 Nov 2023 09:41:03 +0100 Subject: [PATCH] Correct unit --- README.md | 3 +++ custom_components/stromer/manifest.json | 2 +- custom_components/stromer/sensor.py | 6 +++--- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 086325f..1234618 100644 --- a/README.md +++ b/README.md @@ -120,6 +120,9 @@ Even though available does not mean it's stable yet, the HA part is solid but th # Changelog +## NOV 2023 [0.2.5] + - Fix unit from W to Wh (thanks @Tinus78) via #46 + ## OCT 2023 [0.2.4] - Improve quality diff --git a/custom_components/stromer/manifest.json b/custom_components/stromer/manifest.json index 792b69e..e1609bf 100644 --- a/custom_components/stromer/manifest.json +++ b/custom_components/stromer/manifest.json @@ -7,5 +7,5 @@ "iot_class": "cloud_polling", "issue_tracker": "https://github.com/CoMPaTech/stromer/issues", "requirements": [], - "version": "0.2.4" + "version": "0.2.5" } diff --git a/custom_components/stromer/sensor.py b/custom_components/stromer/sensor.py index c6b2fad..30ac7e7 100644 --- a/custom_components/stromer/sensor.py +++ b/custom_components/stromer/sensor.py @@ -4,7 +4,7 @@ from homeassistant.components.sensor import (SensorDeviceClass, SensorEntity, SensorEntityDescription, SensorStateClass) -from homeassistant.const import (LENGTH_KILOMETERS, PERCENTAGE, POWER_WATT, +from homeassistant.const import (ENERGY_WATT_HOUR, LENGTH_KILOMETERS, PERCENTAGE, POWER_WATT, PRESSURE_BAR, SPEED_KILOMETERS_PER_HOUR, TEMP_CELSIUS, TIME_SECONDS) from homeassistant.helpers.entity import EntityCategory @@ -33,7 +33,7 @@ SensorEntityDescription( key="average_energy_consumption", name="Energy used (average)", - native_unit_of_measurement=POWER_WATT, + native_unit_of_measurement=ENERGY_WATT_HOUR, device_class=SensorDeviceClass.POWER, state_class=SensorStateClass.MEASUREMENT, ), @@ -110,7 +110,7 @@ SensorEntityDescription( key="total_energy_consumption", name="Energy used (total)", - native_unit_of_measurement=POWER_WATT, + native_unit_of_measurement=ENERGY_WATT_HOUR, device_class=SensorDeviceClass.POWER, state_class=SensorStateClass.MEASUREMENT, ),