diff --git a/FHEM/10_FS20.pm b/FHEM/10_FS20.pm index 48e451275..614ad7f27 100755 --- a/FHEM/10_FS20.pm +++ b/FHEM/10_FS20.pm @@ -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"; } } diff --git a/FHEM/11_FHT.pm b/FHEM/11_FHT.pm index a1ceaa431..f6ff60430 100755 --- a/FHEM/11_FHT.pm +++ b/FHEM/11_FHT.pm @@ -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); diff --git a/contrib/dblog/93_DbLog.pm b/contrib/dblog/93_DbLog.pm index 1af522b43..ba14683b6 100755 --- a/contrib/dblog/93_DbLog.pm +++ b/contrib/dblog/93_DbLog.pm @@ -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')";