Add state class to Aurora ABB Solar PV (#52108)

This commit is contained in:
Franck Nijhof 2021-06-23 19:43:57 +02:00 committed by GitHub
parent b9e6a6b3b8
commit 0ddd858b4b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,7 +5,11 @@ import logging
from aurorapy.client import AuroraError, AuroraSerialClient
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
from homeassistant.components.sensor import (
PLATFORM_SCHEMA,
STATE_CLASS_MEASUREMENT,
SensorEntity,
)
from homeassistant.const import (
CONF_ADDRESS,
CONF_DEVICE,
@ -46,6 +50,8 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
class AuroraABBSolarPVMonitorSensor(SensorEntity):
"""Representation of a Sensor."""
_attr_state_class = STATE_CLASS_MEASUREMENT
def __init__(self, client, name, typename):
"""Initialize the sensor."""
self._name = f"{name} {typename}"