Clean up access to config in various integrations (#33759)

This commit is contained in:
springstan authored and GitHub committed 2020-04-08 12:59:38 +02:00
1 parent ba8ae17487
commit c6c7dd10f5
11 files changed
+38 -35

No files matched your search

@@ -187,12 +187,12 @@ def setup(hass, config):
controller = False
if device_type == "socket":
host = device.get(CONF_HOST)
port = device.get(CONF_DEVICE_PORT)
host = device[CONF_HOST]
port = device[CONF_DEVICE_PORT]
controller = AlarmDecoder(SocketDevice(interface=(host, port)))
elif device_type == "serial":
path = device.get(CONF_DEVICE_PATH)
baud = device.get(CONF_DEVICE_BAUD)
path = device[CONF_DEVICE_PATH]
baud = device[CONF_DEVICE_BAUD]
controller = AlarmDecoder(SerialDevice(interface=path))
elif device_type == "usb":
AlarmDecoder(USBDevice.find())