-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
verify 1st Revolt checksum byte #956
Conversation
Codecov Report
@@ Coverage Diff @@
## master #956 +/- ##
==========================================
+ Coverage 58.15% 58.32% +0.17%
==========================================
Files 105 106 +1
Lines 8409 8446 +37
Branches 1314 1315 +1
==========================================
+ Hits 4890 4926 +36
Misses 2634 2634
- Partials 885 886 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
Shall I also report an issue for this? TIA for your feedback! |
Hi Gerno, tanks for your PR. Issue isn't needed, but we need some of the data which has the wrong checksum and maybe also some data which is decoded. Currently we have this data for tests: I think we will write a test against the new sub. Noting really complex, but similar to them to cover nearby all code paths in the new sub. https://github.com/RFD-FHEM/RFFHEM/blob/master/t/SD_Protocols/02_postDemo_EM.t What i see so far, the tests, which are currently running, had no problem with your change. |
Perfect, thanks for the super-quick feedback!! For now, here are two examples of valid messages from two different devices:
Plus two examples of invalid messages from the first device, so they should start with (The first lacks the CRC, so would be blocked anyways after changing min_length.)
Plus some error cases from the 2nd device with my patch blocking the message:
I will look into writing testcases later this week. |
484f11a
to
b7ef584
Compare
I now tested the patch successfully on a FHEM test instance (using FHEMduino hardware with RXB6 receiver) updated to RFFHEM master branch with valid messages from a real Revolt device and messages with invalid CRC from an Arduino faking Revolt messages. :) I also slightly improved log output to print full message in case of checksum errors so the (experienced) user can see which message (from which Revolt device -- each message starts with the device id) was dropped. I also wrote a testcase as you suggested using the 2nd and 4th example from my last comment. I'm however not that fluent in reading results from Github PRs, so please let me know if the test does what it shall do! Finally, I updated this PR's description and added an entry to |
b7ef584
to
ce833f2
Compare
Sorry, fixed the test plan. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please update $VERSION in the two changed files by 0.01 ?
To avoid wrong reads and especially invalid autocreates for Revolt NC-546x energy cost meters, add verification of the 1st Revolt checksum byte. Check based on (old) analysis from mehf, see Forum #14292. There's another checksum(?) byte which I didn't understand yet. Also increase minimum length of messages to assure we received the checksum byte. In general, this patch might slightly decrease probability of receiving far devices, but I think avoiding erronous reads is more important. NOTE: For a patch for the svn.fhem.de version of SIGNALduino, see https://forum.fhem.de/index.php/topic,58397.msg1151053.html#msg1151053.
ce833f2
to
0743d30
Compare
Sure, done. |
Aus meiner Sicht können wir den PR übernehmen. |
Aus meiner Sicht spricht nichts dagegen. Ob die Daten in dem JSON noch passen, könnte ja @gernot-h selbst prüfen. |
Da wir es automatisch testen ob das dmsg Ergebnis zum soll stimmt, braucht er das aus meiner Sicht nicht prüfen |
Habe inzwischen etwas Übung mit dem dekodieren der Telegramme, daher habe ich mir https://github.com/RFD-FHEM/SIGNALduino_TOOL/blob/33ab9464e3ba54c6d2572764c13c3553d240b7b9/FHEM/lib/SD_Device_ProtocolList.json#L698" auch noch kurz angeschaut, passt exakt zu meinem Kenntnisstand. Und die Checksumme sollte auch passen, mein Patch müsste also damit auch zufrieden sein. |
Release 3.5.2 10_SD_Rojaflex.pm new: Module for rojaflex remote controls 90_SIGNALduino_un.pm changed: fix some PerlCritic hints (#914) changed: revised commandref 00_SIGNALduino.pm: feature: xFSK processing feature: Added support for directio and none. feature: Extension for "get sduino ccreg" (#918) feature: parse subs optimized (#926) feature: update reading config when change settings (#948) feature: Allow incremental addition of match list entries (#1026) change: added N to send SN xFSK sendCommand change: added new sub SIGNALduino_calcRSSI to simplification code change: revised Parse_MN and loglevel change: revised logoutput text SIGNALduino_Get_Command change: rename "get raw" to "get rawmsg" (#925) feature: added commandref rfmode & cc1101_reg_user feature: added hardware ESP32cc1101, MAPLEMINI_F103CB on attribute feature: added new attrib rfmode to changed to xFSK & revised commandref feature: added separat sub SIGNALduino_Attr_rfmode feature: added set cmd LaCrossePairForSec (for LaCrosse bugfix: SIGNALduino_CheckccConfResponse is more robust #1015 (#1031) bugfix: fix PERL WARNING (#895) (#972) bugfix: get ccreg command caused stacktrace #898 bugfix: Bugfix define with hostname 901 (#904) bugfix: Wrong version assignment fixed Bugfix, module runs now without fhemweb instance bugfix: display protocol list (#947) bugfix: require 99_Utils only if really needed (#950) bugfix: corrected incorrect logoutput (#951) bugfix: Fix Multiple send delay (#941) bugfix: Fixes high CPU and MEM usage in patternExists (#988) SD_Protocols.pm: change: moved subs for converting in own package ConvLaCrosse, ConvKoppFreeControl and ConvPCA301 bugfix: Hideki fix inverted message (#974) SD_ProtocolData.pm feature: added rfmode, register rubric & comments change: fix perlcritic Severity 3 - hard tabs feature: Added crc checksum verification Revolt (#956) 14_SD_WS.pm: feature: protocol 27 for sensor EFS-3110A (#890) feature: protocol 106 for GT-TMBBQ-0 feature: protocol 110 for ADE WS1907 Weather station (#970) feature: protocol 111 for TS-FT002 water tank level (#1000) feature: protocol 113 for GFGT 433 B1 Wireless Grill sensor (#1003) feature: new protocol 108 for BRESSER 5-in-1 Weather Center and BRESSER Professional Rain Gauge (#973) feature: protocol 115 for Bresser 6-in-1 and 5-in-1 Comfort Wetter Center (#1010) feature: new protocol 107 for Fine Offset WH51 (#1055) feature: new protocol 116 for Fine Offset WH57 (#1061) bugfix: Update protocol 64 for sensor WH2A (#1009) bugfix: Conrad S522 protocol 33 no reading batteryState (#1042) 14_SD_WS07.pm: feature: protocol definition 7.1 for Mebus HQ7312-2 (#1050) 14_FLAMINGO.pm: change: Perlcritic (#887) 14_SD_UT.pm: change: PerlCritic (#877) feature: new protocol 105 for remote control BF-301 feature: decode and send protocol 56 remote control AC114-01B (#910) feature: decode and send protocol for Visivo remote control feature: Remote control SEAV BeSmart S4 (#933) feature: new protocol 114 for TR401 (#1002) 14_SD_BELL.pm: change: PerlCritic (#877) change: Adjusted little things (#937) feature: added AVANTEK Wireless doorbell & LED night light (#981)
NOTE: This is a port of a patch developed for the svn.fhem.de version of SIGNALduino code, see also https://forum.fhem.de/index.php/topic,58397.msg1151053.html#msg1151053. I'm interested in getting this change into the SIGNALduino code distributed via svn.fhem.de, so I hope this project is the place to prepare changes for FHEM integration!
Change description:
To avoid wrong reads and especially invalid autocreates for Revolt NC-546x
energy cost meters, add verification of the 1st Revolt checksum byte.
Check based on (old) analysis from mehf, see Forum #14292. There's
another checksum(?) byte which I didn't understand yet.
Also increase minimum length of messages to assure we received the checksum
byte. In general, this patch might slightly decrease probability of receiving
far devices, but I think avoiding erronous reads is more important.
Fix the frequent reception of invalid messages leading to autocreation of non-existing devices by verifying the checksum.
I see frequent additions of non-existant Revolt devices (perhaps one per week) obviously caused by reception errors. Here's an example from a FHEM instance actually receiving two devices:
Drop messages without checksum byte or with invalid checksum.
There might be seldom cases where this change prevents reception of far devices with incomplete messages as we'll drop any message without checksum byte which could be parsed before introducing my change.