aequitas / python-rflink

MIT License
30 stars 27 forks source link

RFLINK invalid data #41

Closed FrColin closed 4 years ago

FrColin commented 4 years ago

Hello, I am using RFLINK in the latest version RFLink firmware R48 with home assistant I got many message in hass log: [rflink.protocol] dropping invalid data: 20;84;Debug;RTS P1;a63f33003cf000665a5a;

the packet is not handled by the parser since the "Debug" word use lower case and the regular expression in the valid_packet function didn't mach these

my be we can add this to parser.y

# 20;84;Debug;RTS P1;a63f33003cf000665a5a; PACKET_DEBUGRTS = DELIM.join(["20", SEQUENCE, "Debug", DATA])

FrColin commented 4 years ago

since there is a space in the message we need also need to change the DATA regexp to

DEBUG_DATARTS = "[a-zA-Z0-9;= ]+"

so the correct re is

PACKET_DEBUGRTS = DELIM.join(["20", SEQUENCE, "Debug", DEBUG_DATA_RTS])

tested with

from rflink.parser import valid_packet valid_packet("20;84;Debug;RTS P1;a63f33003cf000665a5a;") True

aequitas commented 4 years ago

Sound good, can you make a PR for this?

FrColin commented 4 years ago

Ok PR done