diff --git a/homeassistant/components/alarmdecoder/__init__.py b/homeassistant/components/alarmdecoder/__init__.py index 93c0746a812..833156e98b2 100644 --- a/homeassistant/components/alarmdecoder/__init__.py +++ b/homeassistant/components/alarmdecoder/__init__.py @@ -24,6 +24,7 @@ CONF_DEVICE_BAUD = "baudrate" CONF_DEVICE_PATH = "path" CONF_DEVICE_PORT = "port" CONF_DEVICE_TYPE = "type" +CONF_AUTO_BYPASS = "autobypass" CONF_PANEL_DISPLAY = "panel_display" CONF_ZONE_NAME = "name" CONF_ZONE_TYPE = "type" @@ -39,6 +40,7 @@ DEFAULT_DEVICE_PORT = 10000 DEFAULT_DEVICE_PATH = "/dev/ttyUSB0" DEFAULT_DEVICE_BAUD = 115200 +DEFAULT_AUTO_BYPASS = False DEFAULT_PANEL_DISPLAY = False DEFAULT_ZONE_TYPE = "opening" @@ -102,6 +104,7 @@ CONFIG_SCHEMA = vol.Schema( vol.Optional( CONF_PANEL_DISPLAY, default=DEFAULT_PANEL_DISPLAY ): cv.boolean, + vol.Optional(CONF_AUTO_BYPASS, default=DEFAULT_AUTO_BYPASS): cv.boolean, vol.Optional(CONF_ZONES): {vol.Coerce(int): ZONE_SCHEMA}, } ) diff --git a/homeassistant/components/alarmdecoder/alarm_control_panel.py b/homeassistant/components/alarmdecoder/alarm_control_panel.py index 66960ca3034..70f3e67e15b 100644 --- a/homeassistant/components/alarmdecoder/alarm_control_panel.py +++ b/homeassistant/components/alarmdecoder/alarm_control_panel.py @@ -35,7 +35,7 @@ ALARM_KEYPRESS_SCHEMA = vol.Schema({vol.Required(ATTR_KEYPRESS): cv.string}) def setup_platform(hass, config, add_entities, discovery_info=None): """Set up for AlarmDecoder alarm panels.""" - device = AlarmDecoderAlarmPanel() + device = AlarmDecoderAlarmPanel(discovery_info["autobypass"]) add_entities([device]) def alarm_toggle_chime_handler(service): @@ -66,7 +66,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None): class AlarmDecoderAlarmPanel(AlarmControlPanel): """Representation of an AlarmDecoder-based alarm panel.""" - def __init__(self): + def __init__(self, auto_bypass): """Initialize the alarm panel.""" self._display = "" self._name = "Alarm Panel" @@ -80,6 +80,7 @@ class AlarmDecoderAlarmPanel(AlarmControlPanel): self._programming_mode = None self._ready = None self._zone_bypassed = None + self._auto_bypass = auto_bypass async def async_added_to_hass(self): """Register callbacks.""" @@ -158,11 +159,15 @@ class AlarmDecoderAlarmPanel(AlarmControlPanel): def alarm_arm_away(self, code=None): """Send arm away command.""" if code: + if self._auto_bypass: + self.hass.data[DATA_AD].send(f"{code!s}6#") self.hass.data[DATA_AD].send(f"{code!s}2") def alarm_arm_home(self, code=None): """Send arm home command.""" if code: + if self._auto_bypass: + self.hass.data[DATA_AD].send(f"{code!s}6#") self.hass.data[DATA_AD].send(f"{code!s}3") def alarm_arm_night(self, code=None):