mirror of
https://github.com/home-assistant/core.git
synced 2025-04-26 18:27:51 +00:00
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:
parent
5adb9240c5
commit
bc5ec4f2a3
@ -12,6 +12,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
|
||||||
@ -98,8 +99,9 @@ class FloCurrentFlowRateSensor(FloEntity, SensorEntity):
|
|||||||
"""Monitors the current water flow rate."""
|
"""Monitors the current water flow rate."""
|
||||||
|
|
||||||
_attr_icon = GAUGE_ICON
|
_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_state_class: SensorStateClass = SensorStateClass.MEASUREMENT
|
||||||
|
_attr_device_class = SensorDeviceClass.VOLUME_FLOW_RATE
|
||||||
_attr_translation_key = "current_flow_rate"
|
_attr_translation_key = "current_flow_rate"
|
||||||
|
|
||||||
def __init__(self, device):
|
def __init__(self, device):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user