Use Irradiance device class in tomorrowio (#83574)

This commit is contained in:
epenet 2022-12-08 23:52:55 +01:00 committed by GitHub
parent 911863ebf4
commit 6c8823fc14
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -24,9 +24,8 @@ from homeassistant.const import (
CONCENTRATION_PARTS_PER_MILLION, CONCENTRATION_PARTS_PER_MILLION,
CONF_API_KEY, CONF_API_KEY,
CONF_NAME, CONF_NAME,
IRRADIATION_BTUS_PER_HOUR_SQUARE_FOOT,
IRRADIATION_WATTS_PER_SQUARE_METER,
PERCENTAGE, PERCENTAGE,
UnitOfIrradiance,
UnitOfLength, UnitOfLength,
UnitOfPressure, UnitOfPressure,
UnitOfSpeed, UnitOfSpeed,
@ -122,9 +121,10 @@ SENSOR_TYPES = (
TomorrowioSensorEntityDescription( TomorrowioSensorEntityDescription(
key=TMRW_ATTR_SOLAR_GHI, key=TMRW_ATTR_SOLAR_GHI,
name="Global Horizontal Irradiance", name="Global Horizontal Irradiance",
unit_imperial=IRRADIATION_BTUS_PER_HOUR_SQUARE_FOOT, unit_imperial=UnitOfIrradiance.BTUS_PER_HOUR_SQUARE_FOOT,
unit_metric=IRRADIATION_WATTS_PER_SQUARE_METER, unit_metric=UnitOfIrradiance.WATTS_PER_SQUARE_METER,
imperial_conversion=(1 / 3.15459), imperial_conversion=(1 / 3.15459),
device_class=SensorDeviceClass.IRRADIANCE,
), ),
# Data comes in as km, convert to miles for imperial # Data comes in as km, convert to miles for imperial
TomorrowioSensorEntityDescription( TomorrowioSensorEntityDescription(