Fix auto_bypass in alarmdecoder (#30961)

* Fix auto_bypass in alarmdecoder

* Address review comments: used dict[key] and renamed variable

* Use dict[key] for required or optional config keys with default values
This commit is contained in:
springstan authored and Paulus Schoutsen committed 2020-02-02 15:39:32 -08:00
1 parent d382b0ba42
commit 11fcb2cc7f
2 files changed
+16 -9

No files matched your search

@@ -118,11 +118,12 @@ def setup(hass, config):
conf = config.get(DOMAIN)
restart = False
device = conf.get(CONF_DEVICE)
display = conf.get(CONF_PANEL_DISPLAY)
device = conf[CONF_DEVICE]
display = conf[CONF_PANEL_DISPLAY]
auto_bypass = conf[CONF_AUTO_BYPASS]
zones = conf.get(CONF_ZONES)
device_type = device.get(CONF_DEVICE_TYPE)
device_type = device[CONF_DEVICE_TYPE]
host = DEFAULT_DEVICE_HOST
port = DEFAULT_DEVICE_PORT
path = DEFAULT_DEVICE_PATH
@@ -204,7 +205,9 @@ def setup(hass, config):
hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, stop_alarmdecoder)
load_platform(hass, "alarm_control_panel", DOMAIN, conf, config)
load_platform(
hass, "alarm_control_panel", DOMAIN, {CONF_AUTO_BYPASS: auto_bypass}, config
)
if zones:
load_platform(hass, "binary_sensor", DOMAIN, {CONF_ZONES: zones}, config)