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.
This commit is contained in:
Ondřej Kolenatý 2023-04-26 10:09:30 +02:00 committed by GitHub
parent 09109d093e
commit 5399dfd39d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -22,16 +22,20 @@ SENSORS: tuple[ForecastSolarSensorEntityDescription, ...] = (
ForecastSolarSensorEntityDescription( ForecastSolarSensorEntityDescription(
key="energy_production_today", key="energy_production_today",
name="Estimated 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, 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( ForecastSolarSensorEntityDescription(
key="energy_production_tomorrow", key="energy_production_tomorrow",
name="Estimated 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, 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( ForecastSolarSensorEntityDescription(
key="power_highest_peak_time_today", key="power_highest_peak_time_today",
@ -84,15 +88,19 @@ SENSORS: tuple[ForecastSolarSensorEntityDescription, ...] = (
ForecastSolarSensorEntityDescription( ForecastSolarSensorEntityDescription(
key="energy_current_hour", key="energy_current_hour",
name="Estimated energy production - this 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, 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( ForecastSolarSensorEntityDescription(
key="energy_next_hour", 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", name="Estimated energy production - next hour",
device_class=SensorDeviceClass.ENERGY, 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,
), ),
) )