Use new enums in spc (#62384)

Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
epenet 2021-12-20 14:18:48 +01:00 committed by GitHub
parent c18c58f560
commit c7a3a0da9f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,9 +2,7 @@
from pyspcwebgw.const import ZoneInput, ZoneType from pyspcwebgw.const import ZoneInput, ZoneType
from homeassistant.components.binary_sensor import ( from homeassistant.components.binary_sensor import (
DEVICE_CLASS_MOTION, BinarySensorDeviceClass,
DEVICE_CLASS_OPENING,
DEVICE_CLASS_SMOKE,
BinarySensorEntity, BinarySensorEntity,
) )
from homeassistant.core import callback from homeassistant.core import callback
@ -15,9 +13,9 @@ from . import DATA_API, SIGNAL_UPDATE_SENSOR
def _get_device_class(zone_type): def _get_device_class(zone_type):
return { return {
ZoneType.ALARM: DEVICE_CLASS_MOTION, ZoneType.ALARM: BinarySensorDeviceClass.MOTION,
ZoneType.ENTRY_EXIT: DEVICE_CLASS_OPENING, ZoneType.ENTRY_EXIT: BinarySensorDeviceClass.OPENING,
ZoneType.FIRE: DEVICE_CLASS_SMOKE, ZoneType.FIRE: BinarySensorDeviceClass.SMOKE,
ZoneType.TECHNICAL: "power", ZoneType.TECHNICAL: "power",
}.get(zone_type) }.get(zone_type)