Use new device class in netatmo (#83367)

pull/72291/head
epenet 2022-12-08 20:57:51 +01:00 committed by GitHub
parent 0edcb26844
commit 0f2097595e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 18 additions and 20 deletions

View File

@ -19,13 +19,13 @@ from homeassistant.const import (
ATTR_LONGITUDE,
CONCENTRATION_PARTS_PER_MILLION,
DEGREE,
LENGTH_MILLIMETERS,
PERCENTAGE,
POWER_WATT,
PRESSURE_MBAR,
SOUND_PRESSURE_DB,
SPEED_KILOMETERS_PER_HOUR,
TEMP_CELSIUS,
UnitOfPower,
UnitOfPrecipitationDepth,
UnitOfPressure,
UnitOfSpeed,
UnitOfTemperature,
)
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers import device_registry as dr
@ -88,7 +88,7 @@ SENSOR_TYPES: tuple[NetatmoSensorEntityDescription, ...] = (
name="Temperature",
netatmo_name="temperature",
entity_registry_enabled_default=True,
native_unit_of_measurement=TEMP_CELSIUS,
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
state_class=SensorStateClass.MEASUREMENT,
device_class=SensorDeviceClass.TEMPERATURE,
),
@ -113,7 +113,7 @@ SENSOR_TYPES: tuple[NetatmoSensorEntityDescription, ...] = (
name="Pressure",
netatmo_name="pressure",
entity_registry_enabled_default=True,
native_unit_of_measurement=PRESSURE_MBAR,
native_unit_of_measurement=UnitOfPressure.MBAR,
state_class=SensorStateClass.MEASUREMENT,
device_class=SensorDeviceClass.PRESSURE,
),
@ -147,27 +147,27 @@ SENSOR_TYPES: tuple[NetatmoSensorEntityDescription, ...] = (
name="Rain",
netatmo_name="rain",
entity_registry_enabled_default=True,
native_unit_of_measurement=LENGTH_MILLIMETERS,
native_unit_of_measurement=UnitOfPrecipitationDepth.MILLIMETERS,
device_class=SensorDeviceClass.PRECIPITATION,
state_class=SensorStateClass.MEASUREMENT,
icon="mdi:weather-rainy",
),
NetatmoSensorEntityDescription(
key="sum_rain_1",
name="Rain last hour",
netatmo_name="sum_rain_1",
entity_registry_enabled_default=False,
native_unit_of_measurement=LENGTH_MILLIMETERS,
native_unit_of_measurement=UnitOfPrecipitationDepth.MILLIMETERS,
device_class=SensorDeviceClass.PRECIPITATION,
state_class=SensorStateClass.TOTAL,
icon="mdi:weather-rainy",
),
NetatmoSensorEntityDescription(
key="sum_rain_24",
name="Rain today",
netatmo_name="sum_rain_24",
entity_registry_enabled_default=True,
native_unit_of_measurement=LENGTH_MILLIMETERS,
native_unit_of_measurement=UnitOfPrecipitationDepth.MILLIMETERS,
device_class=SensorDeviceClass.PRECIPITATION,
state_class=SensorStateClass.TOTAL_INCREASING,
icon="mdi:weather-rainy",
),
NetatmoSensorEntityDescription(
key="battery_percent",
@ -200,9 +200,8 @@ SENSOR_TYPES: tuple[NetatmoSensorEntityDescription, ...] = (
name="Wind Strength",
netatmo_name="wind_strength",
entity_registry_enabled_default=True,
native_unit_of_measurement=SPEED_KILOMETERS_PER_HOUR,
device_class=SensorDeviceClass.SPEED,
icon="mdi:weather-windy",
native_unit_of_measurement=UnitOfSpeed.KILOMETERS_PER_HOUR,
device_class=SensorDeviceClass.WIND_SPEED,
state_class=SensorStateClass.MEASUREMENT,
),
NetatmoSensorEntityDescription(
@ -226,9 +225,8 @@ SENSOR_TYPES: tuple[NetatmoSensorEntityDescription, ...] = (
name="Gust Strength",
netatmo_name="gust_strength",
entity_registry_enabled_default=False,
native_unit_of_measurement=SPEED_KILOMETERS_PER_HOUR,
device_class=SensorDeviceClass.SPEED,
icon="mdi:weather-windy",
native_unit_of_measurement=UnitOfSpeed.KILOMETERS_PER_HOUR,
device_class=SensorDeviceClass.WIND_SPEED,
state_class=SensorStateClass.MEASUREMENT,
),
NetatmoSensorEntityDescription(
@ -267,7 +265,7 @@ SENSOR_TYPES: tuple[NetatmoSensorEntityDescription, ...] = (
name="Power",
netatmo_name="power",
entity_registry_enabled_default=True,
native_unit_of_measurement=POWER_WATT,
native_unit_of_measurement=UnitOfPower.WATT,
state_class=SensorStateClass.TOTAL,
device_class=SensorDeviceClass.POWER,
),