create_tcp_dsmr_reader
accepts loop=None
but always expects a loop. Fixes #36
This commit is contained in:
parent
b31bcd61fc
commit
7c9c59308e
@ -49,12 +49,13 @@ def create_dsmr_reader(port, dsmr_version, telegram_callback, loop=None):
|
|||||||
def create_tcp_dsmr_reader(host, port, dsmr_version,
|
def create_tcp_dsmr_reader(host, port, dsmr_version,
|
||||||
telegram_callback, loop=None):
|
telegram_callback, loop=None):
|
||||||
"""Creates a DSMR asyncio protocol coroutine using TCP connection."""
|
"""Creates a DSMR asyncio protocol coroutine using TCP connection."""
|
||||||
|
if not loop:
|
||||||
|
loop = asyncio.get_event_loop()
|
||||||
protocol, _ = create_dsmr_protocol(
|
protocol, _ = create_dsmr_protocol(
|
||||||
dsmr_version, telegram_callback, loop=None)
|
dsmr_version, telegram_callback, loop=loop)
|
||||||
conn = loop.create_connection(protocol, host, port)
|
conn = loop.create_connection(protocol, host, port)
|
||||||
return conn
|
return conn
|
||||||
|
|
||||||
|
|
||||||
class DSMRProtocol(asyncio.Protocol):
|
class DSMRProtocol(asyncio.Protocol):
|
||||||
"""Assemble and handle incoming data into complete DSM telegrams."""
|
"""Assemble and handle incoming data into complete DSM telegrams."""
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user