mirror of
https://github.com/home-assistant/core
synced 2024-09-06 10:29:55 +02:00
Add state class to The Energy Detective TED5000 (#52109)
This commit is contained in:
parent
0ddd858b4b
commit
927b74b4a2
@ -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…
Reference in New Issue
Block a user