2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-07 19:04:20 +00:00

93_DbRep: contrib 8.30.4

git-svn-id: https://svn.fhem.de/fhem/trunk@20997 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
nasseeder1 2020-01-16 20:29:59 +00:00
parent 19b6a299df
commit 88f3d617d7

View File

@ -1,5 +1,5 @@
##########################################################################################################
# $Id: 93_DbRep.pm 20571 2019-11-24 19:17:33Z DS_Starter $
# $Id: 93_DbRep.pm 20610 2019-11-28 20:20:46Z DS_Starter $
##########################################################################################################
# 93_DbRep.pm
#
@ -58,6 +58,7 @@ no if $] >= 5.017011, warnings => 'experimental::smartmatch';
# Version History intern
our %DbRep_vNotesIntern = (
"8.30.4" => "16.01.2020 correction writeToDB ",
"8.30.3" => "28.11.2019 countEntries encode \$device, change count_ParseDone for \"countEntriesDetail\" ",
"8.30.2" => "24.11.2019 change order of delete(\$hash->{HELPER}{RUNNING_PID}) in *_ParseDone routines, Forum: https://forum.fhem.de/index.php/topic,105591.msg996089.html#msg996089 ",
"8.30.1" => "22.11.2019 commandref revised ",
@ -405,6 +406,7 @@ sub DbRep_Initialize($) {
"sqlCmdVars ".
"sqlResultFormat:separated,mline,sline,table,json ".
"sqlResultFieldSep:|,:,\/ ".
"timeAdjust:beginDay,endDay ".
"timeYearPeriod ".
"timestamp_begin ".
"timestamp_end ".
@ -10651,13 +10653,16 @@ sub DbRep_OutputWriteToDB($$$$$) {
$value = defined($a[1])?sprintf("%.4f",$a[1]):undef;
$rsf = $a[2]; # Datum / Zeit für DB-Speicherung
($date,$time) = split("_",$rsf);
Log3 ($name, 1, "DbRep $name - row: $row ,rsf: $rsf, date: $date, time: $time");
$time =~ s/-/:/g if($time);
if($time !~ /^(\d{2}):(\d{2}):(\d{2})$/) {
if($aggr =~ /no|day|week|month/) {
$time = "23:59:58";
$time = "00:00:01" if AttrVal($name, "timeAdjust", "beginDay");
} elsif ($aggr =~ /hour/) {
$time = "$time:59:58";
$time = "$time:00:01" if AttrVal($name, "timeAdjust", "beginDay");
}
}
if ($value) {
@ -10680,8 +10685,10 @@ sub DbRep_OutputWriteToDB($$$$$) {
if($time !~ /^(\d{2}):(\d{2}):(\d{2})$/) {
if($aggr =~ /no|day|week|month/) {
$time = "23:59:58";
$time = "00:00:01" if AttrVal($name, "timeAdjust", "beginDay");
} elsif ($aggr =~ /hour/) {
$time = "$time:59:58";
$time = "$time:00:01" if AttrVal($name, "timeAdjust", "beginDay");
}
}
if ($value) {
@ -11063,12 +11070,12 @@ sub DbRep_setVersionInfo($) {
if($modules{$type}{META}{x_prereqs_src} && !$hash->{HELPER}{MODMETAABSENT}) {
# META-Daten sind vorhanden
$modules{$type}{META}{version} = "v".$v; # Version aus META.json überschreiben, Anzeige mit {Dumper $modules{SMAPortal}{META}}
if($modules{$type}{META}{x_version}) { # {x_version} ( nur gesetzt wenn $Id: 93_DbRep.pm 20571 2019-11-24 19:17:33Z DS_Starter $ im Kopf komplett! vorhanden )
if($modules{$type}{META}{x_version}) { # {x_version} ( nur gesetzt wenn $Id: 93_DbRep.pm 20610 2019-11-28 20:20:46Z DS_Starter $ im Kopf komplett! vorhanden )
$modules{$type}{META}{x_version} =~ s/1.1.1/$v/g;
} else {
$modules{$type}{META}{x_version} = $v;
}
return $@ unless (FHEM::Meta::SetInternals($hash)); # FVERSION wird gesetzt ( nur gesetzt wenn $Id: 93_DbRep.pm 20571 2019-11-24 19:17:33Z DS_Starter $ im Kopf komplett! vorhanden )
return $@ unless (FHEM::Meta::SetInternals($hash)); # FVERSION wird gesetzt ( nur gesetzt wenn $Id: 93_DbRep.pm 20610 2019-11-28 20:20:46Z DS_Starter $ im Kopf komplett! vorhanden )
if(__PACKAGE__ eq "FHEM::$type" || __PACKAGE__ eq $type) {
# es wird mit Packages gearbeitet -> Perl übliche Modulversion setzen
# mit {<Modul>->VERSION()} im FHEMWEB kann Modulversion abgefragt werden