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
|
@ -4,6 +4,7 @@ from math import sin
|
|||
import random
|
||||
from unittest.mock import patch
|
||||
|
||||
from homeassistant.components.sensor import ATTR_STATE_CLASS, SensorStateClass
|
||||
from homeassistant.const import UnitOfPower, UnitOfTime
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
@ -78,6 +79,7 @@ async def setup_tests(hass, config, times, values, expected_state):
|
|||
assert state is not None
|
||||
|
||||
assert round(float(state.state), config["sensor"]["round"]) == expected_state
|
||||
assert state.attributes.get(ATTR_STATE_CLASS) is SensorStateClass.MEASUREMENT
|
||||
|
||||
return state
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue