Add state_class = MEASUREMENT
to Derivative sensor (#88408)
* Add `state_class = MEASUREMENT` to Derivative sensor One line change per title. * Update sensor.py * Update tests for Derivative Sensor
This commit is contained in:
parent
bee79e351e
commit
fa2e7aa592
2 changed files with 8 additions and 1 deletions
|
@ -8,7 +8,11 @@ from typing import TYPE_CHECKING
|
|||
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
|
||||
from homeassistant.components.sensor import (
|
||||
PLATFORM_SCHEMA,
|
||||
SensorEntity,
|
||||
SensorStateClass,
|
||||
)
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import (
|
||||
ATTR_UNIT_OF_MEASUREMENT,
|
||||
|
@ -131,6 +135,7 @@ class DerivativeSensor(RestoreEntity, SensorEntity):
|
|||
|
||||
_attr_icon = ICON
|
||||
_attr_should_poll = False
|
||||
_attr_state_class = SensorStateClass.MEASUREMENT
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue