Add state class to The Energy Detective TED5000 (#52109)
This commit is contained in:
parent
0ddd858b4b
commit
927b74b4a2
1 changed files with 7 additions and 1 deletions
|
@ -7,7 +7,11 @@ import requests
|
|||
import voluptuous as vol
|
||||
import xmltodict
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||
from homeassistant.components.sensor import (
|
||||
PLATFORM_SCHEMA,
|
||||
STATE_CLASS_MEASUREMENT,
|
||||
SensorEntity,
|
||||
)
|
||||
from homeassistant.const import CONF_HOST, CONF_NAME, CONF_PORT, POWER_WATT, VOLT
|
||||
from homeassistant.helpers import config_validation as cv
|
||||
from homeassistant.util import Throttle
|
||||
|
@ -52,6 +56,8 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
class Ted5000Sensor(SensorEntity):
|
||||
"""Implementation of a Ted5000 sensor."""
|
||||
|
||||
_attr_state_class = STATE_CLASS_MEASUREMENT
|
||||
|
||||
def __init__(self, gateway, name, mtu, unit):
|
||||
"""Initialize the sensor."""
|
||||
units = {POWER_WATT: "power", VOLT: "voltage"}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue