Skip to content
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

sub SIGNALduino_CheckccConfResponse - make it more robust #1015

Closed
HomeAutoUser opened this issue Sep 1, 2021 · 8 comments · Fixed by #1031
Closed

sub SIGNALduino_CheckccConfResponse - make it more robust #1015

HomeAutoUser opened this issue Sep 1, 2021 · 8 comments · Fixed by #1031
Assignees

Comments

@HomeAutoUser
Copy link
Contributor

Expected Behavior

  • make it more robust so as not to receive a warning

Actual Behavior

2021.07.08 12:21:08.516 1: PERL WARNING: Illegal hexadecimal digit '%' ignored at ./FHEM/00_SIGNALduino.pm line 1180.

RFFHEM/FHEM/00_SIGNALduino.pm

Lines 1174 to 1181 in a07524a

sub SIGNALduino_CheckccConfResponse {
my (undef,$str) = split('=', $_[1]);
my $var;
my %r = ( '0D'=>1,'0E'=>1,'0F'=>1,'10'=>1,'11'=>1,'12'=>1,'1B'=>1,'1D'=>1, '15'=>1);
foreach my $a (sort keys %r) {
$var = substr($str,(hex($a)-13)*2, 2);
$r{$a} = hex($var);
}

Steps to Reproduce the Problem

  1. feed the sub with an invalid value (example: 216%E857C43023B900070018146C040091) // value can arise due to an incorrect transmission from serial
  2. look at logfile

Specifications

  • Microcontroller:
    independent
  • Version (Firmware):
    independent
  • Versionmodul (FHEM Module):
    3.5.2+20210813
@HomeAutoUser
Copy link
Contributor Author

Wie denkt Ihr über diesen Fall?
Es gibt ja 2 Möglichkeiten vom Handeln.

  1. einfach nichts zurück geben, via return und Ende der Abfrage
    oder
  2. die Abfrage wiederholen (birgt aber Gefahr, das man bis hin zu einer Schleife kommen könnte, wenn immer falsche Daten kommen)

@sidey79
Copy link
Contributor

sidey79 commented Sep 16, 2021

Spontan würde ich zur Verifizierung der Daten tendieren und ein Return zurück geben.

@HomeAutoUser
Copy link
Contributor Author

Nicht das du denkst @sidey79 wir sind nicht mehr aktiv :-P hier.

Man müsste darüber denken wieweit man das treibt. Ich könnte mir vorstellen nur ein undef bei falsch zurück zu geben und eine Logausgabe für den User. Wenn er mitbekommt, es kommt nichts, schaut dieser ins Log oder probiert es erneut.

Wir stellst du dir eine Verifizierung vor?
Was würde man machen wollen wenn ein nicht korrekter Wert kommt?

@sidey79
Copy link
Contributor

sidey79 commented Oct 8, 2021

Alles gut, ich bin ja selbst gerade nicht sonderlich aktiv.

Spontan würde mir einfallen dass ein = enthalten sein muss und wir rechts davon nur hex Werte erlauben die in der Anzahl von %r vorhanden sein müssen.

@HomeAutoUser
Copy link
Contributor Author

@sidey79 ich wollte einen neuen Branch erstellen hier um die Testergebnisse zu sehen. Wurden die Berechtigungen geändert?
Ich würde hierauf HomeAutoUser@98eeb76 aufbauen.

@sidey79
Copy link
Contributor

sidey79 commented Nov 1, 2021

Ich habe nichts geändert. Du kannst in diesem Repo also keinen neuen Branch erstellen?

@HomeAutoUser
Copy link
Contributor Author

Nun klappte es. Ich habe es diesmal so https://docs.github.com/en/github/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-and-deleting-branches-within-your-repository gemacht und nur via GitDesktop ging es nicht. Wer weiss ...

HomeAutoUser added a commit that referenced this issue Nov 1, 2021
HomeAutoUser added a commit that referenced this issue Nov 4, 2021
* Update 00_SIGNALduino.pm
  #1015

* Update 02_SIGNALduino_CheckccConfResponse.t
  test added with wrong value
@HomeAutoUser
Copy link
Contributor Author

Dieser Issues wurde erledigt mit #1031

@sidey79 sidey79 linked a pull request Nov 9, 2021 that will close this issue
7 tasks
sidey79 added a commit that referenced this issue Jan 16, 2022
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants