mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
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>
This commit is contained in:
parent
ae8c9d82bc
commit
9511103e26
@ -43,6 +43,11 @@ class CanaryAlarm(AlarmControlPanelEntity):
|
|||||||
location = self._data.get_location(self._location_id)
|
location = self._data.get_location(self._location_id)
|
||||||
return location.name
|
return location.name
|
||||||
|
|
||||||
|
@property
|
||||||
|
def unique_id(self):
|
||||||
|
"""Return the unique ID of the alarm."""
|
||||||
|
return str(self._location_id)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def state(self):
|
def state(self):
|
||||||
"""Return the state of the device."""
|
"""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_id = "alarm_control_panel.home"
|
||||||
entity_entry = registry.async_get(entity_id)
|
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)
|
state = hass.states.get(entity_id)
|
||||||
assert state
|
assert state
|
||||||
|
Loading…
x
Reference in New Issue
Block a user