Move icon constants to entity attributes (#90518)

* Move icon constants to attribute

* Adjust test
This commit is contained in:
epenet 2023-03-31 09:34:17 +02:00 committed by GitHub
parent 2e0ecf9bd9
commit d0c38c1e12
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
29 changed files with 46 additions and 177 deletions

View file

@ -27,8 +27,6 @@ from . import KNOWN_DEVICES
from .connection import HKDevice
from .entity import HomeKitEntity
ICON = "mdi:security"
CURRENT_STATE_MAP = {
0: STATE_ALARM_ARMED_HOME,
1: STATE_ALARM_ARMED_AWAY,
@ -72,6 +70,7 @@ async def async_setup_entry(
class HomeKitAlarmControlPanelEntity(HomeKitEntity, AlarmControlPanelEntity):
"""Representation of a Homekit Alarm Control Panel."""
_attr_icon = "mdi:security"
_attr_supported_features = (
AlarmControlPanelEntityFeature.ARM_HOME
| AlarmControlPanelEntityFeature.ARM_AWAY
@ -86,11 +85,6 @@ class HomeKitAlarmControlPanelEntity(HomeKitEntity, AlarmControlPanelEntity):
CharacteristicsTypes.BATTERY_LEVEL,
]
@property
def icon(self) -> str:
"""Return icon."""
return ICON
@property
def state(self) -> str:
"""Return the state of the device."""