2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-10 14:12:38 +00:00

93_DbLog: Forum #42727 - Evaluate RegExp and reduce other output for delta-calculation

git-svn-id: https://svn.fhem.de/fhem/trunk@9686 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rapster 2015-10-26 10:48:20 +00:00
parent 68441d023c
commit 420ca5b1cc

View File

@ -1016,6 +1016,16 @@ DbLog_Get($@)
while($sth->fetch()) {
if($readings[$i]->[4]) {
#evaluate
my $val = $sql_value;
my $ts = $sql_timestamp;
eval("$readings[$i]->[4]");
$sql_value = $val;
$sql_timestamp = $ts;
if($@) {Log3 $hash->{NAME}, 3, "DbLog: Error in inline function: <".$readings[$i]->[4].">, Error: $@";}
}
if($sql_timestamp lt $from && $deltacalc) {
if(Scalar::Util::looks_like_number($sql_value)){
#nur setzen wenn nummerisch
@ -1034,16 +1044,9 @@ DbLog_Get($@)
# die Regexep wird vor der Function ausgewertet und der Wert im Feld
# Value angepasst.
####################################################################
if($readings[$i]->[4] && $readings[$i]->[4]) {
#evaluate
my $val = $sql_value;
my $ts = $sql_timestamp;
eval("$readings[$i]->[4]");
$sql_value = $val;
$sql_timestamp = $ts;
if($@) {Log3 $hash->{NAME}, 3, "DbLog: Error in inline function: <".$readings[$i]->[4].">, Error: $@";}
if($readings[$i]->[4]) {
$out_tstamp = $sql_timestamp;
$writeout=1;
$writeout=1 if(!$deltacalc);
}
############ Auswerten des 4. Parameters: function ###################