From 65c11b0ab22e6f2d464024562e471410f589c310 Mon Sep 17 00:00:00 2001 From: nasseeder1 Date: Mon, 13 Jan 2020 21:13:47 +0000 Subject: [PATCH] 93_DbLog: change datetime pattern in valueFn of addCacheLine Forum: #107285 git-svn-id: https://svn.fhem.de/fhem/trunk@20966 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/CHANGED | 2 ++ fhem/FHEM/93_DbLog.pm | 12 ++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/fhem/CHANGED b/fhem/CHANGED index 1637d9ca0..6eb0c2663 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: change datetime pattern in valueFn of addCacheLine + Forum: #107285 - change: 98_todoist: reorder tasks - widget reorder - change: 73_NUKIBridge: 74_NUKIDevice use packages - change: 98_Heating_Control: move to contrib diff --git a/fhem/FHEM/93_DbLog.pm b/fhem/FHEM/93_DbLog.pm index 319b11936..ce35dd875 100644 --- a/fhem/FHEM/93_DbLog.pm +++ b/fhem/FHEM/93_DbLog.pm @@ -30,6 +30,7 @@ no if $] >= 5.017011, warnings => 'experimental::smartmatch'; # Version History intern by DS_Starter: our %DbLog_vNotesIntern = ( + "4.9.7" => "13.01.2020 change datetime pattern in valueFn of DbLog_addCacheLine. Forum: #107285 ", "4.9.6" => "04.01.2020 fix change off 4.9.4 in default splitting. Forum: #106992 ", "4.9.5" => "01.01.2020 do not reopen database connection if device is disabled (fix) ", "4.9.4" => "29.12.2019 correct behavior if value is empty and attribute addStateEvent is set (default), Forum: #106769 ", @@ -4620,8 +4621,15 @@ sub DbLog_addCacheLine($$$$$$$$) { Log3 $hash->{NAME}, 4, "DbLog $name -> Event ignored by valueFn - TS: $i_timestamp, Device: $i_dev, Type: $i_type, Event: $i_evt, Reading: $i_reading, Value: $i_val, Unit: $i_unit"; next; } - - $i_timestamp = $TIMESTAMP if($TIMESTAMP =~ /(19[0-9][0-9]|2[0-9][0-9][0-9])-(0[1-9]|1[1-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1]) (0[0-9]|1[1-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])/); + + my ($yyyy, $mm, $dd, $hh, $min, $sec) = ($TIMESTAMP =~ /(\d+)-(\d+)-(\d+) (\d+):(\d+):(\d+)/); + eval { my $epoch_seconds_begin = timelocal($sec, $min, $hh, $dd, $mm-1, $yyyy-1900); }; + if (!$@) { + $i_timestamp = $TIMESTAMP; + } else { + Log3 ($name, 2, "DbLog $name -> Parameter TIMESTAMP got from valueFn is invalid: $TIMESTAMP"); + } + $i_dev = $DEVICE if($DEVICE ne ''); $i_type = $DEVICETYPE if($DEVICETYPE ne ''); $i_reading = $READING if($READING ne '');