Merge pull request #15 from AlexMekkering/telegram_pass
Pass lines to parser including line endings
This commit is contained in:
commit
9d8cad8b46
@ -84,9 +84,11 @@ class DSMRProtocol(asyncio.Protocol):
|
|||||||
|
|
||||||
def handle_lines(self):
|
def handle_lines(self):
|
||||||
"""Assemble incoming data into single lines."""
|
"""Assemble incoming data into single lines."""
|
||||||
while "\r\n" in self.buffer:
|
crlf = "\r\n"
|
||||||
line, self.buffer = self.buffer.split("\r\n", 1)
|
while crlf in self.buffer:
|
||||||
|
line, self.buffer = self.buffer.split(crlf, 1)
|
||||||
self.log.debug('got line: %s', line)
|
self.log.debug('got line: %s', line)
|
||||||
|
line += crlf # add the trailing crlf again
|
||||||
|
|
||||||
# Telegrams need to be complete because the values belong to a
|
# Telegrams need to be complete because the values belong to a
|
||||||
# particular reading and can also be related to eachother.
|
# particular reading and can also be related to eachother.
|
||||||
|
Loading…
Reference in New Issue
Block a user