From 5399dfd39d3ab7a4e3f63dd37da4d4eae17bc684 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Kolenat=C3=BD?= Date: Wed, 26 Apr 2023 10:09:30 +0200 Subject: [PATCH] Set forecast-solar energy sensor's units of measurement to Wh (#92022) * All energy units of measurement changed to Wh. * All energy units of measurement changed to Wh. --- .../components/forecast_solar/const.py | 24 ++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/homeassistant/components/forecast_solar/const.py b/homeassistant/components/forecast_solar/const.py index c7663d6cf31..e23072f0bec 100644 --- a/homeassistant/components/forecast_solar/const.py +++ b/homeassistant/components/forecast_solar/const.py @@ -22,16 +22,20 @@ SENSORS: tuple[ForecastSolarSensorEntityDescription, ...] = ( ForecastSolarSensorEntityDescription( key="energy_production_today", name="Estimated energy production - today", - state=lambda estimate: estimate.energy_production_today / 1000, + state=lambda estimate: estimate.energy_production_today, device_class=SensorDeviceClass.ENERGY, - native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR, + native_unit_of_measurement=UnitOfEnergy.WATT_HOUR, + suggested_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR, + suggested_display_precision=1, ), ForecastSolarSensorEntityDescription( key="energy_production_tomorrow", name="Estimated energy production - tomorrow", - state=lambda estimate: estimate.energy_production_tomorrow / 1000, + state=lambda estimate: estimate.energy_production_tomorrow, device_class=SensorDeviceClass.ENERGY, - native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR, + native_unit_of_measurement=UnitOfEnergy.WATT_HOUR, + suggested_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR, + suggested_display_precision=1, ), ForecastSolarSensorEntityDescription( key="power_highest_peak_time_today", @@ -84,15 +88,19 @@ SENSORS: tuple[ForecastSolarSensorEntityDescription, ...] = ( ForecastSolarSensorEntityDescription( key="energy_current_hour", name="Estimated energy production - this hour", - state=lambda estimate: estimate.energy_current_hour / 1000, + state=lambda estimate: estimate.energy_current_hour, device_class=SensorDeviceClass.ENERGY, - native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR, + native_unit_of_measurement=UnitOfEnergy.WATT_HOUR, + suggested_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR, + suggested_display_precision=1, ), ForecastSolarSensorEntityDescription( key="energy_next_hour", - state=lambda estimate: estimate.sum_energy_production(1) / 1000, + state=lambda estimate: estimate.sum_energy_production(1), name="Estimated energy production - next hour", device_class=SensorDeviceClass.ENERGY, - native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR, + native_unit_of_measurement=UnitOfEnergy.WATT_HOUR, + suggested_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR, + suggested_display_precision=1, ), )