Use new enums in hydrawise (#61781)

Co-authored-by: epenet <epenet@users.noreply.github.com>
pull/61791/head
epenet 2021-12-14 13:06:55 +01:00 committed by GitHub
parent a28ce75a92
commit 237a8a8331
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 13 deletions

View File

@ -6,9 +6,8 @@ import logging
import voluptuous as vol
from homeassistant.components.binary_sensor import (
DEVICE_CLASS_CONNECTIVITY,
DEVICE_CLASS_MOISTURE,
PLATFORM_SCHEMA,
BinarySensorDeviceClass,
BinarySensorEntity,
BinarySensorEntityDescription,
)
@ -22,14 +21,14 @@ _LOGGER = logging.getLogger(__name__)
BINARY_SENSOR_STATUS = BinarySensorEntityDescription(
key="status",
name="Status",
device_class=DEVICE_CLASS_CONNECTIVITY,
device_class=BinarySensorDeviceClass.CONNECTIVITY,
)
BINARY_SENSOR_TYPES: tuple[BinarySensorEntityDescription, ...] = (
BinarySensorEntityDescription(
key="is_watering",
name="Watering",
device_class=DEVICE_CLASS_MOISTURE,
device_class=BinarySensorDeviceClass.MOISTURE,
),
)

View File

@ -7,14 +7,11 @@ import voluptuous as vol
from homeassistant.components.sensor import (
PLATFORM_SCHEMA,
SensorDeviceClass,
SensorEntity,
SensorEntityDescription,
)
from homeassistant.const import (
CONF_MONITORED_CONDITIONS,
DEVICE_CLASS_TIMESTAMP,
TIME_MINUTES,
)
from homeassistant.const import CONF_MONITORED_CONDITIONS, TIME_MINUTES
import homeassistant.helpers.config_validation as cv
from homeassistant.util import dt
@ -26,7 +23,7 @@ SENSOR_TYPES: tuple[SensorEntityDescription, ...] = (
SensorEntityDescription(
key="next_cycle",
name="Next Cycle",
device_class=DEVICE_CLASS_TIMESTAMP,
device_class=SensorDeviceClass.TIMESTAMP,
),
SensorEntityDescription(
key="watering_time",

View File

@ -6,8 +6,8 @@ import logging
import voluptuous as vol
from homeassistant.components.switch import (
DEVICE_CLASS_SWITCH,
PLATFORM_SCHEMA,
SwitchDeviceClass,
SwitchEntity,
SwitchEntityDescription,
)
@ -28,12 +28,12 @@ SWITCH_TYPES: tuple[SwitchEntityDescription, ...] = (
SwitchEntityDescription(
key="auto_watering",
name="Automatic Watering",
device_class=DEVICE_CLASS_SWITCH,
device_class=SwitchDeviceClass.SWITCH,
),
SwitchEntityDescription(
key="manual_watering",
name="Manual Watering",
device_class=DEVICE_CLASS_SWITCH,
device_class=SwitchDeviceClass.SWITCH,
),
)