From 3ac585ea2d53c187359016dfeb6b1638578d0cd3 Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Wed, 15 Dec 2021 16:36:22 +0100 Subject: [PATCH] Use new enums in meteo-france (#61896) Co-authored-by: epenet --- .../components/meteo_france/const.py | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/homeassistant/components/meteo_france/const.py b/homeassistant/components/meteo_france/const.py index 2967e5e5bec..df667b1964b 100644 --- a/homeassistant/components/meteo_france/const.py +++ b/homeassistant/components/meteo_france/const.py @@ -4,8 +4,9 @@ from __future__ import annotations from dataclasses import dataclass from homeassistant.components.sensor import ( - STATE_CLASS_MEASUREMENT, + SensorDeviceClass, SensorEntityDescription, + SensorStateClass, ) from homeassistant.components.weather import ( ATTR_CONDITION_CLEAR_NIGHT, @@ -25,9 +26,6 @@ from homeassistant.components.weather import ( ATTR_CONDITION_WINDY_VARIANT, ) from homeassistant.const import ( - DEVICE_CLASS_PRESSURE, - DEVICE_CLASS_TEMPERATURE, - DEVICE_CLASS_TIMESTAMP, LENGTH_MILLIMETERS, PERCENTAGE, PRESSURE_HPA, @@ -75,8 +73,8 @@ SENSOR_TYPES: tuple[MeteoFranceSensorEntityDescription, ...] = ( key="pressure", name="Pressure", native_unit_of_measurement=PRESSURE_HPA, - device_class=DEVICE_CLASS_PRESSURE, - state_class=STATE_CLASS_MEASUREMENT, + device_class=SensorDeviceClass.PRESSURE, + state_class=SensorStateClass.MEASUREMENT, entity_registry_enabled_default=False, data_path="current_forecast:sea_level", ), @@ -84,7 +82,7 @@ SENSOR_TYPES: tuple[MeteoFranceSensorEntityDescription, ...] = ( key="wind_gust", name="Wind gust", native_unit_of_measurement=SPEED_KILOMETERS_PER_HOUR, - state_class=STATE_CLASS_MEASUREMENT, + state_class=SensorStateClass.MEASUREMENT, icon="mdi:weather-windy-variant", entity_registry_enabled_default=False, data_path="current_forecast:wind:gust", @@ -93,7 +91,7 @@ SENSOR_TYPES: tuple[MeteoFranceSensorEntityDescription, ...] = ( key="wind_speed", name="Wind speed", native_unit_of_measurement=SPEED_KILOMETERS_PER_HOUR, - state_class=STATE_CLASS_MEASUREMENT, + state_class=SensorStateClass.MEASUREMENT, icon="mdi:weather-windy", entity_registry_enabled_default=False, data_path="current_forecast:wind:speed", @@ -102,8 +100,8 @@ SENSOR_TYPES: tuple[MeteoFranceSensorEntityDescription, ...] = ( key="temperature", name="Temperature", native_unit_of_measurement=TEMP_CELSIUS, - device_class=DEVICE_CLASS_TEMPERATURE, - state_class=STATE_CLASS_MEASUREMENT, + device_class=SensorDeviceClass.TEMPERATURE, + state_class=SensorStateClass.MEASUREMENT, entity_registry_enabled_default=False, data_path="current_forecast:T:value", ), @@ -146,7 +144,7 @@ SENSOR_TYPES_RAIN: tuple[MeteoFranceSensorEntityDescription, ...] = ( MeteoFranceSensorEntityDescription( key="next_rain", name="Next rain", - device_class=DEVICE_CLASS_TIMESTAMP, + device_class=SensorDeviceClass.TIMESTAMP, data_path="", ), )