Add active alarm zones as select entity to Overkiz integration (#68997)

* Add active zones as select entity

* Clean up for PR
This commit is contained in:
Mick Vleeshouwer 2022-06-14 13:21:35 +02:00 committed by GitHub
parent 99db2a5afe
commit 1ef0102f12
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -50,6 +50,17 @@ def _select_option_memorized_simple_volume(
return execute_command(OverkizCommand.SET_MEMORIZED_SIMPLE_VOLUME, option)
def _select_option_active_zone(
option: str, execute_command: Callable[..., Awaitable[None]]
) -> Awaitable[None]:
"""Change the selected option for Active Zone(s)."""
# Turn alarm off when empty zone is selected
if option == "":
return execute_command(OverkizCommand.ALARM_OFF)
return execute_command(OverkizCommand.ALARM_ZONE_ON, option)
SELECT_DESCRIPTIONS: list[OverkizSelectDescription] = [
OverkizSelectDescription(
key=OverkizState.CORE_OPEN_CLOSED_PEDESTRIAN,
@ -83,6 +94,14 @@ SELECT_DESCRIPTIONS: list[OverkizSelectDescription] = [
),
entity_category=EntityCategory.CONFIG,
),
# StatefulAlarmController
OverkizSelectDescription(
key=OverkizState.CORE_ACTIVE_ZONES,
name="Active Zones",
icon="mdi:shield-lock",
options=["", "A", "B", "C", "A,B", "B,C", "A,C", "A,B,C"],
select_option=_select_option_active_zone,
),
]
SUPPORTED_STATES = {description.key: description for description in SELECT_DESCRIPTIONS}