diff --git a/fhem/CHANGED b/fhem/CHANGED index 070ce9b4d..5255ce814 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -1,5 +1,7 @@ # Add changes at the top of the list. Keep it in ASCII, and 80-char wide. # Do not insert empty lines here, update check depends on it. + - change: 93_DbLog: V3.10.2, event parsing of Weather changed, add option + CN= to addlog-function - change: 49_SSCam: V3.8.4, usage of Internal MODEL changed - bugfix: 00_SIGNALduino: fixed ws7000 decoding - feature: 72_XiaomiDevice: predefined zones and points, carpet mode diff --git a/fhem/FHEM/93_DbLog.pm b/fhem/FHEM/93_DbLog.pm index 202434c48..77efad528 100644 --- a/fhem/FHEM/93_DbLog.pm +++ b/fhem/FHEM/93_DbLog.pm @@ -16,6 +16,8 @@ ############################################################################################################################################ # Versions History done by DS_Starter & DeeSPe: # +# 3.10.2 09.04.2018 add qualifier CN= to addlog +# 3.10.1 04.04.2018 changed event parsing of Weather # 3.10.0 02.04.2018 addLog consider DbLogExclude in Devices, keyword "!useExcludes" to switch off considering # DbLogExclude in addLog, DbLogExclude & DbLogInclude can handle "/" in Readingname, # commandref (reduceLog) revised @@ -196,7 +198,7 @@ use Time::HiRes qw(gettimeofday tv_interval); use Encode qw(encode_utf8); no if $] >= 5.017011, warnings => 'experimental::smartmatch'; -my $DbLogVersion = "3.10.0"; +my $DbLogVersion = "3.10.2"; my %columns = ("DEVICE" => 64, "TYPE" => 64, @@ -383,6 +385,7 @@ sub DbLog_Attr(@) { "%VALUE" => $name, "%UNIT" => $name, "%IGNORE" => $name, + "%CN" => $name, ); my $err = perlSyntaxCheck($aVal, %specials); return $err if($err); @@ -549,7 +552,13 @@ sub DbLog_Set($@) { unless ($a[2]) { return "The argument of $a[1] is not valid. Please check commandref.";} my $nce = ("\!useExcludes" ~~ @a)?1:0; map(s/\!useExcludes//g, @a); - DbLog_AddLog($hash,$a[2],$a[3],$nce); + my $cn; + if(/CN=/ ~~ @a) { + my $t = join(" ",@a); + ($cn) = ($t =~ /^.*CN=(\w+).*$/); + map(s/CN=$cn//g, @a); + } + DbLog_AddLog($hash,$a[2],$a[3],$nce,$cn); } elsif ($a[1] eq 'reopen') { if ($dbh) { @@ -1122,10 +1131,11 @@ sub DbLog_ParseEvent($$$) if($event =~ m(^wind_condition)) { @parts= split(/ /,$event); # extract wind direction from event if(defined $parts[0]) { - $reading = "wind_direction"; - $value= $parts[2]; + $reading = "wind_condition"; + $value= "$parts[1] $parts[2] $parts[3]"; } } + if($reading eq "wind_condition") { $unit= "km/h"; } elsif($reading eq "wind_chill") { $unit= "°C"; } elsif($reading eq "wind_direction") { $unit= ""; } elsif($reading =~ m(^wind)) { $unit= "km/h"; } # wind, wind_speed @@ -1356,6 +1366,7 @@ sub DbLog_Log($$) { my $VALUE = $value; my $UNIT = $unit; my $IGNORE = 0; + my $CN = " "; eval $value_fn; Log3 $name, 2, "DbLog $name -> error valueFn: ".$@ if($@); @@ -3543,8 +3554,8 @@ return @sr; # Addlog - einfügen des Readingwertes eines gegebenen Devices # ######################################################################################### -sub DbLog_AddLog($$$$) { - my ($hash,$devrdspec,$value,$nce)= @_; +sub DbLog_AddLog($$$$$) { + my ($hash,$devrdspec,$value,$nce,$cn)= @_; my $name = $hash->{NAME}; my $async = AttrVal($name, "asyncMode", undef); my $value_fn = AttrVal( $name, "valueFn", "" ); @@ -3636,6 +3647,7 @@ sub DbLog_AddLog($$$$) { my $VALUE = $read_val; my $UNIT = $ut; my $IGNORE = 0; + my $CN = $cn if($cn); eval $value_fn; Log3 $name, 2, "DbLog $name -> error valueFn: ".$@ if($@); @@ -5323,23 +5335,39 @@ sub dbReadings($@) { Example:
set <name> addCacheLine 2017-12-05 17:03:59|MaxBathRoom|MAX|valveposition: 95|valveposition|95|%

- - set <name> addLog <devspec>:<Reading> [Value] [!useExcludes]

-
- set <name> addLog <devspec>:<Reading> [Value] [!useExcludes]

-