Skip to content

Commit

Permalink
Entity derived from SensorEntity
Browse files Browse the repository at this point in the history
In order to get the state_class attribute working. Seems like
this needs a SensorEntity instead of an Entity.
  • Loading branch information
feibeck authored and Bouni committed May 19, 2022
1 parent 262a730 commit 4b4d9f9
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions custom_components/luxtronik/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@

import homeassistant.helpers.config_validation as cv
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA, STATE_CLASSES_SCHEMA
from homeassistant.components.sensor import PLATFORM_SCHEMA, STATE_CLASSES_SCHEMA, SensorEntity
from homeassistant.const import (
CONF_FRIENDLY_NAME,
CONF_ICON,
CONF_ID,
CONF_SENSORS,
)
from homeassistant.helpers.entity import Entity
from homeassistant.util import slugify

from . import DOMAIN, ENTITY_ID_FORMAT
Expand Down Expand Up @@ -82,7 +81,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
add_entities(entities, True)


class LuxtronikSensor(Entity):
class LuxtronikSensor(SensorEntity):
"""Representation of a Luxtronik sensor."""

def __init__(self, luxtronik, sensor, friendly_name, icon, state_class):
Expand Down

0 comments on commit 4b4d9f9

Please sign in to comment.