def connect(self, pyelk, address, ratelimit):
"""Connect to the Elk panel.
address: Host to connect to in either
"socket://IP.Add.re.ss:Port" or "/dev/ttyUSB0" format.
ratelimit: rate limit for outgoing events
"""
self._connection = serial.serial_for_url(address, timeout=1)
self._connection_thread = serial.threaded.ReaderThread(self._connection, SerialInputHandler)
self._connection_thread.start()
self._connection_transport, self._connection_protocol = self._connection_thread.connect()
self._connection_protocol.set_pyelk(pyelk)
self._connection_output = SerialOutputHandler(ratelimit)
self._connection_output.set_pyelk(pyelk)
_LOGGER.debug('ReaderThread created')
评论列表
文章目录