Add support for state class for Airly sensor (#51285)

This commit is contained in:
Maciej Bieniek
2021-05-31 16:00:58 +02:00
committed by GitHub
parent edcae74330
commit c9178e58b5
4 changed files with 13 additions and 1 deletions

View File

@@ -3,7 +3,7 @@ from __future__ import annotations
from typing import Any, cast
from homeassistant.components.sensor import SensorEntity
from homeassistant.components.sensor import ATTR_STATE_CLASS, SensorEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import (
ATTR_ATTRIBUTION,
@@ -66,6 +66,7 @@ class AirlySensor(CoordinatorEntity, SensorEntity):
self._state = None
self._unit_of_measurement = None
self._attrs = {ATTR_ATTRIBUTION: ATTRIBUTION}
self._attr_state_class = self._description[ATTR_STATE_CLASS]
@property
def name(self) -> str: