Use new DeviceClass enums in econet (#61375)

Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
epenet 2021-12-10 08:57:31 +01:00 committed by GitHub
parent 728f511627
commit f59966f8ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 16 deletions

View File

@ -4,10 +4,7 @@ from __future__ import annotations
from pyeconet.equipment import EquipmentType from pyeconet.equipment import EquipmentType
from homeassistant.components.binary_sensor import ( from homeassistant.components.binary_sensor import (
DEVICE_CLASS_LOCK, BinarySensorDeviceClass,
DEVICE_CLASS_OPENING,
DEVICE_CLASS_POWER,
DEVICE_CLASS_SOUND,
BinarySensorEntity, BinarySensorEntity,
BinarySensorEntityDescription, BinarySensorEntityDescription,
) )
@ -19,22 +16,22 @@ BINARY_SENSOR_TYPES: tuple[BinarySensorEntityDescription, ...] = (
BinarySensorEntityDescription( BinarySensorEntityDescription(
key="shutoff_valve_open", key="shutoff_valve_open",
name="shutoff_valve", name="shutoff_valve",
device_class=DEVICE_CLASS_OPENING, device_class=BinarySensorDeviceClass.OPENING,
), ),
BinarySensorEntityDescription( BinarySensorEntityDescription(
key="running", key="running",
name="running", name="running",
device_class=DEVICE_CLASS_POWER, device_class=BinarySensorDeviceClass.POWER,
), ),
BinarySensorEntityDescription( BinarySensorEntityDescription(
key="screen_locked", key="screen_locked",
name="screen_locked", name="screen_locked",
device_class=DEVICE_CLASS_LOCK, device_class=BinarySensorDeviceClass.LOCK,
), ),
BinarySensorEntityDescription( BinarySensorEntityDescription(
key="beep_enabled", key="beep_enabled",
name="beep_enabled", name="beep_enabled",
device_class=DEVICE_CLASS_SOUND, device_class=BinarySensorDeviceClass.SOUND,
), ),
) )

View File

@ -1,13 +1,8 @@
"""Support for Rheem EcoNet water heaters.""" """Support for Rheem EcoNet water heaters."""
from pyeconet.equipment import EquipmentType from pyeconet.equipment import EquipmentType
from homeassistant.components.sensor import SensorEntity from homeassistant.components.sensor import SensorDeviceClass, SensorEntity
from homeassistant.const import ( from homeassistant.const import ENERGY_KILO_WATT_HOUR, PERCENTAGE, VOLUME_GALLONS
DEVICE_CLASS_SIGNAL_STRENGTH,
ENERGY_KILO_WATT_HOUR,
PERCENTAGE,
VOLUME_GALLONS,
)
from . import EcoNetEntity from . import EcoNetEntity
from .const import DOMAIN, EQUIPMENT from .const import DOMAIN, EQUIPMENT
@ -44,7 +39,7 @@ SENSOR_NAMES_TO_UNIT_OF_MEASUREMENT = {
WATER_USAGE_TODAY: VOLUME_GALLONS, WATER_USAGE_TODAY: VOLUME_GALLONS,
POWER_USAGE_TODAY: None, # Depends on unit type POWER_USAGE_TODAY: None, # Depends on unit type
ALERT_COUNT: None, ALERT_COUNT: None,
WIFI_SIGNAL: DEVICE_CLASS_SIGNAL_STRENGTH, WIFI_SIGNAL: SensorDeviceClass.SIGNAL_STRENGTH,
RUNNING_STATE: None, # This is just a string RUNNING_STATE: None, # This is just a string
} }