Fix flo sensor native unit (#110745)

* use flow rate unit enums for proper unit conversions

* update typo for device class
This commit is contained in:
Kanchana M 2024-02-16 15:18:27 -07:00 committed by GitHub
parent 5adb9240c5
commit bc5ec4f2a3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -12,6 +12,7 @@ from homeassistant.const import (
UnitOfPressure,
UnitOfTemperature,
UnitOfVolume,
UnitOfVolumeFlowRate,
)
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback
@ -98,8 +99,9 @@ class FloCurrentFlowRateSensor(FloEntity, SensorEntity):
"""Monitors the current water flow rate."""
_attr_icon = GAUGE_ICON
_attr_native_unit_of_measurement = "gpm"
_attr_native_unit_of_measurement = UnitOfVolumeFlowRate.GALLONS_PER_MINUTE
_attr_state_class: SensorStateClass = SensorStateClass.MEASUREMENT
_attr_device_class = SensorDeviceClass.VOLUME_FLOW_RATE
_attr_translation_key = "current_flow_rate"
def __init__(self, device):