Enable long-term statistics for OpenWeatherMap sensors (#57781)
parent
3c52bc214d
commit
55ffc85a0a
|
@ -1,7 +1,10 @@
|
||||||
"""Consts for the OpenWeatherMap."""
|
"""Consts for the OpenWeatherMap."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from homeassistant.components.sensor import SensorEntityDescription
|
from homeassistant.components.sensor import (
|
||||||
|
STATE_CLASS_MEASUREMENT,
|
||||||
|
SensorEntityDescription,
|
||||||
|
)
|
||||||
from homeassistant.components.weather import (
|
from homeassistant.components.weather import (
|
||||||
ATTR_CONDITION_CLOUDY,
|
ATTR_CONDITION_CLOUDY,
|
||||||
ATTR_CONDITION_EXCEPTIONAL,
|
ATTR_CONDITION_EXCEPTIONAL,
|
||||||
|
@ -173,55 +176,65 @@ WEATHER_SENSOR_TYPES: tuple[SensorEntityDescription, ...] = (
|
||||||
name="Dew Point",
|
name="Dew Point",
|
||||||
native_unit_of_measurement=TEMP_CELSIUS,
|
native_unit_of_measurement=TEMP_CELSIUS,
|
||||||
device_class=DEVICE_CLASS_TEMPERATURE,
|
device_class=DEVICE_CLASS_TEMPERATURE,
|
||||||
|
state_class=STATE_CLASS_MEASUREMENT,
|
||||||
),
|
),
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key=ATTR_API_TEMPERATURE,
|
key=ATTR_API_TEMPERATURE,
|
||||||
name="Temperature",
|
name="Temperature",
|
||||||
native_unit_of_measurement=TEMP_CELSIUS,
|
native_unit_of_measurement=TEMP_CELSIUS,
|
||||||
device_class=DEVICE_CLASS_TEMPERATURE,
|
device_class=DEVICE_CLASS_TEMPERATURE,
|
||||||
|
state_class=STATE_CLASS_MEASUREMENT,
|
||||||
),
|
),
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key=ATTR_API_FEELS_LIKE_TEMPERATURE,
|
key=ATTR_API_FEELS_LIKE_TEMPERATURE,
|
||||||
name="Feels like temperature",
|
name="Feels like temperature",
|
||||||
native_unit_of_measurement=TEMP_CELSIUS,
|
native_unit_of_measurement=TEMP_CELSIUS,
|
||||||
device_class=DEVICE_CLASS_TEMPERATURE,
|
device_class=DEVICE_CLASS_TEMPERATURE,
|
||||||
|
state_class=STATE_CLASS_MEASUREMENT,
|
||||||
),
|
),
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key=ATTR_API_WIND_SPEED,
|
key=ATTR_API_WIND_SPEED,
|
||||||
name="Wind speed",
|
name="Wind speed",
|
||||||
native_unit_of_measurement=SPEED_METERS_PER_SECOND,
|
native_unit_of_measurement=SPEED_METERS_PER_SECOND,
|
||||||
|
state_class=STATE_CLASS_MEASUREMENT,
|
||||||
),
|
),
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key=ATTR_API_WIND_BEARING,
|
key=ATTR_API_WIND_BEARING,
|
||||||
name="Wind bearing",
|
name="Wind bearing",
|
||||||
native_unit_of_measurement=DEGREE,
|
native_unit_of_measurement=DEGREE,
|
||||||
|
state_class=STATE_CLASS_MEASUREMENT,
|
||||||
),
|
),
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key=ATTR_API_HUMIDITY,
|
key=ATTR_API_HUMIDITY,
|
||||||
name="Humidity",
|
name="Humidity",
|
||||||
native_unit_of_measurement=PERCENTAGE,
|
native_unit_of_measurement=PERCENTAGE,
|
||||||
device_class=DEVICE_CLASS_HUMIDITY,
|
device_class=DEVICE_CLASS_HUMIDITY,
|
||||||
|
state_class=STATE_CLASS_MEASUREMENT,
|
||||||
),
|
),
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key=ATTR_API_PRESSURE,
|
key=ATTR_API_PRESSURE,
|
||||||
name="Pressure",
|
name="Pressure",
|
||||||
native_unit_of_measurement=PRESSURE_HPA,
|
native_unit_of_measurement=PRESSURE_HPA,
|
||||||
device_class=DEVICE_CLASS_PRESSURE,
|
device_class=DEVICE_CLASS_PRESSURE,
|
||||||
|
state_class=STATE_CLASS_MEASUREMENT,
|
||||||
),
|
),
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key=ATTR_API_CLOUDS,
|
key=ATTR_API_CLOUDS,
|
||||||
name="Cloud coverage",
|
name="Cloud coverage",
|
||||||
native_unit_of_measurement=PERCENTAGE,
|
native_unit_of_measurement=PERCENTAGE,
|
||||||
|
state_class=STATE_CLASS_MEASUREMENT,
|
||||||
),
|
),
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key=ATTR_API_RAIN,
|
key=ATTR_API_RAIN,
|
||||||
name="Rain",
|
name="Rain",
|
||||||
native_unit_of_measurement=LENGTH_MILLIMETERS,
|
native_unit_of_measurement=LENGTH_MILLIMETERS,
|
||||||
|
state_class=STATE_CLASS_MEASUREMENT,
|
||||||
),
|
),
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key=ATTR_API_SNOW,
|
key=ATTR_API_SNOW,
|
||||||
name="Snow",
|
name="Snow",
|
||||||
native_unit_of_measurement=LENGTH_MILLIMETERS,
|
native_unit_of_measurement=LENGTH_MILLIMETERS,
|
||||||
|
state_class=STATE_CLASS_MEASUREMENT,
|
||||||
),
|
),
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key=ATTR_API_PRECIPITATION_KIND,
|
key=ATTR_API_PRECIPITATION_KIND,
|
||||||
|
@ -231,6 +244,7 @@ WEATHER_SENSOR_TYPES: tuple[SensorEntityDescription, ...] = (
|
||||||
key=ATTR_API_UV_INDEX,
|
key=ATTR_API_UV_INDEX,
|
||||||
name="UV Index",
|
name="UV Index",
|
||||||
native_unit_of_measurement=UV_INDEX,
|
native_unit_of_measurement=UV_INDEX,
|
||||||
|
state_class=STATE_CLASS_MEASUREMENT,
|
||||||
),
|
),
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key=ATTR_API_CONDITION,
|
key=ATTR_API_CONDITION,
|
||||||
|
|
Loading…
Reference in New Issue