Use Volume Flow Rate device class in DROP connect (#113528)

This commit is contained in:
Joost Lekkerkerker 2024-03-15 19:12:04 +01:00 committed by GitHub
parent 5b5ff92a05
commit b6a06f49b7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -20,6 +20,7 @@ from homeassistant.const import (
UnitOfPressure, UnitOfPressure,
UnitOfTemperature, UnitOfTemperature,
UnitOfVolume, UnitOfVolume,
UnitOfVolumeFlowRate,
) )
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.helpers.entity_platform import AddEntitiesCallback
@ -70,7 +71,8 @@ SENSORS: list[DROPSensorEntityDescription] = [
DROPSensorEntityDescription( DROPSensorEntityDescription(
key=CURRENT_FLOW_RATE, key=CURRENT_FLOW_RATE,
translation_key=CURRENT_FLOW_RATE, translation_key=CURRENT_FLOW_RATE,
native_unit_of_measurement="gpm", device_class=SensorDeviceClass.VOLUME_FLOW_RATE,
native_unit_of_measurement=UnitOfVolumeFlowRate.GALLONS_PER_MINUTE,
suggested_display_precision=1, suggested_display_precision=1,
value_fn=lambda device: device.drop_api.current_flow_rate(), value_fn=lambda device: device.drop_api.current_flow_rate(),
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
@ -78,7 +80,8 @@ SENSORS: list[DROPSensorEntityDescription] = [
DROPSensorEntityDescription( DROPSensorEntityDescription(
key=PEAK_FLOW_RATE, key=PEAK_FLOW_RATE,
translation_key=PEAK_FLOW_RATE, translation_key=PEAK_FLOW_RATE,
native_unit_of_measurement="gpm", device_class=SensorDeviceClass.VOLUME_FLOW_RATE,
native_unit_of_measurement=UnitOfVolumeFlowRate.GALLONS_PER_MINUTE,
suggested_display_precision=1, suggested_display_precision=1,
value_fn=lambda device: device.drop_api.peak_flow_rate(), value_fn=lambda device: device.drop_api.peak_flow_rate(),
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,