Add state class support to Netatmo (#54051)
This commit is contained in:
parent
4a37ff2dda
commit
91ab86c17c
1 changed files with 17 additions and 1 deletions
|
@ -7,7 +7,11 @@ from typing import NamedTuple, cast
|
||||||
|
|
||||||
import pyatmo
|
import pyatmo
|
||||||
|
|
||||||
from homeassistant.components.sensor import SensorEntity, SensorEntityDescription
|
from homeassistant.components.sensor import (
|
||||||
|
STATE_CLASS_MEASUREMENT,
|
||||||
|
SensorEntity,
|
||||||
|
SensorEntityDescription,
|
||||||
|
)
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
ATTR_LATITUDE,
|
ATTR_LATITUDE,
|
||||||
|
@ -81,6 +85,7 @@ SENSOR_TYPES: tuple[NetatmoSensorEntityDescription, ...] = (
|
||||||
entity_registry_enabled_default=True,
|
entity_registry_enabled_default=True,
|
||||||
unit_of_measurement=TEMP_CELSIUS,
|
unit_of_measurement=TEMP_CELSIUS,
|
||||||
device_class=DEVICE_CLASS_TEMPERATURE,
|
device_class=DEVICE_CLASS_TEMPERATURE,
|
||||||
|
state_class=STATE_CLASS_MEASUREMENT,
|
||||||
),
|
),
|
||||||
NetatmoSensorEntityDescription(
|
NetatmoSensorEntityDescription(
|
||||||
key="temp_trend",
|
key="temp_trend",
|
||||||
|
@ -96,6 +101,7 @@ SENSOR_TYPES: tuple[NetatmoSensorEntityDescription, ...] = (
|
||||||
unit_of_measurement=CONCENTRATION_PARTS_PER_MILLION,
|
unit_of_measurement=CONCENTRATION_PARTS_PER_MILLION,
|
||||||
entity_registry_enabled_default=True,
|
entity_registry_enabled_default=True,
|
||||||
device_class=DEVICE_CLASS_CO2,
|
device_class=DEVICE_CLASS_CO2,
|
||||||
|
state_class=STATE_CLASS_MEASUREMENT,
|
||||||
),
|
),
|
||||||
NetatmoSensorEntityDescription(
|
NetatmoSensorEntityDescription(
|
||||||
key="pressure",
|
key="pressure",
|
||||||
|
@ -104,6 +110,7 @@ SENSOR_TYPES: tuple[NetatmoSensorEntityDescription, ...] = (
|
||||||
entity_registry_enabled_default=True,
|
entity_registry_enabled_default=True,
|
||||||
unit_of_measurement=PRESSURE_MBAR,
|
unit_of_measurement=PRESSURE_MBAR,
|
||||||
device_class=DEVICE_CLASS_PRESSURE,
|
device_class=DEVICE_CLASS_PRESSURE,
|
||||||
|
state_class=STATE_CLASS_MEASUREMENT,
|
||||||
),
|
),
|
||||||
NetatmoSensorEntityDescription(
|
NetatmoSensorEntityDescription(
|
||||||
key="pressure_trend",
|
key="pressure_trend",
|
||||||
|
@ -119,6 +126,7 @@ SENSOR_TYPES: tuple[NetatmoSensorEntityDescription, ...] = (
|
||||||
entity_registry_enabled_default=True,
|
entity_registry_enabled_default=True,
|
||||||
unit_of_measurement=SOUND_PRESSURE_DB,
|
unit_of_measurement=SOUND_PRESSURE_DB,
|
||||||
icon="mdi:volume-high",
|
icon="mdi:volume-high",
|
||||||
|
state_class=STATE_CLASS_MEASUREMENT,
|
||||||
),
|
),
|
||||||
NetatmoSensorEntityDescription(
|
NetatmoSensorEntityDescription(
|
||||||
key="humidity",
|
key="humidity",
|
||||||
|
@ -127,6 +135,7 @@ SENSOR_TYPES: tuple[NetatmoSensorEntityDescription, ...] = (
|
||||||
entity_registry_enabled_default=True,
|
entity_registry_enabled_default=True,
|
||||||
unit_of_measurement=PERCENTAGE,
|
unit_of_measurement=PERCENTAGE,
|
||||||
device_class=DEVICE_CLASS_HUMIDITY,
|
device_class=DEVICE_CLASS_HUMIDITY,
|
||||||
|
state_class=STATE_CLASS_MEASUREMENT,
|
||||||
),
|
),
|
||||||
NetatmoSensorEntityDescription(
|
NetatmoSensorEntityDescription(
|
||||||
key="rain",
|
key="rain",
|
||||||
|
@ -159,6 +168,7 @@ SENSOR_TYPES: tuple[NetatmoSensorEntityDescription, ...] = (
|
||||||
entity_registry_enabled_default=True,
|
entity_registry_enabled_default=True,
|
||||||
unit_of_measurement=PERCENTAGE,
|
unit_of_measurement=PERCENTAGE,
|
||||||
device_class=DEVICE_CLASS_BATTERY,
|
device_class=DEVICE_CLASS_BATTERY,
|
||||||
|
state_class=STATE_CLASS_MEASUREMENT,
|
||||||
),
|
),
|
||||||
NetatmoSensorEntityDescription(
|
NetatmoSensorEntityDescription(
|
||||||
key="windangle",
|
key="windangle",
|
||||||
|
@ -174,6 +184,7 @@ SENSOR_TYPES: tuple[NetatmoSensorEntityDescription, ...] = (
|
||||||
entity_registry_enabled_default=False,
|
entity_registry_enabled_default=False,
|
||||||
unit_of_measurement=DEGREE,
|
unit_of_measurement=DEGREE,
|
||||||
icon="mdi:compass-outline",
|
icon="mdi:compass-outline",
|
||||||
|
state_class=STATE_CLASS_MEASUREMENT,
|
||||||
),
|
),
|
||||||
NetatmoSensorEntityDescription(
|
NetatmoSensorEntityDescription(
|
||||||
key="windstrength",
|
key="windstrength",
|
||||||
|
@ -182,6 +193,7 @@ SENSOR_TYPES: tuple[NetatmoSensorEntityDescription, ...] = (
|
||||||
entity_registry_enabled_default=True,
|
entity_registry_enabled_default=True,
|
||||||
unit_of_measurement=SPEED_KILOMETERS_PER_HOUR,
|
unit_of_measurement=SPEED_KILOMETERS_PER_HOUR,
|
||||||
icon="mdi:weather-windy",
|
icon="mdi:weather-windy",
|
||||||
|
state_class=STATE_CLASS_MEASUREMENT,
|
||||||
),
|
),
|
||||||
NetatmoSensorEntityDescription(
|
NetatmoSensorEntityDescription(
|
||||||
key="gustangle",
|
key="gustangle",
|
||||||
|
@ -197,6 +209,7 @@ SENSOR_TYPES: tuple[NetatmoSensorEntityDescription, ...] = (
|
||||||
entity_registry_enabled_default=False,
|
entity_registry_enabled_default=False,
|
||||||
unit_of_measurement=DEGREE,
|
unit_of_measurement=DEGREE,
|
||||||
icon="mdi:compass-outline",
|
icon="mdi:compass-outline",
|
||||||
|
state_class=STATE_CLASS_MEASUREMENT,
|
||||||
),
|
),
|
||||||
NetatmoSensorEntityDescription(
|
NetatmoSensorEntityDescription(
|
||||||
key="guststrength",
|
key="guststrength",
|
||||||
|
@ -205,6 +218,7 @@ SENSOR_TYPES: tuple[NetatmoSensorEntityDescription, ...] = (
|
||||||
entity_registry_enabled_default=False,
|
entity_registry_enabled_default=False,
|
||||||
unit_of_measurement=SPEED_KILOMETERS_PER_HOUR,
|
unit_of_measurement=SPEED_KILOMETERS_PER_HOUR,
|
||||||
icon="mdi:weather-windy",
|
icon="mdi:weather-windy",
|
||||||
|
state_class=STATE_CLASS_MEASUREMENT,
|
||||||
),
|
),
|
||||||
NetatmoSensorEntityDescription(
|
NetatmoSensorEntityDescription(
|
||||||
key="reachable",
|
key="reachable",
|
||||||
|
@ -227,6 +241,7 @@ SENSOR_TYPES: tuple[NetatmoSensorEntityDescription, ...] = (
|
||||||
entity_registry_enabled_default=False,
|
entity_registry_enabled_default=False,
|
||||||
unit_of_measurement=SIGNAL_STRENGTH_DECIBELS_MILLIWATT,
|
unit_of_measurement=SIGNAL_STRENGTH_DECIBELS_MILLIWATT,
|
||||||
device_class=DEVICE_CLASS_SIGNAL_STRENGTH,
|
device_class=DEVICE_CLASS_SIGNAL_STRENGTH,
|
||||||
|
state_class=STATE_CLASS_MEASUREMENT,
|
||||||
),
|
),
|
||||||
NetatmoSensorEntityDescription(
|
NetatmoSensorEntityDescription(
|
||||||
key="wifi_status",
|
key="wifi_status",
|
||||||
|
@ -242,6 +257,7 @@ SENSOR_TYPES: tuple[NetatmoSensorEntityDescription, ...] = (
|
||||||
entity_registry_enabled_default=False,
|
entity_registry_enabled_default=False,
|
||||||
unit_of_measurement=SIGNAL_STRENGTH_DECIBELS_MILLIWATT,
|
unit_of_measurement=SIGNAL_STRENGTH_DECIBELS_MILLIWATT,
|
||||||
device_class=DEVICE_CLASS_SIGNAL_STRENGTH,
|
device_class=DEVICE_CLASS_SIGNAL_STRENGTH,
|
||||||
|
state_class=STATE_CLASS_MEASUREMENT,
|
||||||
),
|
),
|
||||||
NetatmoSensorEntityDescription(
|
NetatmoSensorEntityDescription(
|
||||||
key="health_idx",
|
key="health_idx",
|
||||||
|
|
Loading…
Add table
Reference in a new issue