Use right state class for volume and timestamp sensor in bthome (#107675)

pull/108592/head
Jan-Philipp Benecke 2024-01-20 16:03:46 +01:00 committed by GitHub
parent 1cb5bbf865
commit c2820e3cde
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 6 deletions

View File

@ -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)
(

View File

@ -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",
},
],