Add state class to Nettigo Air Monitor sensors (#50959)

This commit is contained in:
Maciej Bieniek 2021-05-26 09:36:37 +02:00 committed by GitHub
parent d5a9419fb7
commit 41a940f644
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 38 additions and 3 deletions

View file

@ -4,7 +4,7 @@ from __future__ import annotations
from datetime import timedelta
from typing import Any
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_DEVICE_CLASS, ATTR_ICON
from homeassistant.core import HomeAssistant
@ -45,7 +45,8 @@ class NAMSensor(CoordinatorEntity, SensorEntity):
"""Initialize."""
super().__init__(coordinator)
self.sensor_type = sensor_type
self._description = SENSORS[self.sensor_type]
self._description = SENSORS[sensor_type]
self._attr_state_class = SENSORS[sensor_type][ATTR_STATE_CLASS]
@property
def name(self) -> str: