Use attributes in lupusec alarm (#74109)

This commit is contained in:
epenet 2022-06-28 13:05:30 +02:00 committed by GitHub
parent 45cdfa1049
commit 389664e37c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -19,8 +19,6 @@ from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
from . import DOMAIN as LUPUSEC_DOMAIN, LupusecDevice from . import DOMAIN as LUPUSEC_DOMAIN, LupusecDevice
ICON = "mdi:security"
SCAN_INTERVAL = timedelta(seconds=2) SCAN_INTERVAL = timedelta(seconds=2)
@ -44,18 +42,14 @@ def setup_platform(
class LupusecAlarm(LupusecDevice, AlarmControlPanelEntity): class LupusecAlarm(LupusecDevice, AlarmControlPanelEntity):
"""An alarm_control_panel implementation for Lupusec.""" """An alarm_control_panel implementation for Lupusec."""
_attr_icon = "mdi:security"
_attr_supported_features = ( _attr_supported_features = (
AlarmControlPanelEntityFeature.ARM_HOME AlarmControlPanelEntityFeature.ARM_HOME
| AlarmControlPanelEntityFeature.ARM_AWAY | AlarmControlPanelEntityFeature.ARM_AWAY
) )
@property @property
def icon(self): def state(self) -> str | None:
"""Return the icon."""
return ICON
@property
def state(self):
"""Return the state of the device.""" """Return the state of the device."""
if self._device.is_standby: if self._device.is_standby:
state = STATE_ALARM_DISARMED state = STATE_ALARM_DISARMED