init home-assistant
This commit is contained in:
168
home-assistant/homeassistant/components/alarmdecoder/__init__.py
Normal file
168
home-assistant/homeassistant/components/alarmdecoder/__init__.py
Normal file
@@ -0,0 +1,168 @@
|
||||
"""Support for AlarmDecoder devices."""
|
||||
|
||||
from collections.abc import Callable
|
||||
from dataclasses import dataclass
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
|
||||
from adext import AdExt
|
||||
from alarmdecoder.devices import SerialDevice, SocketDevice
|
||||
from alarmdecoder.util import NoDeviceError
|
||||
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import (
|
||||
CONF_HOST,
|
||||
CONF_PORT,
|
||||
CONF_PROTOCOL,
|
||||
EVENT_HOMEASSISTANT_STOP,
|
||||
Platform,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.dispatcher import dispatcher_send
|
||||
from homeassistant.helpers.event import async_call_later
|
||||
|
||||
from .const import (
|
||||
CONF_DEVICE_BAUD,
|
||||
CONF_DEVICE_PATH,
|
||||
PROTOCOL_SERIAL,
|
||||
PROTOCOL_SOCKET,
|
||||
SIGNAL_PANEL_MESSAGE,
|
||||
SIGNAL_REL_MESSAGE,
|
||||
SIGNAL_RFX_MESSAGE,
|
||||
SIGNAL_ZONE_FAULT,
|
||||
SIGNAL_ZONE_RESTORE,
|
||||
)
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
PLATFORMS = [
|
||||
Platform.ALARM_CONTROL_PANEL,
|
||||
Platform.BINARY_SENSOR,
|
||||
Platform.SENSOR,
|
||||
]
|
||||
|
||||
type AlarmDecoderConfigEntry = ConfigEntry[AlarmDecoderData]
|
||||
|
||||
|
||||
@dataclass
|
||||
class AlarmDecoderData:
|
||||
"""Runtime data for the AlarmDecoder class."""
|
||||
|
||||
client: AdExt
|
||||
remove_update_listener: Callable[[], None]
|
||||
remove_stop_listener: Callable[[], None]
|
||||
restart: bool
|
||||
|
||||
|
||||
async def async_setup_entry(
|
||||
hass: HomeAssistant, entry: AlarmDecoderConfigEntry
|
||||
) -> bool:
|
||||
"""Set up AlarmDecoder config flow."""
|
||||
undo_listener = entry.add_update_listener(_update_listener)
|
||||
|
||||
ad_connection = entry.data
|
||||
protocol = ad_connection[CONF_PROTOCOL]
|
||||
|
||||
def stop_alarmdecoder(event):
|
||||
"""Handle the shutdown of AlarmDecoder."""
|
||||
if not entry.runtime_data:
|
||||
return
|
||||
_LOGGER.debug("Shutting down alarmdecoder")
|
||||
entry.runtime_data.restart = False
|
||||
controller.close()
|
||||
|
||||
async def open_connection(now=None):
|
||||
"""Open a connection to AlarmDecoder."""
|
||||
try:
|
||||
await hass.async_add_executor_job(controller.open, baud)
|
||||
except NoDeviceError:
|
||||
_LOGGER.debug("Failed to connect. Retrying in 5 seconds")
|
||||
async_call_later(hass, timedelta(seconds=5), open_connection)
|
||||
return
|
||||
_LOGGER.debug("Established a connection with the alarmdecoder")
|
||||
entry.runtime_data.restart = True
|
||||
|
||||
def handle_closed_connection(event):
|
||||
"""Restart after unexpected loss of connection."""
|
||||
if not entry.runtime_data.restart:
|
||||
return
|
||||
entry.runtime_data.restart = False
|
||||
_LOGGER.warning("AlarmDecoder unexpectedly lost connection")
|
||||
hass.add_job(open_connection)
|
||||
|
||||
def handle_message(sender, message):
|
||||
"""Handle message from AlarmDecoder."""
|
||||
dispatcher_send(hass, SIGNAL_PANEL_MESSAGE, message)
|
||||
|
||||
def handle_rfx_message(sender, message):
|
||||
"""Handle RFX message from AlarmDecoder."""
|
||||
dispatcher_send(hass, SIGNAL_RFX_MESSAGE, message)
|
||||
|
||||
def zone_fault_callback(sender, zone):
|
||||
"""Handle zone fault from AlarmDecoder."""
|
||||
dispatcher_send(hass, SIGNAL_ZONE_FAULT, zone)
|
||||
|
||||
def zone_restore_callback(sender, zone):
|
||||
"""Handle zone restore from AlarmDecoder."""
|
||||
dispatcher_send(hass, SIGNAL_ZONE_RESTORE, zone)
|
||||
|
||||
def handle_rel_message(sender, message):
|
||||
"""Handle relay or zone expander message from AlarmDecoder."""
|
||||
dispatcher_send(hass, SIGNAL_REL_MESSAGE, message)
|
||||
|
||||
baud = ad_connection.get(CONF_DEVICE_BAUD)
|
||||
if protocol == PROTOCOL_SOCKET:
|
||||
host = ad_connection[CONF_HOST]
|
||||
port = ad_connection[CONF_PORT]
|
||||
controller = AdExt(SocketDevice(interface=(host, port)))
|
||||
if protocol == PROTOCOL_SERIAL:
|
||||
path = ad_connection[CONF_DEVICE_PATH]
|
||||
controller = AdExt(SerialDevice(interface=path))
|
||||
|
||||
controller.on_message += handle_message
|
||||
controller.on_rfx_message += handle_rfx_message
|
||||
controller.on_zone_fault += zone_fault_callback
|
||||
controller.on_zone_restore += zone_restore_callback
|
||||
controller.on_close += handle_closed_connection
|
||||
controller.on_expander_message += handle_rel_message
|
||||
|
||||
remove_stop_listener = hass.bus.async_listen_once(
|
||||
EVENT_HOMEASSISTANT_STOP, stop_alarmdecoder
|
||||
)
|
||||
|
||||
entry.runtime_data = AlarmDecoderData(
|
||||
controller, undo_listener, remove_stop_listener, False
|
||||
)
|
||||
|
||||
await open_connection()
|
||||
|
||||
await controller.is_init()
|
||||
|
||||
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
|
||||
|
||||
return True
|
||||
|
||||
|
||||
async def async_unload_entry(
|
||||
hass: HomeAssistant, entry: AlarmDecoderConfigEntry
|
||||
) -> bool:
|
||||
"""Unload a AlarmDecoder entry."""
|
||||
data = entry.runtime_data
|
||||
data.restart = False
|
||||
|
||||
unload_ok = await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
|
||||
|
||||
if not unload_ok:
|
||||
return False
|
||||
|
||||
data.remove_update_listener()
|
||||
data.remove_stop_listener()
|
||||
await hass.async_add_executor_job(data.client.close)
|
||||
|
||||
return True
|
||||
|
||||
|
||||
async def _update_listener(hass: HomeAssistant, entry: AlarmDecoderConfigEntry) -> None:
|
||||
"""Handle options update."""
|
||||
_LOGGER.debug("AlarmDecoder options updated: %s", entry.as_dict()["options"])
|
||||
await hass.config_entries.async_reload(entry.entry_id)
|
||||
@@ -0,0 +1,165 @@
|
||||
"""Support for AlarmDecoder-based alarm control panels (Honeywell/DSC)."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.alarm_control_panel import (
|
||||
AlarmControlPanelEntity,
|
||||
AlarmControlPanelEntityFeature,
|
||||
AlarmControlPanelState,
|
||||
CodeFormat,
|
||||
)
|
||||
from homeassistant.const import ATTR_CODE
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import entity_platform
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
|
||||
from . import AlarmDecoderConfigEntry
|
||||
from .const import (
|
||||
CONF_ALT_NIGHT_MODE,
|
||||
CONF_AUTO_BYPASS,
|
||||
CONF_CODE_ARM_REQUIRED,
|
||||
DEFAULT_ARM_OPTIONS,
|
||||
OPTIONS_ARM,
|
||||
SIGNAL_PANEL_MESSAGE,
|
||||
)
|
||||
from .entity import AlarmDecoderEntity
|
||||
|
||||
SERVICE_ALARM_TOGGLE_CHIME = "alarm_toggle_chime"
|
||||
|
||||
SERVICE_ALARM_KEYPRESS = "alarm_keypress"
|
||||
ATTR_KEYPRESS = "keypress"
|
||||
|
||||
|
||||
async def async_setup_entry(
|
||||
hass: HomeAssistant,
|
||||
entry: AlarmDecoderConfigEntry,
|
||||
async_add_entities: AddEntitiesCallback,
|
||||
) -> None:
|
||||
"""Set up for AlarmDecoder alarm panels."""
|
||||
options = entry.options
|
||||
arm_options = options.get(OPTIONS_ARM, DEFAULT_ARM_OPTIONS)
|
||||
|
||||
entity = AlarmDecoderAlarmPanel(
|
||||
client=entry.runtime_data.client,
|
||||
auto_bypass=arm_options[CONF_AUTO_BYPASS],
|
||||
code_arm_required=arm_options[CONF_CODE_ARM_REQUIRED],
|
||||
alt_night_mode=arm_options[CONF_ALT_NIGHT_MODE],
|
||||
)
|
||||
async_add_entities([entity])
|
||||
|
||||
platform = entity_platform.async_get_current_platform()
|
||||
platform.async_register_entity_service(
|
||||
SERVICE_ALARM_TOGGLE_CHIME,
|
||||
{
|
||||
vol.Required(ATTR_CODE): cv.string,
|
||||
},
|
||||
"alarm_toggle_chime",
|
||||
)
|
||||
|
||||
platform.async_register_entity_service(
|
||||
SERVICE_ALARM_KEYPRESS,
|
||||
{
|
||||
vol.Required(ATTR_KEYPRESS): cv.string,
|
||||
},
|
||||
"alarm_keypress",
|
||||
)
|
||||
|
||||
|
||||
class AlarmDecoderAlarmPanel(AlarmDecoderEntity, AlarmControlPanelEntity):
|
||||
"""Representation of an AlarmDecoder-based alarm panel."""
|
||||
|
||||
_attr_name = "Alarm Panel"
|
||||
_attr_should_poll = False
|
||||
_attr_code_format = CodeFormat.NUMBER
|
||||
_attr_supported_features = (
|
||||
AlarmControlPanelEntityFeature.ARM_HOME
|
||||
| AlarmControlPanelEntityFeature.ARM_AWAY
|
||||
| AlarmControlPanelEntityFeature.ARM_NIGHT
|
||||
)
|
||||
|
||||
def __init__(self, client, auto_bypass, code_arm_required, alt_night_mode):
|
||||
"""Initialize the alarm panel."""
|
||||
super().__init__(client)
|
||||
self._attr_unique_id = f"{client.serial_number}-panel"
|
||||
self._auto_bypass = auto_bypass
|
||||
self._attr_code_arm_required = code_arm_required
|
||||
self._alt_night_mode = alt_night_mode
|
||||
|
||||
async def async_added_to_hass(self) -> None:
|
||||
"""Register callbacks."""
|
||||
self.async_on_remove(
|
||||
async_dispatcher_connect(
|
||||
self.hass, SIGNAL_PANEL_MESSAGE, self._message_callback
|
||||
)
|
||||
)
|
||||
|
||||
def _message_callback(self, message):
|
||||
"""Handle received messages."""
|
||||
if message.alarm_sounding or message.fire_alarm:
|
||||
self._attr_alarm_state = AlarmControlPanelState.TRIGGERED
|
||||
elif message.armed_away:
|
||||
self._attr_alarm_state = AlarmControlPanelState.ARMED_AWAY
|
||||
elif message.armed_home and (message.entry_delay_off or message.perimeter_only):
|
||||
self._attr_alarm_state = AlarmControlPanelState.ARMED_NIGHT
|
||||
elif message.armed_home:
|
||||
self._attr_alarm_state = AlarmControlPanelState.ARMED_HOME
|
||||
else:
|
||||
self._attr_alarm_state = AlarmControlPanelState.DISARMED
|
||||
|
||||
self._attr_extra_state_attributes = {
|
||||
"ac_power": message.ac_power,
|
||||
"alarm_event_occurred": message.alarm_event_occurred,
|
||||
"backlight_on": message.backlight_on,
|
||||
"battery_low": message.battery_low,
|
||||
"check_zone": message.check_zone,
|
||||
"chime": message.chime_on,
|
||||
"entry_delay_off": message.entry_delay_off,
|
||||
"programming_mode": message.programming_mode,
|
||||
"ready": message.ready,
|
||||
"zone_bypassed": message.zone_bypassed,
|
||||
}
|
||||
self.schedule_update_ha_state()
|
||||
|
||||
def alarm_disarm(self, code: str | None = None) -> None:
|
||||
"""Send disarm command."""
|
||||
if code:
|
||||
self._client.send(f"{code!s}1")
|
||||
|
||||
def alarm_arm_away(self, code: str | None = None) -> None:
|
||||
"""Send arm away command."""
|
||||
self._client.arm_away(
|
||||
code=code,
|
||||
code_arm_required=self._attr_code_arm_required,
|
||||
auto_bypass=self._auto_bypass,
|
||||
)
|
||||
|
||||
def alarm_arm_home(self, code: str | None = None) -> None:
|
||||
"""Send arm home command."""
|
||||
self._client.arm_home(
|
||||
code=code,
|
||||
code_arm_required=self._attr_code_arm_required,
|
||||
auto_bypass=self._auto_bypass,
|
||||
)
|
||||
|
||||
def alarm_arm_night(self, code: str | None = None) -> None:
|
||||
"""Send arm night command."""
|
||||
self._client.arm_night(
|
||||
code=code,
|
||||
code_arm_required=self._attr_code_arm_required,
|
||||
alt_night_mode=self._alt_night_mode,
|
||||
auto_bypass=self._auto_bypass,
|
||||
)
|
||||
|
||||
def alarm_toggle_chime(self, code=None):
|
||||
"""Send toggle chime command."""
|
||||
if code:
|
||||
self._client.send(f"{code!s}9")
|
||||
|
||||
def alarm_keypress(self, keypress):
|
||||
"""Send custom keypresses."""
|
||||
if keypress:
|
||||
self._client.send(keypress)
|
||||
@@ -0,0 +1,173 @@
|
||||
"""Support for AlarmDecoder zone states- represented as binary sensors."""
|
||||
|
||||
import logging
|
||||
|
||||
from homeassistant.components.binary_sensor import BinarySensorEntity
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
|
||||
from . import AlarmDecoderConfigEntry
|
||||
from .const import (
|
||||
CONF_RELAY_ADDR,
|
||||
CONF_RELAY_CHAN,
|
||||
CONF_ZONE_LOOP,
|
||||
CONF_ZONE_NAME,
|
||||
CONF_ZONE_NUMBER,
|
||||
CONF_ZONE_RFID,
|
||||
CONF_ZONE_TYPE,
|
||||
DEFAULT_ZONE_OPTIONS,
|
||||
OPTIONS_ZONES,
|
||||
SIGNAL_REL_MESSAGE,
|
||||
SIGNAL_RFX_MESSAGE,
|
||||
SIGNAL_ZONE_FAULT,
|
||||
SIGNAL_ZONE_RESTORE,
|
||||
)
|
||||
from .entity import AlarmDecoderEntity
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
ATTR_RF_BIT0 = "rf_bit0"
|
||||
ATTR_RF_LOW_BAT = "rf_low_battery"
|
||||
ATTR_RF_SUPERVISED = "rf_supervised"
|
||||
ATTR_RF_BIT3 = "rf_bit3"
|
||||
ATTR_RF_LOOP3 = "rf_loop3"
|
||||
ATTR_RF_LOOP2 = "rf_loop2"
|
||||
ATTR_RF_LOOP4 = "rf_loop4"
|
||||
ATTR_RF_LOOP1 = "rf_loop1"
|
||||
|
||||
|
||||
async def async_setup_entry(
|
||||
hass: HomeAssistant,
|
||||
entry: AlarmDecoderConfigEntry,
|
||||
async_add_entities: AddEntitiesCallback,
|
||||
) -> None:
|
||||
"""Set up for AlarmDecoder sensor."""
|
||||
|
||||
client = entry.runtime_data.client
|
||||
zones = entry.options.get(OPTIONS_ZONES, DEFAULT_ZONE_OPTIONS)
|
||||
|
||||
entities = []
|
||||
for zone_num in zones:
|
||||
zone_info = zones[zone_num]
|
||||
zone_type = zone_info[CONF_ZONE_TYPE]
|
||||
zone_name = zone_info[CONF_ZONE_NAME]
|
||||
zone_rfid = zone_info.get(CONF_ZONE_RFID)
|
||||
zone_loop = zone_info.get(CONF_ZONE_LOOP)
|
||||
relay_addr = zone_info.get(CONF_RELAY_ADDR)
|
||||
relay_chan = zone_info.get(CONF_RELAY_CHAN)
|
||||
entity = AlarmDecoderBinarySensor(
|
||||
client,
|
||||
zone_num,
|
||||
zone_name,
|
||||
zone_type,
|
||||
zone_rfid,
|
||||
zone_loop,
|
||||
relay_addr,
|
||||
relay_chan,
|
||||
)
|
||||
entities.append(entity)
|
||||
|
||||
async_add_entities(entities)
|
||||
|
||||
|
||||
class AlarmDecoderBinarySensor(AlarmDecoderEntity, BinarySensorEntity):
|
||||
"""Representation of an AlarmDecoder binary sensor."""
|
||||
|
||||
_attr_should_poll = False
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
client,
|
||||
zone_number,
|
||||
zone_name,
|
||||
zone_type,
|
||||
zone_rfid,
|
||||
zone_loop,
|
||||
relay_addr,
|
||||
relay_chan,
|
||||
):
|
||||
"""Initialize the binary_sensor."""
|
||||
super().__init__(client)
|
||||
self._attr_unique_id = f"{client.serial_number}-zone-{zone_number}"
|
||||
self._zone_number = int(zone_number)
|
||||
self._zone_type = zone_type
|
||||
self._attr_name = zone_name
|
||||
self._attr_is_on = False
|
||||
self._rfid = zone_rfid
|
||||
self._loop = zone_loop
|
||||
self._relay_addr = relay_addr
|
||||
self._relay_chan = relay_chan
|
||||
self._attr_device_class = zone_type
|
||||
self._attr_extra_state_attributes = {
|
||||
CONF_ZONE_NUMBER: self._zone_number,
|
||||
}
|
||||
|
||||
async def async_added_to_hass(self) -> None:
|
||||
"""Register callbacks."""
|
||||
self.async_on_remove(
|
||||
async_dispatcher_connect(self.hass, SIGNAL_ZONE_FAULT, self._fault_callback)
|
||||
)
|
||||
|
||||
self.async_on_remove(
|
||||
async_dispatcher_connect(
|
||||
self.hass, SIGNAL_ZONE_RESTORE, self._restore_callback
|
||||
)
|
||||
)
|
||||
|
||||
self.async_on_remove(
|
||||
async_dispatcher_connect(
|
||||
self.hass, SIGNAL_RFX_MESSAGE, self._rfx_message_callback
|
||||
)
|
||||
)
|
||||
|
||||
self.async_on_remove(
|
||||
async_dispatcher_connect(
|
||||
self.hass, SIGNAL_REL_MESSAGE, self._rel_message_callback
|
||||
)
|
||||
)
|
||||
|
||||
def _fault_callback(self, zone):
|
||||
"""Update the zone's state, if needed."""
|
||||
if zone is None or int(zone) == self._zone_number:
|
||||
self._attr_is_on = True
|
||||
self.schedule_update_ha_state()
|
||||
|
||||
def _restore_callback(self, zone):
|
||||
"""Update the zone's state, if needed."""
|
||||
if zone is None or (int(zone) == self._zone_number and not self._loop):
|
||||
self._attr_is_on = False
|
||||
self.schedule_update_ha_state()
|
||||
|
||||
def _rfx_message_callback(self, message):
|
||||
"""Update RF state."""
|
||||
if self._rfid and message and message.serial_number == self._rfid:
|
||||
rfstate = message.value
|
||||
if self._loop:
|
||||
self._attr_is_on = bool(message.loop[self._loop - 1])
|
||||
attr = {CONF_ZONE_NUMBER: self._zone_number}
|
||||
if self._rfid and rfstate is not None:
|
||||
attr[ATTR_RF_BIT0] = bool(rfstate & 0x01)
|
||||
attr[ATTR_RF_LOW_BAT] = bool(rfstate & 0x02)
|
||||
attr[ATTR_RF_SUPERVISED] = bool(rfstate & 0x04)
|
||||
attr[ATTR_RF_BIT3] = bool(rfstate & 0x08)
|
||||
attr[ATTR_RF_LOOP3] = bool(rfstate & 0x10)
|
||||
attr[ATTR_RF_LOOP2] = bool(rfstate & 0x20)
|
||||
attr[ATTR_RF_LOOP4] = bool(rfstate & 0x40)
|
||||
attr[ATTR_RF_LOOP1] = bool(rfstate & 0x80)
|
||||
self._attr_extra_state_attributes = attr
|
||||
self.schedule_update_ha_state()
|
||||
|
||||
def _rel_message_callback(self, message):
|
||||
"""Update relay / expander state."""
|
||||
|
||||
if self._relay_addr == message.address and self._relay_chan == message.channel:
|
||||
_LOGGER.debug(
|
||||
"%s %d:%d value:%d",
|
||||
"Relay" if message.type == message.RELAY else "ZoneExpander",
|
||||
message.address,
|
||||
message.channel,
|
||||
message.value,
|
||||
)
|
||||
self._attr_is_on = bool(message.value)
|
||||
self.schedule_update_ha_state()
|
||||
@@ -0,0 +1,393 @@
|
||||
"""Config flow for AlarmDecoder."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
from adext import AdExt
|
||||
from alarmdecoder.devices import SerialDevice, SocketDevice
|
||||
from alarmdecoder.util import NoDeviceError
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.binary_sensor import (
|
||||
DEVICE_CLASSES_SCHEMA as BINARY_SENSOR_DEVICE_CLASSES_SCHEMA,
|
||||
)
|
||||
from homeassistant.config_entries import (
|
||||
ConfigEntry,
|
||||
ConfigFlow,
|
||||
ConfigFlowResult,
|
||||
OptionsFlow,
|
||||
)
|
||||
from homeassistant.const import CONF_HOST, CONF_PORT, CONF_PROTOCOL
|
||||
from homeassistant.core import callback
|
||||
|
||||
from .const import (
|
||||
CONF_ALT_NIGHT_MODE,
|
||||
CONF_AUTO_BYPASS,
|
||||
CONF_CODE_ARM_REQUIRED,
|
||||
CONF_DEVICE_BAUD,
|
||||
CONF_DEVICE_PATH,
|
||||
CONF_RELAY_ADDR,
|
||||
CONF_RELAY_CHAN,
|
||||
CONF_ZONE_LOOP,
|
||||
CONF_ZONE_NAME,
|
||||
CONF_ZONE_NUMBER,
|
||||
CONF_ZONE_RFID,
|
||||
CONF_ZONE_TYPE,
|
||||
DEFAULT_ARM_OPTIONS,
|
||||
DEFAULT_DEVICE_BAUD,
|
||||
DEFAULT_DEVICE_HOST,
|
||||
DEFAULT_DEVICE_PATH,
|
||||
DEFAULT_DEVICE_PORT,
|
||||
DEFAULT_ZONE_OPTIONS,
|
||||
DEFAULT_ZONE_TYPE,
|
||||
DOMAIN,
|
||||
OPTIONS_ARM,
|
||||
OPTIONS_ZONES,
|
||||
PROTOCOL_SERIAL,
|
||||
PROTOCOL_SOCKET,
|
||||
)
|
||||
|
||||
EDIT_KEY = "edit_selection"
|
||||
EDIT_ZONES = "Zones"
|
||||
EDIT_SETTINGS = "Arming Settings"
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class AlarmDecoderFlowHandler(ConfigFlow, domain=DOMAIN):
|
||||
"""Handle a AlarmDecoder config flow."""
|
||||
|
||||
VERSION = 1
|
||||
|
||||
def __init__(self) -> None:
|
||||
"""Initialize AlarmDecoder ConfigFlow."""
|
||||
self.protocol = None
|
||||
|
||||
@staticmethod
|
||||
@callback
|
||||
def async_get_options_flow(
|
||||
config_entry: ConfigEntry,
|
||||
) -> AlarmDecoderOptionsFlowHandler:
|
||||
"""Get the options flow for AlarmDecoder."""
|
||||
return AlarmDecoderOptionsFlowHandler(config_entry)
|
||||
|
||||
async def async_step_user(
|
||||
self, user_input: dict[str, Any] | None = None
|
||||
) -> ConfigFlowResult:
|
||||
"""Handle a flow initialized by the user."""
|
||||
if user_input is not None:
|
||||
self.protocol = user_input[CONF_PROTOCOL]
|
||||
return await self.async_step_protocol()
|
||||
|
||||
return self.async_show_form(
|
||||
step_id="user",
|
||||
data_schema=vol.Schema(
|
||||
{
|
||||
vol.Required(CONF_PROTOCOL): vol.In(
|
||||
[PROTOCOL_SOCKET, PROTOCOL_SERIAL]
|
||||
),
|
||||
}
|
||||
),
|
||||
)
|
||||
|
||||
async def async_step_protocol(
|
||||
self, user_input: dict[str, Any] | None = None
|
||||
) -> ConfigFlowResult:
|
||||
"""Handle AlarmDecoder protocol setup."""
|
||||
errors = {}
|
||||
if user_input is not None:
|
||||
if _device_already_added(
|
||||
self._async_current_entries(), user_input, self.protocol
|
||||
):
|
||||
return self.async_abort(reason="already_configured")
|
||||
connection = {}
|
||||
baud = None
|
||||
if self.protocol == PROTOCOL_SOCKET:
|
||||
host = connection[CONF_HOST] = user_input[CONF_HOST]
|
||||
port = connection[CONF_PORT] = user_input[CONF_PORT]
|
||||
title = f"{host}:{port}"
|
||||
device = SocketDevice(interface=(host, port))
|
||||
if self.protocol == PROTOCOL_SERIAL:
|
||||
path = connection[CONF_DEVICE_PATH] = user_input[CONF_DEVICE_PATH]
|
||||
baud = connection[CONF_DEVICE_BAUD] = user_input[CONF_DEVICE_BAUD]
|
||||
title = path
|
||||
device = SerialDevice(interface=path)
|
||||
|
||||
controller = AdExt(device)
|
||||
|
||||
def test_connection():
|
||||
controller.open(baud)
|
||||
controller.close()
|
||||
|
||||
try:
|
||||
await self.hass.async_add_executor_job(test_connection)
|
||||
return self.async_create_entry(
|
||||
title=title, data={CONF_PROTOCOL: self.protocol, **connection}
|
||||
)
|
||||
except NoDeviceError:
|
||||
errors["base"] = "cannot_connect"
|
||||
except Exception:
|
||||
_LOGGER.exception("Unexpected exception during AlarmDecoder setup")
|
||||
errors["base"] = "unknown"
|
||||
|
||||
if self.protocol == PROTOCOL_SOCKET:
|
||||
schema = vol.Schema(
|
||||
{
|
||||
vol.Required(CONF_HOST, default=DEFAULT_DEVICE_HOST): str,
|
||||
vol.Required(CONF_PORT, default=DEFAULT_DEVICE_PORT): int,
|
||||
}
|
||||
)
|
||||
if self.protocol == PROTOCOL_SERIAL:
|
||||
schema = vol.Schema(
|
||||
{
|
||||
vol.Required(CONF_DEVICE_PATH, default=DEFAULT_DEVICE_PATH): str,
|
||||
vol.Required(CONF_DEVICE_BAUD, default=DEFAULT_DEVICE_BAUD): int,
|
||||
}
|
||||
)
|
||||
|
||||
return self.async_show_form(
|
||||
step_id="protocol",
|
||||
data_schema=schema,
|
||||
errors=errors,
|
||||
)
|
||||
|
||||
|
||||
class AlarmDecoderOptionsFlowHandler(OptionsFlow):
|
||||
"""Handle AlarmDecoder options."""
|
||||
|
||||
selected_zone: str
|
||||
|
||||
def __init__(self, config_entry: ConfigEntry) -> None:
|
||||
"""Initialize AlarmDecoder options flow."""
|
||||
self.arm_options = config_entry.options.get(OPTIONS_ARM, DEFAULT_ARM_OPTIONS)
|
||||
self.zone_options = config_entry.options.get(
|
||||
OPTIONS_ZONES, DEFAULT_ZONE_OPTIONS
|
||||
)
|
||||
|
||||
async def async_step_init(
|
||||
self, user_input: dict[str, Any] | None = None
|
||||
) -> ConfigFlowResult:
|
||||
"""Manage the options."""
|
||||
if user_input is not None:
|
||||
if user_input[EDIT_KEY] == EDIT_SETTINGS:
|
||||
return await self.async_step_arm_settings()
|
||||
if user_input[EDIT_KEY] == EDIT_ZONES:
|
||||
return await self.async_step_zone_select()
|
||||
|
||||
return self.async_show_form(
|
||||
step_id="init",
|
||||
data_schema=vol.Schema(
|
||||
{
|
||||
vol.Required(EDIT_KEY, default=EDIT_SETTINGS): vol.In(
|
||||
[EDIT_SETTINGS, EDIT_ZONES]
|
||||
)
|
||||
},
|
||||
),
|
||||
)
|
||||
|
||||
async def async_step_arm_settings(
|
||||
self, user_input: dict[str, Any] | None = None
|
||||
) -> ConfigFlowResult:
|
||||
"""Arming options form."""
|
||||
if user_input is not None:
|
||||
return self.async_create_entry(
|
||||
title="",
|
||||
data={OPTIONS_ARM: user_input, OPTIONS_ZONES: self.zone_options},
|
||||
)
|
||||
|
||||
return self.async_show_form(
|
||||
step_id="arm_settings",
|
||||
data_schema=vol.Schema(
|
||||
{
|
||||
vol.Optional(
|
||||
CONF_ALT_NIGHT_MODE,
|
||||
default=self.arm_options[CONF_ALT_NIGHT_MODE],
|
||||
): bool,
|
||||
vol.Optional(
|
||||
CONF_AUTO_BYPASS, default=self.arm_options[CONF_AUTO_BYPASS]
|
||||
): bool,
|
||||
vol.Optional(
|
||||
CONF_CODE_ARM_REQUIRED,
|
||||
default=self.arm_options[CONF_CODE_ARM_REQUIRED],
|
||||
): bool,
|
||||
},
|
||||
),
|
||||
)
|
||||
|
||||
async def async_step_zone_select(
|
||||
self, user_input: dict[str, Any] | None = None
|
||||
) -> ConfigFlowResult:
|
||||
"""Zone selection form."""
|
||||
errors = _validate_zone_input(user_input)
|
||||
|
||||
if user_input is not None and not errors:
|
||||
self.selected_zone = str(
|
||||
int(user_input[CONF_ZONE_NUMBER])
|
||||
) # remove leading zeros
|
||||
return await self.async_step_zone_details()
|
||||
|
||||
return self.async_show_form(
|
||||
step_id="zone_select",
|
||||
data_schema=vol.Schema({vol.Required(CONF_ZONE_NUMBER): str}),
|
||||
errors=errors,
|
||||
)
|
||||
|
||||
async def async_step_zone_details(
|
||||
self, user_input: dict[str, Any] | None = None
|
||||
) -> ConfigFlowResult:
|
||||
"""Zone details form."""
|
||||
errors = _validate_zone_input(user_input)
|
||||
|
||||
if user_input is not None and not errors:
|
||||
zone_options = self.zone_options.copy()
|
||||
zone_id = self.selected_zone
|
||||
zone_options[zone_id] = _fix_input_types(user_input)
|
||||
|
||||
# Delete zone entry if zone_name is omitted
|
||||
if CONF_ZONE_NAME not in zone_options[zone_id]:
|
||||
zone_options.pop(zone_id)
|
||||
|
||||
return self.async_create_entry(
|
||||
title="",
|
||||
data={OPTIONS_ARM: self.arm_options, OPTIONS_ZONES: zone_options},
|
||||
)
|
||||
|
||||
existing_zone_settings = self.zone_options.get(self.selected_zone, {})
|
||||
|
||||
return self.async_show_form(
|
||||
step_id="zone_details",
|
||||
description_placeholders={CONF_ZONE_NUMBER: self.selected_zone},
|
||||
data_schema=vol.Schema(
|
||||
{
|
||||
vol.Optional(
|
||||
CONF_ZONE_NAME,
|
||||
description={
|
||||
"suggested_value": existing_zone_settings.get(
|
||||
CONF_ZONE_NAME
|
||||
)
|
||||
},
|
||||
): str,
|
||||
vol.Optional(
|
||||
CONF_ZONE_TYPE,
|
||||
default=existing_zone_settings.get(
|
||||
CONF_ZONE_TYPE, DEFAULT_ZONE_TYPE
|
||||
),
|
||||
): BINARY_SENSOR_DEVICE_CLASSES_SCHEMA,
|
||||
vol.Optional(
|
||||
CONF_ZONE_RFID,
|
||||
description={
|
||||
"suggested_value": existing_zone_settings.get(
|
||||
CONF_ZONE_RFID
|
||||
)
|
||||
},
|
||||
): str,
|
||||
vol.Optional(
|
||||
CONF_ZONE_LOOP,
|
||||
description={
|
||||
"suggested_value": existing_zone_settings.get(
|
||||
CONF_ZONE_LOOP
|
||||
)
|
||||
},
|
||||
): str,
|
||||
vol.Optional(
|
||||
CONF_RELAY_ADDR,
|
||||
description={
|
||||
"suggested_value": existing_zone_settings.get(
|
||||
CONF_RELAY_ADDR
|
||||
)
|
||||
},
|
||||
): str,
|
||||
vol.Optional(
|
||||
CONF_RELAY_CHAN,
|
||||
description={
|
||||
"suggested_value": existing_zone_settings.get(
|
||||
CONF_RELAY_CHAN
|
||||
)
|
||||
},
|
||||
): str,
|
||||
}
|
||||
),
|
||||
errors=errors,
|
||||
)
|
||||
|
||||
|
||||
def _validate_zone_input(zone_input: dict[str, Any] | None) -> dict[str, str]:
|
||||
if not zone_input:
|
||||
return {}
|
||||
errors = {}
|
||||
|
||||
# CONF_RELAY_ADDR & CONF_RELAY_CHAN are inclusive
|
||||
if (CONF_RELAY_ADDR in zone_input and CONF_RELAY_CHAN not in zone_input) or (
|
||||
CONF_RELAY_ADDR not in zone_input and CONF_RELAY_CHAN in zone_input
|
||||
):
|
||||
errors["base"] = "relay_inclusive"
|
||||
|
||||
# The following keys must be int
|
||||
for key in (CONF_ZONE_NUMBER, CONF_ZONE_LOOP, CONF_RELAY_ADDR, CONF_RELAY_CHAN):
|
||||
if key in zone_input:
|
||||
try:
|
||||
int(zone_input[key])
|
||||
except ValueError:
|
||||
errors[key] = "int"
|
||||
|
||||
# CONF_ZONE_LOOP depends on CONF_ZONE_RFID
|
||||
if CONF_ZONE_LOOP in zone_input and CONF_ZONE_RFID not in zone_input:
|
||||
errors[CONF_ZONE_LOOP] = "loop_rfid"
|
||||
|
||||
# CONF_ZONE_LOOP must be 1-4
|
||||
if (
|
||||
CONF_ZONE_LOOP in zone_input
|
||||
and zone_input[CONF_ZONE_LOOP].isdigit()
|
||||
and int(zone_input[CONF_ZONE_LOOP]) not in list(range(1, 5))
|
||||
):
|
||||
errors[CONF_ZONE_LOOP] = "loop_range"
|
||||
|
||||
return errors
|
||||
|
||||
|
||||
def _fix_input_types(zone_input: dict[str, Any]) -> dict[str, Any]:
|
||||
"""Convert necessary keys to int.
|
||||
|
||||
Since ConfigFlow inputs of type int cannot default to an empty string, we collect the values below as
|
||||
strings and then convert them to ints.
|
||||
"""
|
||||
|
||||
for key in (CONF_ZONE_LOOP, CONF_RELAY_ADDR, CONF_RELAY_CHAN):
|
||||
if key in zone_input:
|
||||
zone_input[key] = int(zone_input[key])
|
||||
|
||||
return zone_input
|
||||
|
||||
|
||||
def _device_already_added(
|
||||
current_entries: list[ConfigEntry], user_input: dict[str, Any], protocol: str | None
|
||||
) -> bool:
|
||||
"""Determine if entry has already been added to HA."""
|
||||
user_host = user_input.get(CONF_HOST)
|
||||
user_port = user_input.get(CONF_PORT)
|
||||
user_path = user_input.get(CONF_DEVICE_PATH)
|
||||
user_baud = user_input.get(CONF_DEVICE_BAUD)
|
||||
|
||||
for entry in current_entries:
|
||||
entry_host = entry.data.get(CONF_HOST)
|
||||
entry_port = entry.data.get(CONF_PORT)
|
||||
entry_path = entry.data.get(CONF_DEVICE_PATH)
|
||||
entry_baud = entry.data.get(CONF_DEVICE_BAUD)
|
||||
|
||||
if (
|
||||
protocol == PROTOCOL_SOCKET
|
||||
and user_host == entry_host
|
||||
and user_port == entry_port
|
||||
):
|
||||
return True
|
||||
|
||||
if (
|
||||
protocol == PROTOCOL_SERIAL
|
||||
and user_baud == entry_baud
|
||||
and user_path == entry_path
|
||||
):
|
||||
return True
|
||||
|
||||
return False
|
||||
@@ -0,0 +1,44 @@
|
||||
"""Constants for the AlarmDecoder component."""
|
||||
|
||||
CONF_ALT_NIGHT_MODE = "alt_night_mode"
|
||||
CONF_AUTO_BYPASS = "auto_bypass"
|
||||
CONF_CODE_ARM_REQUIRED = "code_arm_required"
|
||||
CONF_DEVICE_BAUD = "device_baudrate"
|
||||
CONF_DEVICE_PATH = "device_path"
|
||||
CONF_RELAY_ADDR = "zone_relayaddr"
|
||||
CONF_RELAY_CHAN = "zone_relaychan"
|
||||
CONF_ZONE_LOOP = "zone_loop"
|
||||
CONF_ZONE_NAME = "zone_name"
|
||||
CONF_ZONE_NUMBER = "zone_number"
|
||||
CONF_ZONE_RFID = "zone_rfid"
|
||||
CONF_ZONE_TYPE = "zone_type"
|
||||
|
||||
DEFAULT_ALT_NIGHT_MODE = False
|
||||
DEFAULT_AUTO_BYPASS = False
|
||||
DEFAULT_CODE_ARM_REQUIRED = True
|
||||
DEFAULT_DEVICE_BAUD = 115200
|
||||
DEFAULT_DEVICE_HOST = "alarmdecoder"
|
||||
DEFAULT_DEVICE_PATH = "/dev/ttyUSB0"
|
||||
DEFAULT_DEVICE_PORT = 10000
|
||||
DEFAULT_ZONE_TYPE = "window"
|
||||
|
||||
DEFAULT_ARM_OPTIONS = {
|
||||
CONF_ALT_NIGHT_MODE: DEFAULT_ALT_NIGHT_MODE,
|
||||
CONF_AUTO_BYPASS: DEFAULT_AUTO_BYPASS,
|
||||
CONF_CODE_ARM_REQUIRED: DEFAULT_CODE_ARM_REQUIRED,
|
||||
}
|
||||
DEFAULT_ZONE_OPTIONS: dict = {}
|
||||
|
||||
DOMAIN = "alarmdecoder"
|
||||
|
||||
OPTIONS_ARM = "arm_options"
|
||||
OPTIONS_ZONES = "zone_options"
|
||||
|
||||
PROTOCOL_SERIAL = "serial"
|
||||
PROTOCOL_SOCKET = "socket"
|
||||
|
||||
SIGNAL_PANEL_MESSAGE = "alarmdecoder.panel_message"
|
||||
SIGNAL_REL_MESSAGE = "alarmdecoder.rel_message"
|
||||
SIGNAL_RFX_MESSAGE = "alarmdecoder.rfx_message"
|
||||
SIGNAL_ZONE_FAULT = "alarmdecoder.zone_fault"
|
||||
SIGNAL_ZONE_RESTORE = "alarmdecoder.zone_restore"
|
||||
@@ -0,0 +1,22 @@
|
||||
"""Support for AlarmDecoder-based alarm control panels entity."""
|
||||
|
||||
from homeassistant.helpers.device_registry import DeviceInfo
|
||||
from homeassistant.helpers.entity import Entity
|
||||
|
||||
from .const import DOMAIN
|
||||
|
||||
|
||||
class AlarmDecoderEntity(Entity):
|
||||
"""Define a base AlarmDecoder entity."""
|
||||
|
||||
_attr_has_entity_name = True
|
||||
|
||||
def __init__(self, client):
|
||||
"""Initialize the alarm decoder entity."""
|
||||
self._client = client
|
||||
self._attr_device_info = DeviceInfo(
|
||||
identifiers={(DOMAIN, client.serial_number)},
|
||||
manufacturer="NuTech",
|
||||
serial_number=client.serial_number,
|
||||
sw_version=client.version_number,
|
||||
)
|
||||
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"entity": {
|
||||
"sensor": {
|
||||
"alarm_panel_display": {
|
||||
"default": "mdi:alarm-check"
|
||||
}
|
||||
}
|
||||
},
|
||||
"services": {
|
||||
"alarm_keypress": {
|
||||
"service": "mdi:dialpad"
|
||||
},
|
||||
"alarm_toggle_chime": {
|
||||
"service": "mdi:abc"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"domain": "alarmdecoder",
|
||||
"name": "AlarmDecoder",
|
||||
"codeowners": [],
|
||||
"config_flow": true,
|
||||
"documentation": "https://www.home-assistant.io/integrations/alarmdecoder",
|
||||
"integration_type": "device",
|
||||
"iot_class": "local_push",
|
||||
"loggers": ["adext", "alarmdecoder"],
|
||||
"requirements": ["adext==0.4.3"]
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
"""Support for AlarmDecoder sensors (Shows Panel Display)."""
|
||||
|
||||
from homeassistant.components.sensor import SensorEntity
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
|
||||
from . import AlarmDecoderConfigEntry
|
||||
from .const import SIGNAL_PANEL_MESSAGE
|
||||
from .entity import AlarmDecoderEntity
|
||||
|
||||
|
||||
async def async_setup_entry(
|
||||
hass: HomeAssistant,
|
||||
entry: AlarmDecoderConfigEntry,
|
||||
async_add_entities: AddEntitiesCallback,
|
||||
) -> None:
|
||||
"""Set up for AlarmDecoder sensor."""
|
||||
|
||||
entity = AlarmDecoderSensor(client=entry.runtime_data.client)
|
||||
async_add_entities([entity])
|
||||
|
||||
|
||||
class AlarmDecoderSensor(AlarmDecoderEntity, SensorEntity):
|
||||
"""Representation of an AlarmDecoder keypad."""
|
||||
|
||||
_attr_translation_key = "alarm_panel_display"
|
||||
_attr_name = "Alarm Panel Display"
|
||||
_attr_should_poll = False
|
||||
|
||||
def __init__(self, client):
|
||||
"""Initialize the alarm decoder sensor."""
|
||||
super().__init__(client)
|
||||
self._attr_unique_id = f"{client.serial_number}-display"
|
||||
|
||||
async def async_added_to_hass(self) -> None:
|
||||
"""Register callbacks."""
|
||||
self.async_on_remove(
|
||||
async_dispatcher_connect(
|
||||
self.hass, SIGNAL_PANEL_MESSAGE, self._message_callback
|
||||
)
|
||||
)
|
||||
|
||||
def _message_callback(self, message):
|
||||
if self._attr_native_value != message.text:
|
||||
self._attr_native_value = message.text
|
||||
self.schedule_update_ha_state()
|
||||
@@ -0,0 +1,23 @@
|
||||
alarm_keypress:
|
||||
target:
|
||||
entity:
|
||||
integration: alarmdecoder
|
||||
domain: alarm_control_panel
|
||||
fields:
|
||||
keypress:
|
||||
required: true
|
||||
example: "*71"
|
||||
selector:
|
||||
text:
|
||||
|
||||
alarm_toggle_chime:
|
||||
target:
|
||||
entity:
|
||||
integration: alarmdecoder
|
||||
domain: alarm_control_panel
|
||||
fields:
|
||||
code:
|
||||
required: true
|
||||
example: 1234
|
||||
selector:
|
||||
text:
|
||||
@@ -0,0 +1,101 @@
|
||||
{
|
||||
"config": {
|
||||
"step": {
|
||||
"user": {
|
||||
"title": "Choose AlarmDecoder Protocol",
|
||||
"data": {
|
||||
"protocol": "Protocol"
|
||||
}
|
||||
},
|
||||
"protocol": {
|
||||
"title": "Configure connection settings",
|
||||
"data": {
|
||||
"host": "[%key:common::config_flow::data::host%]",
|
||||
"port": "[%key:common::config_flow::data::port%]",
|
||||
"device_baudrate": "Device Baud Rate",
|
||||
"device_path": "Device Path"
|
||||
},
|
||||
"data_description": {
|
||||
"host": "The hostname or IP address of the AlarmDecoder device that is connected to your alarm panel.",
|
||||
"port": "The port on which AlarmDecoder is accessible (for example, 10000)"
|
||||
}
|
||||
}
|
||||
},
|
||||
"error": {
|
||||
"cannot_connect": "[%key:common::config_flow::error::cannot_connect%]",
|
||||
"unknown": "[%key:common::config_flow::error::unknown%]"
|
||||
},
|
||||
"create_entry": {
|
||||
"default": "Successfully connected to AlarmDecoder."
|
||||
},
|
||||
"abort": {
|
||||
"already_configured": "[%key:common::config_flow::abort::already_configured_device%]"
|
||||
}
|
||||
},
|
||||
"options": {
|
||||
"step": {
|
||||
"init": {
|
||||
"title": "Configure AlarmDecoder",
|
||||
"description": "What would you like to edit?",
|
||||
"data": {
|
||||
"edit_selection": "Edit"
|
||||
}
|
||||
},
|
||||
"arm_settings": {
|
||||
"title": "[%key:component::alarmdecoder::options::step::init::title%]",
|
||||
"data": {
|
||||
"auto_bypass": "Auto Bypass on Arm",
|
||||
"code_arm_required": "Code Required for Arming",
|
||||
"alt_night_mode": "Alternative Night Mode"
|
||||
}
|
||||
},
|
||||
"zone_select": {
|
||||
"title": "[%key:component::alarmdecoder::options::step::init::title%]",
|
||||
"description": "Enter the zone number you'd like to to add, edit, or remove.",
|
||||
"data": {
|
||||
"zone_number": "Zone Number"
|
||||
}
|
||||
},
|
||||
"zone_details": {
|
||||
"title": "[%key:component::alarmdecoder::options::step::init::title%]",
|
||||
"description": "Enter details for zone {zone_number}. To delete zone {zone_number}, leave Zone Name blank.",
|
||||
"data": {
|
||||
"zone_name": "Zone Name",
|
||||
"zone_type": "Zone Type",
|
||||
"zone_rfid": "RF Serial",
|
||||
"zone_loop": "RF Loop",
|
||||
"zone_relayaddr": "Relay Address",
|
||||
"zone_relaychan": "Relay Channel"
|
||||
}
|
||||
}
|
||||
},
|
||||
"error": {
|
||||
"relay_inclusive": "Relay Address and Relay Channel are codependent and must be included together.",
|
||||
"int": "The field below must be an integer.",
|
||||
"loop_rfid": "RF Loop cannot be used without RF Serial.",
|
||||
"loop_range": "RF Loop must be an integer between 1 and 4."
|
||||
}
|
||||
},
|
||||
"services": {
|
||||
"alarm_keypress": {
|
||||
"name": "Key press",
|
||||
"description": "Sends custom keypresses to the alarm.",
|
||||
"fields": {
|
||||
"keypress": {
|
||||
"name": "[%key:component::alarmdecoder::services::alarm_keypress::name%]",
|
||||
"description": "String to send to the alarm panel."
|
||||
}
|
||||
}
|
||||
},
|
||||
"alarm_toggle_chime": {
|
||||
"name": "Toggle chime",
|
||||
"description": "Sends the alarm the toggle chime command.",
|
||||
"fields": {
|
||||
"code": {
|
||||
"name": "Code",
|
||||
"description": "Code to toggle the alarm control panel chime with."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user