Skip to content

Commit 1297809

Browse files
authored
Add missing state class to Alexa Devices sensors (home-assistant#151296)
1 parent 210a9ad commit 1297809

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

homeassistant/components/alexa_devices/sensor.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
SensorDeviceClass,
1313
SensorEntity,
1414
SensorEntityDescription,
15+
SensorStateClass,
1516
)
1617
from homeassistant.const import LIGHT_LUX, UnitOfTemperature
1718
from homeassistant.core import HomeAssistant
@@ -41,11 +42,13 @@ class AmazonSensorEntityDescription(SensorEntityDescription):
4142
if device.sensors[_key].scale == "CELSIUS"
4243
else UnitOfTemperature.FAHRENHEIT
4344
),
45+
state_class=SensorStateClass.MEASUREMENT,
4446
),
4547
AmazonSensorEntityDescription(
4648
key="illuminance",
4749
device_class=SensorDeviceClass.ILLUMINANCE,
4850
native_unit_of_measurement=LIGHT_LUX,
51+
state_class=SensorStateClass.MEASUREMENT,
4952
),
5053
)
5154

tests/components/alexa_devices/snapshots/test_sensor.ambr

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
'aliases': set({
55
}),
66
'area_id': None,
7-
'capabilities': None,
7+
'capabilities': dict({
8+
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
9+
}),
810
'config_entry_id': <ANY>,
911
'config_subentry_id': <ANY>,
1012
'device_class': None,
@@ -42,6 +44,7 @@
4244
'attributes': ReadOnlyDict({
4345
'device_class': 'temperature',
4446
'friendly_name': 'Echo Test Temperature',
47+
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
4548
'unit_of_measurement': <UnitOfTemperature.CELSIUS: '°C'>,
4649
}),
4750
'context': <ANY>,

0 commit comments

Comments
 (0)