Use new SensorDeviceClass enum in buienradar (#61329)

Co-authored-by: epenet <epenet@users.noreply.github.com>
pull/61338/head
epenet 2021-12-09 09:18:48 +01:00 committed by GitHub
parent 172591031d
commit bdbecc6c05
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 18 additions and 15 deletions

View File

@ -21,7 +21,11 @@ from buienradar.constants import (
WINDSPEED, WINDSPEED,
) )
from homeassistant.components.sensor import SensorEntity, SensorEntityDescription from homeassistant.components.sensor import (
SensorDeviceClass,
SensorEntity,
SensorEntityDescription,
)
from homeassistant.config_entries import ConfigEntry from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ( from homeassistant.const import (
ATTR_ATTRIBUTION, ATTR_ATTRIBUTION,
@ -29,7 +33,6 @@ from homeassistant.const import (
CONF_LONGITUDE, CONF_LONGITUDE,
CONF_NAME, CONF_NAME,
DEGREE, DEGREE,
DEVICE_CLASS_TEMPERATURE,
IRRADIATION_WATTS_PER_SQUARE_METER, IRRADIATION_WATTS_PER_SQUARE_METER,
LENGTH_KILOMETERS, LENGTH_KILOMETERS,
LENGTH_MILLIMETERS, LENGTH_MILLIMETERS,
@ -107,7 +110,7 @@ SENSOR_TYPES: tuple[SensorEntityDescription, ...] = (
key="feeltemperature", key="feeltemperature",
name="Feel temperature", name="Feel temperature",
native_unit_of_measurement=TEMP_CELSIUS, native_unit_of_measurement=TEMP_CELSIUS,
device_class=DEVICE_CLASS_TEMPERATURE, device_class=SensorDeviceClass.TEMPERATURE,
), ),
SensorEntityDescription( SensorEntityDescription(
key="humidity", key="humidity",
@ -119,13 +122,13 @@ SENSOR_TYPES: tuple[SensorEntityDescription, ...] = (
key="temperature", key="temperature",
name="Temperature", name="Temperature",
native_unit_of_measurement=TEMP_CELSIUS, native_unit_of_measurement=TEMP_CELSIUS,
device_class=DEVICE_CLASS_TEMPERATURE, device_class=SensorDeviceClass.TEMPERATURE,
), ),
SensorEntityDescription( SensorEntityDescription(
key="groundtemperature", key="groundtemperature",
name="Ground temperature", name="Ground temperature",
native_unit_of_measurement=TEMP_CELSIUS, native_unit_of_measurement=TEMP_CELSIUS,
device_class=DEVICE_CLASS_TEMPERATURE, device_class=SensorDeviceClass.TEMPERATURE,
), ),
SensorEntityDescription( SensorEntityDescription(
key="windspeed", key="windspeed",
@ -209,61 +212,61 @@ SENSOR_TYPES: tuple[SensorEntityDescription, ...] = (
key="temperature_1d", key="temperature_1d",
name="Temperature 1d", name="Temperature 1d",
native_unit_of_measurement=TEMP_CELSIUS, native_unit_of_measurement=TEMP_CELSIUS,
device_class=DEVICE_CLASS_TEMPERATURE, device_class=SensorDeviceClass.TEMPERATURE,
), ),
SensorEntityDescription( SensorEntityDescription(
key="temperature_2d", key="temperature_2d",
name="Temperature 2d", name="Temperature 2d",
native_unit_of_measurement=TEMP_CELSIUS, native_unit_of_measurement=TEMP_CELSIUS,
device_class=DEVICE_CLASS_TEMPERATURE, device_class=SensorDeviceClass.TEMPERATURE,
), ),
SensorEntityDescription( SensorEntityDescription(
key="temperature_3d", key="temperature_3d",
name="Temperature 3d", name="Temperature 3d",
native_unit_of_measurement=TEMP_CELSIUS, native_unit_of_measurement=TEMP_CELSIUS,
device_class=DEVICE_CLASS_TEMPERATURE, device_class=SensorDeviceClass.TEMPERATURE,
), ),
SensorEntityDescription( SensorEntityDescription(
key="temperature_4d", key="temperature_4d",
name="Temperature 4d", name="Temperature 4d",
native_unit_of_measurement=TEMP_CELSIUS, native_unit_of_measurement=TEMP_CELSIUS,
device_class=DEVICE_CLASS_TEMPERATURE, device_class=SensorDeviceClass.TEMPERATURE,
), ),
SensorEntityDescription( SensorEntityDescription(
key="temperature_5d", key="temperature_5d",
name="Temperature 5d", name="Temperature 5d",
native_unit_of_measurement=TEMP_CELSIUS, native_unit_of_measurement=TEMP_CELSIUS,
device_class=DEVICE_CLASS_TEMPERATURE, device_class=SensorDeviceClass.TEMPERATURE,
), ),
SensorEntityDescription( SensorEntityDescription(
key="mintemp_1d", key="mintemp_1d",
name="Minimum temperature 1d", name="Minimum temperature 1d",
native_unit_of_measurement=TEMP_CELSIUS, native_unit_of_measurement=TEMP_CELSIUS,
device_class=DEVICE_CLASS_TEMPERATURE, device_class=SensorDeviceClass.TEMPERATURE,
), ),
SensorEntityDescription( SensorEntityDescription(
key="mintemp_2d", key="mintemp_2d",
name="Minimum temperature 2d", name="Minimum temperature 2d",
native_unit_of_measurement=TEMP_CELSIUS, native_unit_of_measurement=TEMP_CELSIUS,
device_class=DEVICE_CLASS_TEMPERATURE, device_class=SensorDeviceClass.TEMPERATURE,
), ),
SensorEntityDescription( SensorEntityDescription(
key="mintemp_3d", key="mintemp_3d",
name="Minimum temperature 3d", name="Minimum temperature 3d",
native_unit_of_measurement=TEMP_CELSIUS, native_unit_of_measurement=TEMP_CELSIUS,
device_class=DEVICE_CLASS_TEMPERATURE, device_class=SensorDeviceClass.TEMPERATURE,
), ),
SensorEntityDescription( SensorEntityDescription(
key="mintemp_4d", key="mintemp_4d",
name="Minimum temperature 4d", name="Minimum temperature 4d",
native_unit_of_measurement=TEMP_CELSIUS, native_unit_of_measurement=TEMP_CELSIUS,
device_class=DEVICE_CLASS_TEMPERATURE, device_class=SensorDeviceClass.TEMPERATURE,
), ),
SensorEntityDescription( SensorEntityDescription(
key="mintemp_5d", key="mintemp_5d",
name="Minimum temperature 5d", name="Minimum temperature 5d",
native_unit_of_measurement=TEMP_CELSIUS, native_unit_of_measurement=TEMP_CELSIUS,
device_class=DEVICE_CLASS_TEMPERATURE, device_class=SensorDeviceClass.TEMPERATURE,
), ),
SensorEntityDescription( SensorEntityDescription(
key="rain_1d", key="rain_1d",