Mark temperature sensors as STATE_CLASS_MEASUREMENT (#50889)

* Mark temperature sensors as STATE_CLASS_MEASUREMENT

* Fix broadlink tests

* Tweak Hue changes
This commit is contained in:
Erik Montnemery 2021-05-21 11:44:34 +02:00 committed by GitHub
parent 6f26687aa7
commit 73d7a754e8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 113 additions and 19 deletions

View file

@ -6,7 +6,7 @@ from aiohue.sensors import (
TYPE_ZLL_TEMPERATURE,
)
from homeassistant.components.sensor import SensorEntity
from homeassistant.components.sensor import STATE_CLASS_MEASUREMENT, SensorEntity
from homeassistant.const import (
DEVICE_CLASS_BATTERY,
DEVICE_CLASS_ILLUMINANCE,
@ -87,6 +87,11 @@ class HueTemperature(GenericHueGaugeSensorEntity):
return self.sensor.temperature / 100
@property
def state_class(self):
"""Return the state class of the sensor."""
return STATE_CLASS_MEASUREMENT
class HueBattery(GenericHueSensor, SensorEntity):
"""Battery class for when a batt-powered device is only represented as an event."""