Use new enums in nx584 ()

pull/62130/head
epenet 2021-12-16 15:15:54 +01:00 committed by GitHub
parent b315877ad0
commit 5454c5467d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions
homeassistant/components/nx584

View File

@ -8,9 +8,9 @@ import requests
import voluptuous as vol import voluptuous as vol
from homeassistant.components.binary_sensor import ( from homeassistant.components.binary_sensor import (
DEVICE_CLASS_OPENING, DEVICE_CLASSES_SCHEMA as BINARY_SENSOR_DEVICE_CLASSES_SCHEMA,
DEVICE_CLASSES,
PLATFORM_SCHEMA, PLATFORM_SCHEMA,
BinarySensorDeviceClass,
BinarySensorEntity, BinarySensorEntity,
) )
from homeassistant.const import CONF_HOST, CONF_PORT from homeassistant.const import CONF_HOST, CONF_PORT
@ -25,7 +25,7 @@ DEFAULT_HOST = "localhost"
DEFAULT_PORT = "5007" DEFAULT_PORT = "5007"
DEFAULT_SSL = False DEFAULT_SSL = False
ZONE_TYPES_SCHEMA = vol.Schema({cv.positive_int: vol.In(DEVICE_CLASSES)}) ZONE_TYPES_SCHEMA = vol.Schema({cv.positive_int: BINARY_SENSOR_DEVICE_CLASSES_SCHEMA})
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend( PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
{ {
@ -61,7 +61,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
zone_sensors = { zone_sensors = {
zone["number"]: NX584ZoneSensor( zone["number"]: NX584ZoneSensor(
zone, zone_types.get(zone["number"], DEVICE_CLASS_OPENING) zone, zone_types.get(zone["number"], BinarySensorDeviceClass.OPENING)
) )
for zone in zones for zone in zones
if zone["number"] not in exclude if zone["number"] not in exclude