Use new DeviceClass constants in flo (#61440)

Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
epenet 2021-12-10 14:52:33 +01:00 committed by GitHub
parent 6677dd8507
commit 4d282eca6d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 12 deletions

View File

@ -2,7 +2,7 @@
from __future__ import annotations
from homeassistant.components.binary_sensor import (
DEVICE_CLASS_PROBLEM,
BinarySensorDeviceClass,
BinarySensorEntity,
)
@ -37,7 +37,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
class FloPendingAlertsBinarySensor(FloEntity, BinarySensorEntity):
"""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):
"""Initialize the pending alerts binary sensor."""
@ -63,7 +63,7 @@ class FloPendingAlertsBinarySensor(FloEntity, BinarySensorEntity):
class FloWaterDetectedBinarySensor(FloEntity, BinarySensorEntity):
"""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):
"""Initialize the pending alerts binary sensor."""

View File

@ -1,12 +1,8 @@
"""Support for Flo Water Monitor sensors."""
from __future__ import annotations
from homeassistant.components.sensor import SensorEntity
from homeassistant.components.sensor import SensorDeviceClass, SensorEntity
from homeassistant.const import (
DEVICE_CLASS_BATTERY,
DEVICE_CLASS_HUMIDITY,
DEVICE_CLASS_PRESSURE,
DEVICE_CLASS_TEMPERATURE,
PERCENTAGE,
PRESSURE_PSI,
TEMP_FAHRENHEIT,
@ -114,7 +110,7 @@ class FloCurrentFlowRateSensor(FloEntity, SensorEntity):
class FloTemperatureSensor(FloEntity, SensorEntity):
"""Monitors the temperature."""
_attr_device_class = DEVICE_CLASS_TEMPERATURE
_attr_device_class = SensorDeviceClass.TEMPERATURE
_attr_native_unit_of_measurement = TEMP_FAHRENHEIT
def __init__(self, name, device):
@ -133,7 +129,7 @@ class FloTemperatureSensor(FloEntity, SensorEntity):
class FloHumiditySensor(FloEntity, SensorEntity):
"""Monitors the humidity."""
_attr_device_class = DEVICE_CLASS_HUMIDITY
_attr_device_class = SensorDeviceClass.HUMIDITY
_attr_native_unit_of_measurement = PERCENTAGE
def __init__(self, device):
@ -152,7 +148,7 @@ class FloHumiditySensor(FloEntity, SensorEntity):
class FloPressureSensor(FloEntity, SensorEntity):
"""Monitors the water pressure."""
_attr_device_class = DEVICE_CLASS_PRESSURE
_attr_device_class = SensorDeviceClass.PRESSURE
_attr_native_unit_of_measurement = PRESSURE_PSI
def __init__(self, device):
@ -171,7 +167,7 @@ class FloPressureSensor(FloEntity, SensorEntity):
class FloBatterySensor(FloEntity, SensorEntity):
"""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
def __init__(self, device):