From 717f4a5ab0368b81390ca41e9c2e7adbbead8f83 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 13 Jun 2026 19:51:17 +0000 Subject: [PATCH 1/2] Initial plan From aeedce20a3a560db87f8868a10572dbf7cb2d87d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 13 Jun 2026 19:53:12 +0000 Subject: [PATCH 2/2] fix: relabel average_power_consumption sensor as range efficiency factor (%) The averPowerConsumption field from the Smart API is not a power value in Watts but a range correction/efficiency factor in percent. This change: - Removes device_class=POWER and the W unit - Sets native_unit_of_measurement to % - Updates the icon to mdi:gauge - Removes the sign-inversion logic (not needed for an efficiency %) - Updates EN and DE translations Closes #436 --- custom_components/smarthashtag/sensor.py | 6 ------ custom_components/smarthashtag/sensor_groups/battery.py | 6 +++--- custom_components/smarthashtag/translations/de.json | 2 +- custom_components/smarthashtag/translations/en.json | 2 +- 4 files changed, 5 insertions(+), 11 deletions(-) diff --git a/custom_components/smarthashtag/sensor.py b/custom_components/smarthashtag/sensor.py index cead2c5..817b17c 100644 --- a/custom_components/smarthashtag/sensor.py +++ b/custom_components/smarthashtag/sensor.py @@ -208,12 +208,6 @@ def native_value(self) -> int: return None return data - # invert power consumption value to display the consumed power as positive - if "average_power_consumption" in self.entity_description.key: - if data.value: - return data.value * -1 - return data - if isinstance(data, ValueWithUnit): return data.value diff --git a/custom_components/smarthashtag/sensor_groups/battery.py b/custom_components/smarthashtag/sensor_groups/battery.py index a298e5d..478a317 100644 --- a/custom_components/smarthashtag/sensor_groups/battery.py +++ b/custom_components/smarthashtag/sensor_groups/battery.py @@ -123,9 +123,9 @@ SensorEntityDescription( key="average_power_consumption", translation_key="average_power_consumption", - name="Average power consumption", - icon="mdi:power", - device_class=SensorDeviceClass.POWER, + name="Range efficiency factor", + icon="mdi:gauge", + native_unit_of_measurement="%", state_class=SensorStateClass.MEASUREMENT, suggested_display_precision=1, ), diff --git a/custom_components/smarthashtag/translations/de.json b/custom_components/smarthashtag/translations/de.json index b70c412..f7c0601 100644 --- a/custom_components/smarthashtag/translations/de.json +++ b/custom_components/smarthashtag/translations/de.json @@ -116,7 +116,7 @@ "name": "Ladeziel" }, "average_power_consumption": { - "name": "Durchschnittsverbrauch" + "name": "Reichweiteneffizienzfaktor" }, "position": { "name": "Position" diff --git a/custom_components/smarthashtag/translations/en.json b/custom_components/smarthashtag/translations/en.json index 98fa8cf..ba658fc 100644 --- a/custom_components/smarthashtag/translations/en.json +++ b/custom_components/smarthashtag/translations/en.json @@ -116,7 +116,7 @@ "name": "Charging target" }, "average_power_consumption": { - "name": "Average Power Consumption" + "name": "Range Efficiency Factor" }, "position": { "name": "Position"