mirror of
https://github.com/home-assistant/core.git
synced 2026-12-02 19:57:03 -04:00
Add action enums to nx584 (#191574)
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
"""Services for the NX584 integration."""
|
||||
|
||||
from enum import StrEnum
|
||||
|
||||
import probatio
|
||||
|
||||
from homeassistant.components.alarm_control_panel import (
|
||||
@@ -10,9 +12,18 @@ from homeassistant.helpers import config_validation as cv, service
|
||||
|
||||
from .const import DOMAIN
|
||||
|
||||
SERVICE_BYPASS_ZONE = "bypass_zone"
|
||||
SERVICE_UNBYPASS_ZONE = "unbypass_zone"
|
||||
ATTR_ZONE = "zone"
|
||||
|
||||
class NX584Service(StrEnum):
|
||||
"""Store keys for NX584 services."""
|
||||
|
||||
BYPASS_ZONE = "bypass_zone"
|
||||
UNBYPASS_ZONE = "unbypass_zone"
|
||||
|
||||
|
||||
class NX584ServiceArgument(StrEnum):
|
||||
"""Store keys for NX584 service arguments."""
|
||||
|
||||
ZONE = "zone"
|
||||
|
||||
|
||||
@callback
|
||||
@@ -21,16 +32,16 @@ def async_setup_services(hass: HomeAssistant) -> None:
|
||||
service.async_register_platform_entity_service(
|
||||
hass,
|
||||
DOMAIN,
|
||||
SERVICE_BYPASS_ZONE,
|
||||
NX584Service.BYPASS_ZONE,
|
||||
entity_domain=ALARM_CONTROL_PANEL_DOMAIN,
|
||||
schema={probatio.Required(ATTR_ZONE): cv.positive_int},
|
||||
schema={probatio.Required(NX584ServiceArgument.ZONE): cv.positive_int},
|
||||
func="alarm_bypass",
|
||||
)
|
||||
service.async_register_platform_entity_service(
|
||||
hass,
|
||||
DOMAIN,
|
||||
SERVICE_UNBYPASS_ZONE,
|
||||
NX584Service.UNBYPASS_ZONE,
|
||||
entity_domain=ALARM_CONTROL_PANEL_DOMAIN,
|
||||
schema={probatio.Required(ATTR_ZONE): cv.positive_int},
|
||||
schema={probatio.Required(NX584ServiceArgument.ZONE): cv.positive_int},
|
||||
func="alarm_unbypass",
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user