2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 12:49:34 +00:00

93_DbRep: fix Perl Warning

git-svn-id: https://svn.fhem.de/fhem/trunk@27184 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
nasseeder1 2023-02-05 19:47:19 +00:00
parent 47a7ef1658
commit 89d3a4c4ce
2 changed files with 21 additions and 16 deletions

View File

@ -1,5 +1,7 @@
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide. # 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. # Do not insert empty lines here, update check depends on it.
- bugfix: 93_DbRep: fix Perl Warning
Forum: #topic,53584.msg1262032.html#msg1262032
- change : 74_AutomowerConnect: shift common subs to lib - change : 74_AutomowerConnect: shift common subs to lib
bugfix due to last rework, more precise alingment for gps data bugfix due to last rework, more precise alingment for gps data
- change: 75_AutomowerConnectDevice: shift common subs to lib - change: 75_AutomowerConnectDevice: shift common subs to lib

View File

@ -59,6 +59,7 @@ no if $] >= 5.017011, warnings => 'experimental::smartmatch';
# Version History intern # Version History intern
my %DbRep_vNotesIntern = ( my %DbRep_vNotesIntern = (
"8.51.5" => "05.02.2023 fix Perl Warning Forum: https://forum.fhem.de/index.php/topic,53584.msg1262032.html#msg1262032 ",
"8.51.4" => "01.02.2023 ignore non-numeric values in diffValue and output the erroneous record in the log ", "8.51.4" => "01.02.2023 ignore non-numeric values in diffValue and output the erroneous record in the log ",
"8.51.3" => "22.01.2023 extend DbRep_averval avgTimeWeightMean by alkazaa, Restructuring of DbRep_averval ". "8.51.3" => "22.01.2023 extend DbRep_averval avgTimeWeightMean by alkazaa, Restructuring of DbRep_averval ".
"DbRep_reduceLog -> Handling of field 'value' with NULL value ", "DbRep_reduceLog -> Handling of field 'value' with NULL value ",
@ -3343,6 +3344,7 @@ sub _DbRep_avgArithmeticMean {
my ($err, $sth, $sql, $arrstr, $wrstr); my ($err, $sth, $sql, $arrstr, $wrstr);
my (@rsf, @rsn); my (@rsf, @rsn);
my $aval = (DbRep_checktimeaggr($hash))[2];
$qlf = 'avgam'; $qlf = 'avgam';
my $addon = q{}; my $addon = q{};
my $selspec = 'AVG(VALUE)'; my $selspec = 'AVG(VALUE)';
@ -3371,7 +3373,6 @@ sub _DbRep_avgArithmeticMean {
my @line = $sth->fetchrow_array(); my @line = $sth->fetchrow_array();
$avg = $line[0] if($line[0]); $avg = $line[0] if($line[0]);
my $aval = (DbRep_checktimeaggr($hash))[2];
Log3 ($name, 5, "DbRep $name - SQL result: $avg "); Log3 ($name, 5, "DbRep $name - SQL result: $avg ");
@ -3391,10 +3392,14 @@ sub _DbRep_avgArithmeticMean {
$arrstr .= $runtime_string."#".$avg."#".$rsf[0]."|"; $arrstr .= $runtime_string."#".$avg."#".$rsf[0]."|";
} }
next if($avg eq '-'); # Schreiben von '-' als Durchschnitt verhindern
my @wsf = split " ", $runtime_string_first; my @wsf = split " ", $runtime_string_first;
my @wsn = split " ", $runtime_string_next; my @wsn = split " ", $runtime_string_next;
my $wsft = $wsf[1] ? '_'.$wsf[1] : q{};
my $wsnt = $wsn[1] ? '_'.$wsn[1] : q{};
$wrstr .= $runtime_string."#".$avg."#".$wsf[0]."_".$wsf[1]."#".$wsn[0]."_".$wsn[1]."|"; # Kombi zum Rückschreiben in die DB $wrstr .= $runtime_string."#".$avg."#".$wsf[0].$wsft."#".$wsn[0].$wsnt."|"; # Kombi zum Rückschreiben in die DB
} }
$sth->finish; $sth->finish;
@ -3430,6 +3435,7 @@ sub _DbRep_avgDailyMeanGWS {
my ($gts,$gtsstr) = (0, q{}); # Variablen für Grünlandtemperatursumme GTS my ($gts,$gtsstr) = (0, q{}); # Variablen für Grünlandtemperatursumme GTS
my $aval = (DbRep_checktimeaggr($hash))[2];
my $acf = AttrVal ($name, 'averageCalcForm', 'avgArithmeticMean'); # Festlegung Berechnungsschema f. Mittelwert my $acf = AttrVal ($name, 'averageCalcForm', 'avgArithmeticMean'); # Festlegung Berechnungsschema f. Mittelwert
my $addon = "ORDER BY TIMESTAMP DESC LIMIT 1"; my $addon = "ORDER BY TIMESTAMP DESC LIMIT 1";
my $selspec = "VALUE"; my $selspec = "VALUE";
@ -3444,7 +3450,7 @@ sub _DbRep_avgDailyMeanGWS {
my $sum = 0; my $sum = 0;
my $anz = 0; # Anzahl der Messwerte am Tag my $anz = 0; # Anzahl der Messwerte am Tag
my ($t01,$t07,$t13,$t19); # Temperaturen der Haupttermine my ($t01,$t07,$t13,$t19); # Temperaturen der Haupttermine
my ($bdate,undef) = split(" ",$runtime_string_first); my ($bdate,undef) = split " ", $runtime_string_first;
for my $i (0..23) { for my $i (0..23) {
my $bsel = $bdate." ".sprintf("%02d",$i).":00:00"; my $bsel = $bdate." ".sprintf("%02d",$i).":00:00";
@ -3481,8 +3487,6 @@ sub _DbRep_avgDailyMeanGWS {
$sum = qq{<html>insufficient values - execute <b>get $name versionNotes 2</b> for further information</html>}; $sum = qq{<html>insufficient values - execute <b>get $name versionNotes 2</b> for further information</html>};
} }
my $aval = (DbRep_checktimeaggr($hash))[2];
if($aval eq "hour") { if($aval eq "hour") {
@rsf = split /[ :]/, $runtime_string_first; @rsf = split /[ :]/, $runtime_string_first;
@rsn = split /[ :]/, $runtime_string_next; @rsn = split /[ :]/, $runtime_string_next;
@ -3564,6 +3568,7 @@ sub _DbRep_avgTimeWeightMean {
my ($err, $sth, $sql, $arrstr, $wrstr, $bin_end, $val1); my ($err, $sth, $sql, $arrstr, $wrstr, $bin_end, $val1);
my (@rsf, @rsn); my (@rsf, @rsn);
my $aval = (DbRep_checktimeaggr($hash))[2];
$qlf = 'avgtwm'; $qlf = 'avgtwm';
my $selspec = 'TIMESTAMP,VALUE'; my $selspec = 'TIMESTAMP,VALUE';
my $addon = 'ORDER BY TIMESTAMP ASC'; my $addon = 'ORDER BY TIMESTAMP ASC';
@ -3575,8 +3580,6 @@ sub _DbRep_avgTimeWeightMean {
my $runtime_string_first = $ar[1]; my $runtime_string_first = $ar[1];
my $runtime_string_next = $ar[2]; my $runtime_string_next = $ar[2];
my $aval = (DbRep_checktimeaggr($hash))[2];
my ($tf,$tl,$tn,$to,$dt,$val); my ($tf,$tl,$tn,$to,$dt,$val);
if ($bin_end) { # das $bin_end des letzten Bin ist der effektive Zeitpunkt des letzten Datenwertes if ($bin_end) { # das $bin_end des letzten Bin ist der effektive Zeitpunkt des letzten Datenwertes