mirror of
https://github.com/home-assistant/core.git
synced 2025-07-25 14:17:45 +00:00
Use new DeviceClass constants in flo (#61440)
Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
parent
6677dd8507
commit
4d282eca6d
@ -2,7 +2,7 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from homeassistant.components.binary_sensor import (
|
from homeassistant.components.binary_sensor import (
|
||||||
DEVICE_CLASS_PROBLEM,
|
BinarySensorDeviceClass,
|
||||||
BinarySensorEntity,
|
BinarySensorEntity,
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -37,7 +37,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
|||||||
class FloPendingAlertsBinarySensor(FloEntity, BinarySensorEntity):
|
class FloPendingAlertsBinarySensor(FloEntity, BinarySensorEntity):
|
||||||
"""Binary sensor that reports on if there are any pending system alerts."""
|
"""Binary sensor that reports on if there are any pending system alerts."""
|
||||||
|
|
||||||
_attr_device_class = DEVICE_CLASS_PROBLEM
|
_attr_device_class = BinarySensorDeviceClass.PROBLEM
|
||||||
|
|
||||||
def __init__(self, device):
|
def __init__(self, device):
|
||||||
"""Initialize the pending alerts binary sensor."""
|
"""Initialize the pending alerts binary sensor."""
|
||||||
@ -63,7 +63,7 @@ class FloPendingAlertsBinarySensor(FloEntity, BinarySensorEntity):
|
|||||||
class FloWaterDetectedBinarySensor(FloEntity, BinarySensorEntity):
|
class FloWaterDetectedBinarySensor(FloEntity, BinarySensorEntity):
|
||||||
"""Binary sensor that reports if water is detected (for leak detectors)."""
|
"""Binary sensor that reports if water is detected (for leak detectors)."""
|
||||||
|
|
||||||
_attr_device_class = DEVICE_CLASS_PROBLEM
|
_attr_device_class = BinarySensorDeviceClass.PROBLEM
|
||||||
|
|
||||||
def __init__(self, device):
|
def __init__(self, device):
|
||||||
"""Initialize the pending alerts binary sensor."""
|
"""Initialize the pending alerts binary sensor."""
|
||||||
|
@ -1,12 +1,8 @@
|
|||||||
"""Support for Flo Water Monitor sensors."""
|
"""Support for Flo Water Monitor sensors."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from homeassistant.components.sensor import SensorEntity
|
from homeassistant.components.sensor import SensorDeviceClass, SensorEntity
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
DEVICE_CLASS_BATTERY,
|
|
||||||
DEVICE_CLASS_HUMIDITY,
|
|
||||||
DEVICE_CLASS_PRESSURE,
|
|
||||||
DEVICE_CLASS_TEMPERATURE,
|
|
||||||
PERCENTAGE,
|
PERCENTAGE,
|
||||||
PRESSURE_PSI,
|
PRESSURE_PSI,
|
||||||
TEMP_FAHRENHEIT,
|
TEMP_FAHRENHEIT,
|
||||||
@ -114,7 +110,7 @@ class FloCurrentFlowRateSensor(FloEntity, SensorEntity):
|
|||||||
class FloTemperatureSensor(FloEntity, SensorEntity):
|
class FloTemperatureSensor(FloEntity, SensorEntity):
|
||||||
"""Monitors the temperature."""
|
"""Monitors the temperature."""
|
||||||
|
|
||||||
_attr_device_class = DEVICE_CLASS_TEMPERATURE
|
_attr_device_class = SensorDeviceClass.TEMPERATURE
|
||||||
_attr_native_unit_of_measurement = TEMP_FAHRENHEIT
|
_attr_native_unit_of_measurement = TEMP_FAHRENHEIT
|
||||||
|
|
||||||
def __init__(self, name, device):
|
def __init__(self, name, device):
|
||||||
@ -133,7 +129,7 @@ class FloTemperatureSensor(FloEntity, SensorEntity):
|
|||||||
class FloHumiditySensor(FloEntity, SensorEntity):
|
class FloHumiditySensor(FloEntity, SensorEntity):
|
||||||
"""Monitors the humidity."""
|
"""Monitors the humidity."""
|
||||||
|
|
||||||
_attr_device_class = DEVICE_CLASS_HUMIDITY
|
_attr_device_class = SensorDeviceClass.HUMIDITY
|
||||||
_attr_native_unit_of_measurement = PERCENTAGE
|
_attr_native_unit_of_measurement = PERCENTAGE
|
||||||
|
|
||||||
def __init__(self, device):
|
def __init__(self, device):
|
||||||
@ -152,7 +148,7 @@ class FloHumiditySensor(FloEntity, SensorEntity):
|
|||||||
class FloPressureSensor(FloEntity, SensorEntity):
|
class FloPressureSensor(FloEntity, SensorEntity):
|
||||||
"""Monitors the water pressure."""
|
"""Monitors the water pressure."""
|
||||||
|
|
||||||
_attr_device_class = DEVICE_CLASS_PRESSURE
|
_attr_device_class = SensorDeviceClass.PRESSURE
|
||||||
_attr_native_unit_of_measurement = PRESSURE_PSI
|
_attr_native_unit_of_measurement = PRESSURE_PSI
|
||||||
|
|
||||||
def __init__(self, device):
|
def __init__(self, device):
|
||||||
@ -171,7 +167,7 @@ class FloPressureSensor(FloEntity, SensorEntity):
|
|||||||
class FloBatterySensor(FloEntity, SensorEntity):
|
class FloBatterySensor(FloEntity, SensorEntity):
|
||||||
"""Monitors the battery level for battery-powered leak detectors."""
|
"""Monitors the battery level for battery-powered leak detectors."""
|
||||||
|
|
||||||
_attr_device_class = DEVICE_CLASS_BATTERY
|
_attr_device_class = SensorDeviceClass.BATTERY
|
||||||
_attr_native_unit_of_measurement = PERCENTAGE
|
_attr_native_unit_of_measurement = PERCENTAGE
|
||||||
|
|
||||||
def __init__(self, device):
|
def __init__(self, device):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user