Add unique_id to canary alarm_control_panel (#40041)
* add unique_id to canary alarm_control_panel * Update test_alarm_control_panel.py * Update alarm_control_panel.py * Apply suggestions from code review Co-authored-by: J. Nick Koston <nick@koston.org> Co-authored-by: J. Nick Koston <nick@koston.org>pull/40054/head
parent
ae8c9d82bc
commit
9511103e26
|
@ -43,6 +43,11 @@ class CanaryAlarm(AlarmControlPanelEntity):
|
|||
location = self._data.get_location(self._location_id)
|
||||
return location.name
|
||||
|
||||
@property
|
||||
def unique_id(self):
|
||||
"""Return the unique ID of the alarm."""
|
||||
return str(self._location_id)
|
||||
|
||||
@property
|
||||
def state(self):
|
||||
"""Return the state of the device."""
|
||||
|
|
|
@ -50,7 +50,8 @@ async def test_alarm_control_panel(hass, canary) -> None:
|
|||
|
||||
entity_id = "alarm_control_panel.home"
|
||||
entity_entry = registry.async_get(entity_id)
|
||||
assert not entity_entry
|
||||
assert entity_entry
|
||||
assert entity_entry.unique_id == "100"
|
||||
|
||||
state = hass.states.get(entity_id)
|
||||
assert state
|
||||
|
|
Loading…
Reference in New Issue