Use EntityFeature enum in components (t**) (#69457)

This commit is contained in:
epenet 2022-04-07 14:07:27 +02:00 committed by GitHub
parent 889e1f4442
commit bbf19582bb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 102 additions and 127 deletions

View file

@ -5,11 +5,9 @@ from tuya_iot import TuyaDevice, TuyaDeviceManager
from homeassistant.backports.enum import StrEnum
from homeassistant.components.alarm_control_panel import (
SUPPORT_ALARM_ARM_AWAY,
SUPPORT_ALARM_ARM_HOME,
SUPPORT_ALARM_TRIGGER,
AlarmControlPanelEntity,
AlarmControlPanelEntityDescription,
AlarmControlPanelEntityFeature,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import (
@ -109,13 +107,13 @@ class TuyaAlarmEntity(TuyaEntity, AlarmControlPanelEntity):
description.key, dptype=DPType.ENUM, prefer_function=True
):
if Mode.HOME in supported_modes.range:
self._attr_supported_features |= SUPPORT_ALARM_ARM_HOME
self._attr_supported_features |= AlarmControlPanelEntityFeature.ARM_HOME
if Mode.ARM in supported_modes.range:
self._attr_supported_features |= SUPPORT_ALARM_ARM_AWAY
self._attr_supported_features |= AlarmControlPanelEntityFeature.ARM_AWAY
if Mode.SOS in supported_modes.range:
self._attr_supported_features |= SUPPORT_ALARM_TRIGGER
self._attr_supported_features |= AlarmControlPanelEntityFeature.TRIGGER
@property
def state(self):