diff --git a/homeassistant/components/ring/sensor.py b/homeassistant/components/ring/sensor.py index 356eb1c2b9b13..32382a2f9299f 100644 --- a/homeassistant/components/ring/sensor.py +++ b/homeassistant/components/ring/sensor.py @@ -10,6 +10,7 @@ SensorDeviceClass, SensorEntity, SensorEntityDescription, + SensorStateClass, ) from homeassistant.config_entries import ConfigEntry from homeassistant.const import ( @@ -162,6 +163,7 @@ class RingSensorEntityDescription(SensorEntityDescription, RingRequiredKeysMixin category=["doorbots", "authorized_doorbots", "stickup_cams"], native_unit_of_measurement=PERCENTAGE, device_class=SensorDeviceClass.BATTERY, + state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, cls=RingSensor, ), diff --git a/tests/components/ring/test_sensor.py b/tests/components/ring/test_sensor.py index 5fd50f69c1374..34b6295b740bd 100644 --- a/tests/components/ring/test_sensor.py +++ b/tests/components/ring/test_sensor.py @@ -5,6 +5,7 @@ import requests_mock from homeassistant.components.ring.const import SCAN_INTERVAL +from homeassistant.components.sensor import ATTR_STATE_CLASS, SensorStateClass from homeassistant.const import Platform from homeassistant.core import HomeAssistant @@ -22,10 +23,17 @@ async def test_sensor(hass: HomeAssistant, requests_mock: requests_mock.Mocker) front_battery_state = hass.states.get("sensor.front_battery") assert front_battery_state is not None assert front_battery_state.state == "80" + assert ( + front_battery_state.attributes[ATTR_STATE_CLASS] == SensorStateClass.MEASUREMENT + ) front_door_battery_state = hass.states.get("sensor.front_door_battery") assert front_door_battery_state is not None assert front_door_battery_state.state == "100" + assert ( + front_door_battery_state.attributes[ATTR_STATE_CLASS] + == SensorStateClass.MEASUREMENT + ) downstairs_volume_state = hass.states.get("sensor.downstairs_volume") assert downstairs_volume_state is not None