mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-04 22:19: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:
parent
68441d023c
commit
420ca5b1cc
@ -1016,6 +1016,16 @@ DbLog_Get($@)
|
|||||||
|
|
||||||
while($sth->fetch()) {
|
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($sql_timestamp lt $from && $deltacalc) {
|
||||||
if(Scalar::Util::looks_like_number($sql_value)){
|
if(Scalar::Util::looks_like_number($sql_value)){
|
||||||
#nur setzen wenn nummerisch
|
#nur setzen wenn nummerisch
|
||||||
@ -1034,16 +1044,9 @@ DbLog_Get($@)
|
|||||||
# die Regexep wird vor der Function ausgewertet und der Wert im Feld
|
# die Regexep wird vor der Function ausgewertet und der Wert im Feld
|
||||||
# Value angepasst.
|
# Value angepasst.
|
||||||
####################################################################
|
####################################################################
|
||||||
if($readings[$i]->[4] && $readings[$i]->[4]) {
|
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: $@";}
|
|
||||||
$out_tstamp = $sql_timestamp;
|
$out_tstamp = $sql_timestamp;
|
||||||
$writeout=1;
|
$writeout=1 if(!$deltacalc);
|
||||||
}
|
}
|
||||||
|
|
||||||
############ Auswerten des 4. Parameters: function ###################
|
############ Auswerten des 4. Parameters: function ###################
|
||||||
|
Loading…
x
Reference in New Issue
Block a user