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

Update {Match} regex for Hideki Module #1071

Merged
merged 10 commits into from
Jan 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions FHEM/14_Hideki.pm
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
##############################################
# $Id: 14_Hideki.pm 21666 2020-04-13 21:14:53Z Sidey $
# $Id: 14_Hideki.pm 21666 2022-01-24 20:29:33Z sidey79 $
# The file is taken from the SIGNALduino project
# see http://www.fhemwiki.de/wiki/SIGNALduino
# and was modified by a few additions
# to support Hideki Sensors
# S. Butzek, HJGode, Ralf9 2015-2017
# S. Butzek 2018-2022
#
# changed the way crc and decrypt is used hjgode 20171129

Expand All @@ -24,10 +25,10 @@ Hideki_Initialize($)
my ($hash) = @_;


$hash->{Match} = "^P12#75[A-F0-9]{17,30}"; # Laenge (Anhahl nibbles nach 0x75 )noch genauer spezifizieren
$hash->{DefFn} = "Hideki_Define";
$hash->{UndefFn} = "Hideki_Undef";
$hash->{ParseFn} = "Hideki_Parse";
$hash->{Match} = qr/^P12#75[A-F0-9]{14,30}/; # Laenge (Anhahl nibbles nach 0x75 )noch genauer spezifizieren
$hash->{DefFn} = \&Hideki_Define;
$hash->{UndefFn} = \&Hideki_Undef;
$hash->{ParseFn} = \&Hideki_Parse;
$hash->{AttrList} = "do_not_notify:0,1 showtime:0,1"
." ignore:0,1"
." windDirCorr windSpeedCorr"
Expand Down
2 changes: 1 addition & 1 deletion controls_signalduino.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ UPD 2020-05-26_11:51:12 20465 FHEM/10_SD_GT.pm
UPD 2021-11-28_11:34:02 23375 FHEM/10_SD_Rojaflex.pm
UPD 2021-08-11_21:38:30 10096 FHEM/14_BresserTemeo.pm
UPD 2020-08-17_22:17:34 13964 FHEM/14_FLAMINGO.pm
UPD 2020-04-13_23:15:56 19347 FHEM/14_Hideki.pm
UPD 2022-01-23_20:41:57 19373 FHEM/14_Hideki.pm
UPD 2020-10-03_11:48:15 11170 FHEM/14_SD_AS.pm
UPD 2021-07-13_20:29:34 29223 FHEM/14_SD_BELL.pm
UPD 2022-01-24_20:32:40 167159 FHEM/14_SD_UT.pm
Expand Down
54 changes: 54 additions & 0 deletions t/FHEM/14_Hideki/09_ParseData.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/usr/bin/env perl
use strict;
use warnings;

use Test2::V0;
use File::Basename;

# Testtool which supports DMSG Tests from SIGNALDuino_tool
use Test2::SIGNALduino::RDmsg;

our %defs;
our $init_done;

my $module = basename (dirname(__FILE__));


sub runTest {
my $ioName = shift;
my $ioHash = $defs{$ioName};
#use Data::Dumper;
#print Dumper(@Test::RDmsg::JSONTestList);
my $filepath = dirname(__FILE__);
push @Test2::SIGNALduino::RDmsg::JSONTestList, {
testname => q[Testdata with corrupt Hideki data],
url => qq[$filepath/testData.json],
};
if ( scalar @Test2::SIGNALduino::RDmsg::JSONTestList > 0 ) {


plan( scalar @Test2::SIGNALduino::RDmsg::JSONTestList);
for my $maintest (@Test2::SIGNALduino::RDmsg::JSONTestList)
{
subtest $maintest->{testname} => sub {
Test2::SIGNALduino::RDmsg::dmsgCheck($maintest,$module,$ioHash);
};
}
}
exit(0);
}

sub waitDone {

if ($init_done)
{
runTest(@_);
} else {
InternalTimer(time()+0.5, &waitDone,@_);
}

}

waitDone('dummyDuino');

1;
43 changes: 43 additions & 0 deletions t/FHEM/14_Hideki/testData.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
[
{"name":"Hideki", "id":"12", "module":"Hideki", "data": [
{
"dmsg":"P12#75A3", "comment":"to short, causes error", "user":"unknown",
"internals": { "NAME": "" },
"readings": {},
"minProtocolVersion":"1.42", "revision_entry":"SD_ProtocolData.pm 3.4.4 2022-01-15 12:25:06Z elektron-bbs $",
"revision_modul":"",
"rmsg":"",
"MatchCheckFail": true
},
{
"dmsg":"P12#75EC4675F0406F6D", "comment":"to short", "user":"unknown",
"internals": {"NAME": "Hideki_31_1", "DEF": "Hideki_31_1 Hideki Hideki_31_1" },
"readings": {"temperature": "1"},
"minProtocolVersion":"1.42", "revision_entry":"SD_ProtocolData.pm 3.4.4 2022-01-15 12:25:06Z elektron-bbs $",
"revision_modul":"",
"rmsg":"MC;LL=-952;LH=1003;SL=-452;SH=526;D=51E4676A3F0FEC2693;C=488;L=72;R=247;"
},
{

"dmsg":"P12#75E806350F40942103", "comment":"temperature only", "user":"ralf9",
"internals": {"NAME": "Hideki_31_1", "DEF": "Hideki_31_1 Hideki Hideki_31_1" },
"readings": {"temperature": "1.1"},
"minProtocolVersion":"1.42", "revision_entry":"SD_ProtocolData.pm 3.4.4 2022-01-15 12:25:06Z elektron-bbs $",
"revision_modul":"",
"rmsg":"MC;LL=-1038;LH=918;SL=-562;SH=412;D=547D19FA9C3FFBD6BD8;C=488;L=73"
},
{

"dmsg":"P12#75E80675F8402311", "comment":"temperature only short", "user":"ralf9",
"internals": {"NAME": "Hideki_31_1", "DEF": "Hideki_31_1 Hideki Hideki_31_1" },
"readings": {"temperature": "0.8"},
"minProtocolVersion":"1.42", "revision_entry":"SD_ProtocolData.pm 3.4.4 2022-01-15 12:25:06Z elektron-bbs $",
"revision_modul":"",
"rmsg":"MC;LL=-1043;LH=919;SL=-503;SH=428;D=51F467EA3E0FECEEEE;C=482;L=71;s1;b1;"
}



]
}
]