From c2820e3cdee4847350903261b9177e6b46039f70 Mon Sep 17 00:00:00 2001 From: Jan-Philipp Benecke Date: Sat, 20 Jan 2024 16:03:46 +0100 Subject: [PATCH] Use right state class for volume and timestamp sensor in bthome (#107675) --- homeassistant/components/bthome/sensor.py | 5 ++--- tests/components/bthome/test_sensor.py | 6 +++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/homeassistant/components/bthome/sensor.py b/homeassistant/components/bthome/sensor.py index eb3a177804c..17f8f6c7a3c 100644 --- a/homeassistant/components/bthome/sensor.py +++ b/homeassistant/components/bthome/sensor.py @@ -278,7 +278,6 @@ SENSOR_DESCRIPTIONS = { ): SensorEntityDescription( key=str(BTHomeSensorDeviceClass.TIMESTAMP), device_class=SensorDeviceClass.TIMESTAMP, - state_class=SensorStateClass.MEASUREMENT, ), # UV index (-) ( @@ -316,7 +315,7 @@ SENSOR_DESCRIPTIONS = { key=f"{BTHomeSensorDeviceClass.VOLUME}_{Units.VOLUME_LITERS}", device_class=SensorDeviceClass.VOLUME, native_unit_of_measurement=UnitOfVolume.LITERS, - state_class=SensorStateClass.MEASUREMENT, + state_class=SensorStateClass.TOTAL, ), # Volume (mL) ( @@ -326,7 +325,7 @@ SENSOR_DESCRIPTIONS = { key=f"{BTHomeSensorDeviceClass.VOLUME}_{Units.VOLUME_MILLILITERS}", device_class=SensorDeviceClass.VOLUME, native_unit_of_measurement=UnitOfVolume.MILLILITERS, - state_class=SensorStateClass.MEASUREMENT, + state_class=SensorStateClass.TOTAL, ), # Volume Flow Rate (m3/hour) ( diff --git a/tests/components/bthome/test_sensor.py b/tests/components/bthome/test_sensor.py index 0220bf59d2c..481520f0434 100644 --- a/tests/components/bthome/test_sensor.py +++ b/tests/components/bthome/test_sensor.py @@ -819,7 +819,7 @@ async def test_v1_sensors( "sensor_entity": "sensor.test_device_18b2_volume", "friendly_name": "Test Device 18B2 Volume", "unit_of_measurement": "L", - "state_class": "measurement", + "state_class": "total", "expected_state": "2215.1", }, ], @@ -836,7 +836,7 @@ async def test_v1_sensors( "sensor_entity": "sensor.test_device_18b2_volume", "friendly_name": "Test Device 18B2 Volume", "unit_of_measurement": "mL", - "state_class": "measurement", + "state_class": "total", "expected_state": "34780", }, ], @@ -869,7 +869,7 @@ async def test_v1_sensors( { "sensor_entity": "sensor.test_device_18b2_timestamp", "friendly_name": "Test Device 18B2 Timestamp", - "state_class": "measurement", + "state_class": None, "expected_state": "2023-05-14T19:41:17+00:00", }, ],