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 homeassistant.components.binary_sensor import (
DEVICE_CLASS_LOCK,
DEVICE_CLASS_OPENING,
DEVICE_CLASS_POWER,
DEVICE_CLASS_SOUND,
BinarySensorDeviceClass,
BinarySensorEntity,
BinarySensorEntityDescription,
)
@ -19,22 +16,22 @@ BINARY_SENSOR_TYPES: tuple[BinarySensorEntityDescription, ...] = (
BinarySensorEntityDescription(
key="shutoff_valve_open",
name="shutoff_valve",
device_class=DEVICE_CLASS_OPENING,
device_class=BinarySensorDeviceClass.OPENING,
),
BinarySensorEntityDescription(
key="running",
name="running",
device_class=DEVICE_CLASS_POWER,
device_class=BinarySensorDeviceClass.POWER,
),
BinarySensorEntityDescription(
key="screen_locked",
name="screen_locked",
device_class=DEVICE_CLASS_LOCK,
device_class=BinarySensorDeviceClass.LOCK,
),
BinarySensorEntityDescription(
key="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."""
from pyeconet.equipment import EquipmentType
from homeassistant.components.sensor import SensorEntity
from homeassistant.const import (
DEVICE_CLASS_SIGNAL_STRENGTH,
ENERGY_KILO_WATT_HOUR,
PERCENTAGE,
VOLUME_GALLONS,
)
from homeassistant.components.sensor import SensorDeviceClass, SensorEntity
from homeassistant.const import ENERGY_KILO_WATT_HOUR, PERCENTAGE, VOLUME_GALLONS
from . import EcoNetEntity
from .const import DOMAIN, EQUIPMENT
@ -44,7 +39,7 @@ SENSOR_NAMES_TO_UNIT_OF_MEASUREMENT = {
WATER_USAGE_TODAY: VOLUME_GALLONS,
POWER_USAGE_TODAY: None, # Depends on unit type
ALERT_COUNT: None,
WIFI_SIGNAL: DEVICE_CLASS_SIGNAL_STRENGTH,
WIFI_SIGNAL: SensorDeviceClass.SIGNAL_STRENGTH,
RUNNING_STATE: None, # This is just a string
}