mirror of
https://github.com/fhem/fhem-mirror.git
synced 2024-11-22 09:49:50 +00:00
- adjusted some "unknown" events for easier parsing in 93_DBLog.pm
- adapted 93_DBLog.pm parser to changes in 11_FHT.pm - workarounds for undefined variables to prevent perl from complaining here and there git-svn-id: https://svn.fhem.de/fhem/trunk@166 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
4a7c27ccf5
commit
05a89888d8
@ -334,7 +334,7 @@ FS20_Parse($$)
|
||||
}
|
||||
|
||||
my $v = $codes{$cde};
|
||||
$v = "unknown:$cde" if(!defined($v));
|
||||
$v = "unknown_$cde" if(!defined($v));
|
||||
$v .= " $dur" if($dur);
|
||||
|
||||
my $def = $defptr{"$dev $btn"};
|
||||
@ -360,7 +360,7 @@ FS20_Parse($$)
|
||||
my $btn_four = hex2four($btn);
|
||||
Log 3, "FS20 Unknown device $dev ($dev_four), Button $btn ($btn_four) Code $cde ($v), " .
|
||||
"please define it";
|
||||
return "UNDEFINED FS20 $dev/$btn/$cde";
|
||||
return "UNDEFINED FS20: $dev/$btn/$cde";
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -320,7 +320,7 @@ FHT_Parse($$)
|
||||
|
||||
if(length($cde) < 6) {
|
||||
Log GetLogLevel($name,2), "FHT Unknown code from $name : $cde";
|
||||
$def->{CHANGED}[0] = "unknown code $cde";
|
||||
$def->{CHANGED}[0] = "unknown_$cde";
|
||||
return $name;
|
||||
}
|
||||
|
||||
@ -346,7 +346,7 @@ FHT_Parse($$)
|
||||
|
||||
if(!$cmd) {
|
||||
Log 4, "FHT $name (Unknown: $cde => $val)";
|
||||
$def->{CHANGED}[0] = "unknown $cde: $val";
|
||||
$def->{CHANGED}[0] = "unknown_$cde: $val";
|
||||
return $name;
|
||||
}
|
||||
|
||||
@ -375,12 +375,12 @@ FHT_Parse($$)
|
||||
my $fv = sprintf("%d%%", int(100*$val/255+0.5));
|
||||
|
||||
if($sval =~ m/.6/) { $val = "$fv" }
|
||||
elsif($sval =~ m/.8/) { $val = "offset $fv" }
|
||||
elsif($sval =~ m/.8/) { $val = "offset: $fv" }
|
||||
elsif($sval =~ m/.a/) { $val = "lime-protection" }
|
||||
elsif($sval =~ m/.c/) { $val = "synctime" }
|
||||
elsif($sval =~ m/.e/) { $val = "test" }
|
||||
elsif($sval =~ m/.f/) { $val = "pair" }
|
||||
else { $val = "Unknown: $sval = $fv" }
|
||||
else { $val = "unknown_$sval: $fv" }
|
||||
|
||||
} elsif($cmd eq "lime-protection") {
|
||||
$val = sprintf("(actuator: %02d%%)", int(100*$val/255 + 0.5));
|
||||
@ -525,6 +525,7 @@ getFhtBuffer($)
|
||||
for(;;) {
|
||||
FHZ_Write($io, "04", "c90185");
|
||||
my $msg = FHZ_ReadAnswer($io, "fhtbuf");
|
||||
if(!defined($msg)) { $msg= ""; }
|
||||
Log 5, "getFhtBuffer: $count $msg";
|
||||
|
||||
return hex(substr($msg, 16, 2)) if($msg && $msg =~ m/^[0-9A-F]+$/i);
|
||||
|
@ -123,13 +123,47 @@ DbLog_ParseEvent($$)
|
||||
}
|
||||
# FHT
|
||||
elsif($type eq "FHT") {
|
||||
if($reading =~ m(-from[12]\ ) || $reading =~ m(-to[12]\ )) {
|
||||
@parts= split(/ /,$event);
|
||||
$reading= $parts[0];
|
||||
$value= $parts[1];
|
||||
$unit= "";
|
||||
}
|
||||
if($reading =~ m(-temp)) { $value=~ s/ \(Celsius\)//; $unit= "°C"; }
|
||||
if($reading =~ m(temp-offset)) { $value=~ s/ \(Celsius\)//; $unit= "°C"; }
|
||||
if($reading eq "actuator") {
|
||||
if($reading =~ m(^actuator[0-9]*)) {
|
||||
if($value eq "lime-protection") {
|
||||
$reading= "actuator-lime-protection";
|
||||
undef $value;
|
||||
}
|
||||
elsif($value =~ m(^offset:)) {
|
||||
$reading= "actuator-offset";
|
||||
@parts= split(/: /,$value);
|
||||
$value= $parts[1];
|
||||
if(defined $value) {
|
||||
$value=~ s/%//; $value= $value*1.; $unit= "%";
|
||||
}
|
||||
}
|
||||
elsif($value =~ m(^unknown_)) {
|
||||
@parts= split(/: /,$value);
|
||||
$reading= "actuator-" . $parts[0];
|
||||
$value= $parts[1];
|
||||
if(defined $value) {
|
||||
$value=~ s/%//; $value= $value*1.; $unit= "%";
|
||||
}
|
||||
}
|
||||
elsif($value eq "synctime") {
|
||||
$reading= "actuator-synctime";
|
||||
undef $value;
|
||||
}
|
||||
elsif($value eq "test") {
|
||||
$reading= "actuator-test";
|
||||
undef $value;
|
||||
}
|
||||
elsif($value eq "pair") {
|
||||
$reading= "actuator-pair";
|
||||
undef $value;
|
||||
}
|
||||
else {
|
||||
$value=~ s/%//; $value= $value*1.; $unit= "%";
|
||||
}
|
||||
@ -198,6 +232,10 @@ DbLog_Log($$)
|
||||
my $reading= $r[0];
|
||||
my $value= $r[1];
|
||||
my $unit= $r[2];
|
||||
if(!defined $reading) { $reading= ""; }
|
||||
if(!defined $value) { $value= ""; }
|
||||
if(!defined $unit) { $unit= ""; }
|
||||
|
||||
|
||||
my $is= "(TIMESTAMP, DEVICE, TYPE, EVENT, READING, VALUE, UNIT) VALUES " .
|
||||
"('$ts', '$n', '$t', '$s', '$reading', '$value', '$unit')";
|
||||
|
Loading…
Reference in New Issue
Block a user