Use new enums in hydrawise ()

Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
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
homeassistant/components/hydrawise

View file

@ -6,9 +6,8 @@ import logging
import voluptuous as vol import voluptuous as vol
from homeassistant.components.binary_sensor import ( from homeassistant.components.binary_sensor import (
DEVICE_CLASS_CONNECTIVITY,
DEVICE_CLASS_MOISTURE,
PLATFORM_SCHEMA, PLATFORM_SCHEMA,
BinarySensorDeviceClass,
BinarySensorEntity, BinarySensorEntity,
BinarySensorEntityDescription, BinarySensorEntityDescription,
) )
@ -22,14 +21,14 @@ _LOGGER = logging.getLogger(__name__)
BINARY_SENSOR_STATUS = BinarySensorEntityDescription( BINARY_SENSOR_STATUS = BinarySensorEntityDescription(
key="status", key="status",
name="Status", name="Status",
device_class=DEVICE_CLASS_CONNECTIVITY, device_class=BinarySensorDeviceClass.CONNECTIVITY,
) )
BINARY_SENSOR_TYPES: tuple[BinarySensorEntityDescription, ...] = ( BINARY_SENSOR_TYPES: tuple[BinarySensorEntityDescription, ...] = (
BinarySensorEntityDescription( BinarySensorEntityDescription(
key="is_watering", key="is_watering",
name="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 ( from homeassistant.components.sensor import (
PLATFORM_SCHEMA, PLATFORM_SCHEMA,
SensorDeviceClass,
SensorEntity, SensorEntity,
SensorEntityDescription, SensorEntityDescription,
) )
from homeassistant.const import ( from homeassistant.const import CONF_MONITORED_CONDITIONS, TIME_MINUTES
CONF_MONITORED_CONDITIONS,
DEVICE_CLASS_TIMESTAMP,
TIME_MINUTES,
)
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
from homeassistant.util import dt from homeassistant.util import dt
@ -26,7 +23,7 @@ SENSOR_TYPES: tuple[SensorEntityDescription, ...] = (
SensorEntityDescription( SensorEntityDescription(
key="next_cycle", key="next_cycle",
name="Next Cycle", name="Next Cycle",
device_class=DEVICE_CLASS_TIMESTAMP, device_class=SensorDeviceClass.TIMESTAMP,
), ),
SensorEntityDescription( SensorEntityDescription(
key="watering_time", key="watering_time",

View file

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