Use new enums in meteo-france (#61896)

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

View File

@ -4,8 +4,9 @@ from __future__ import annotations
from dataclasses import dataclass from dataclasses import dataclass
from homeassistant.components.sensor import ( from homeassistant.components.sensor import (
STATE_CLASS_MEASUREMENT, SensorDeviceClass,
SensorEntityDescription, SensorEntityDescription,
SensorStateClass,
) )
from homeassistant.components.weather import ( from homeassistant.components.weather import (
ATTR_CONDITION_CLEAR_NIGHT, ATTR_CONDITION_CLEAR_NIGHT,
@ -25,9 +26,6 @@ from homeassistant.components.weather import (
ATTR_CONDITION_WINDY_VARIANT, ATTR_CONDITION_WINDY_VARIANT,
) )
from homeassistant.const import ( from homeassistant.const import (
DEVICE_CLASS_PRESSURE,
DEVICE_CLASS_TEMPERATURE,
DEVICE_CLASS_TIMESTAMP,
LENGTH_MILLIMETERS, LENGTH_MILLIMETERS,
PERCENTAGE, PERCENTAGE,
PRESSURE_HPA, PRESSURE_HPA,
@ -75,8 +73,8 @@ SENSOR_TYPES: tuple[MeteoFranceSensorEntityDescription, ...] = (
key="pressure", key="pressure",
name="Pressure", name="Pressure",
native_unit_of_measurement=PRESSURE_HPA, native_unit_of_measurement=PRESSURE_HPA,
device_class=DEVICE_CLASS_PRESSURE, device_class=SensorDeviceClass.PRESSURE,
state_class=STATE_CLASS_MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
data_path="current_forecast:sea_level", data_path="current_forecast:sea_level",
), ),
@ -84,7 +82,7 @@ SENSOR_TYPES: tuple[MeteoFranceSensorEntityDescription, ...] = (
key="wind_gust", key="wind_gust",
name="Wind gust", name="Wind gust",
native_unit_of_measurement=SPEED_KILOMETERS_PER_HOUR, native_unit_of_measurement=SPEED_KILOMETERS_PER_HOUR,
state_class=STATE_CLASS_MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
icon="mdi:weather-windy-variant", icon="mdi:weather-windy-variant",
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
data_path="current_forecast:wind:gust", data_path="current_forecast:wind:gust",
@ -93,7 +91,7 @@ SENSOR_TYPES: tuple[MeteoFranceSensorEntityDescription, ...] = (
key="wind_speed", key="wind_speed",
name="Wind speed", name="Wind speed",
native_unit_of_measurement=SPEED_KILOMETERS_PER_HOUR, native_unit_of_measurement=SPEED_KILOMETERS_PER_HOUR,
state_class=STATE_CLASS_MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
icon="mdi:weather-windy", icon="mdi:weather-windy",
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
data_path="current_forecast:wind:speed", data_path="current_forecast:wind:speed",
@ -102,8 +100,8 @@ SENSOR_TYPES: tuple[MeteoFranceSensorEntityDescription, ...] = (
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,
state_class=STATE_CLASS_MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
data_path="current_forecast:T:value", data_path="current_forecast:T:value",
), ),
@ -146,7 +144,7 @@ SENSOR_TYPES_RAIN: tuple[MeteoFranceSensorEntityDescription, ...] = (
MeteoFranceSensorEntityDescription( MeteoFranceSensorEntityDescription(
key="next_rain", key="next_rain",
name="Next rain", name="Next rain",
device_class=DEVICE_CLASS_TIMESTAMP, device_class=SensorDeviceClass.TIMESTAMP,
data_path="", data_path="",
), ),
) )