Use new SensorDeviceClass in metoffice (#61899)

Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
epenet 2021-12-15 16:33:15 +01:00 committed by GitHub
parent b91124c030
commit ce2063fb07
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,11 +1,13 @@
"""Support for UK Met Office weather service.""" """Support for UK Met Office weather service."""
from __future__ import annotations from __future__ import annotations
from homeassistant.components.sensor import SensorEntity, SensorEntityDescription from homeassistant.components.sensor import (
SensorDeviceClass,
SensorEntity,
SensorEntityDescription,
)
from homeassistant.const import ( from homeassistant.const import (
ATTR_ATTRIBUTION, ATTR_ATTRIBUTION,
DEVICE_CLASS_HUMIDITY,
DEVICE_CLASS_TEMPERATURE,
LENGTH_KILOMETERS, LENGTH_KILOMETERS,
PERCENTAGE, PERCENTAGE,
SPEED_MILES_PER_HOUR, SPEED_MILES_PER_HOUR,
@ -58,7 +60,7 @@ SENSOR_TYPES: tuple[SensorEntityDescription, ...] = (
SensorEntityDescription( SensorEntityDescription(
key="temperature", key="temperature",
name="Temperature", name="Temperature",
device_class=DEVICE_CLASS_TEMPERATURE, device_class=SensorDeviceClass.TEMPERATURE,
native_unit_of_measurement=TEMP_CELSIUS, native_unit_of_measurement=TEMP_CELSIUS,
icon=None, icon=None,
entity_registry_enabled_default=True, entity_registry_enabled_default=True,
@ -66,7 +68,7 @@ SENSOR_TYPES: tuple[SensorEntityDescription, ...] = (
SensorEntityDescription( SensorEntityDescription(
key="feels_like_temperature", key="feels_like_temperature",
name="Feels Like Temperature", name="Feels Like Temperature",
device_class=DEVICE_CLASS_TEMPERATURE, device_class=SensorDeviceClass.TEMPERATURE,
native_unit_of_measurement=TEMP_CELSIUS, native_unit_of_measurement=TEMP_CELSIUS,
icon=None, icon=None,
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
@ -130,7 +132,7 @@ SENSOR_TYPES: tuple[SensorEntityDescription, ...] = (
SensorEntityDescription( SensorEntityDescription(
key="humidity", key="humidity",
name="Humidity", name="Humidity",
device_class=DEVICE_CLASS_HUMIDITY, device_class=SensorDeviceClass.HUMIDITY,
native_unit_of_measurement=PERCENTAGE, native_unit_of_measurement=PERCENTAGE,
icon=None, icon=None,
entity_registry_enabled_default=False, entity_registry_enabled_default=False,