2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-03 23:06:37 +00:00

git-svn-id: https://svn.fhem.de/fhem/trunk@6020 2b470e98-0d58-463d-a4d8-8e2adae1ed80

This commit is contained in:
tpoitzsch 2014-05-31 09:14:00 +00:00
parent e25fdf433a
commit 09f5ce0991
3 changed files with 43 additions and 42 deletions

View File

@ -1823,7 +1823,6 @@ LUXTRONIK2_doStatisticDeltaSingle ($$$$$$$)
<ul style="width:800px">
Die Luxtronik 2.0 ist eine Heizungssteuerung, welche in W&auml;rmepumpen von <a href="http://www.alpha-innotec.de">Alpha Innotec</a>,
Siemens Novelan (WPR NET) und Wolf Heiztechnik (BWL/BWS) verbaut ist.
<br>
Sie besitzt einen Ethernet Anschluss, so dass sie direkt in lokale Netzwerke (LAN) integriert werden kann.
<br>
<i>Das Modul wurde bisher mit folgender Steuerungs-Firmware getestet: V1.51, V1.54C, V1.60, V1.69, V1.70.</i>
@ -1847,6 +1846,7 @@ LUXTRONIK2_doStatisticDeltaSingle ($$$$$$$)
<b>Set</b><br>
<ul>
Durch einen Firmware-Test wird vor jeder Set-Operation sichergestellt, dass W&auml;rmepumpen mit ungetester Firmware nicht unabsichtlich besch&auml;digt werden.
<br>&nbsp;
<li><code>activeTariff &lt; 0 - 9 &gt;</code>
<br>
Erlaubt die gezielte, separate Erfassung der statistischen Verbrauchswerte (doStatistics = 1) f&uuml;r verschiedene Tarife (Doppelstromz&auml;hler)<br>
@ -1922,7 +1922,9 @@ LUXTRONIK2_doStatisticDeltaSingle ($$$$$$$)
und Absch&auml;tzung des elektrischen Verbrauches
</li><br>
<li><code>heatPumpElectricalPowerFactor</code><br>
&Auml;nderung der elektrischen Leistungsaufnahme per 1 K Vorlauftemperaturdifferenz zu 35 &deg;C (z.B. 2% pro 1 K = 0,02)<br>
&Auml;nderung der elektrischen Leistungsaufnahme per 1 K Vorlauftemperaturdifferenz zu 35 &deg;C
<br>
(z.B. 2% pro 1 K = 0,02)
</li><br>
<li><code>heatHeatRodElectricalPowerWatt</code><br>
Betriebsleistung der Heizst&auml;be zur Absch&auml;tzung des elektrischen Verbrauches

View File

@ -941,9 +941,9 @@ JSONMETER_doStatisticDeltaSingle ($$$$$$)
<br>
Polling interval in seconds
</li><br>
<li><code>resetStatistics &lt;all|statElectricityConsumed...|statElectricityConsumedTariff...|statElectricityPower...&gt;</code>
<li><code>resetStatistics &lt;statReadings&gt;</code>
<br>
Deletes the selected statistic values.
Deletes the selected statistic values: <i>all, statElectricityConsumed..., statElectricityConsumedTariff..., statElectricityPower...</i>
</li><br>
<li><code>restartJsonAnalysis</code><br>
Restarts the analysis of the json file for known readings (compliant to the OBIS standard).
@ -1007,7 +1007,6 @@ JSONMETER_doStatisticDeltaSingle ($$$$$$)
<h3>JSONMETER</h3>
<ul style="width:800px">
Dieses Modul liest Daten von Messger&auml;ten (z.B. Stromz&auml;hler, Gasz&auml;hler oder W&auml;rmez&auml;hler, so genannte Smartmeter),
<br>
welche <a href="http://de.wikipedia.org/wiki/OBIS-Kennzahlen">OBIS</a> kompatible Daten im JSON-Format auf einem Webserver oder auf dem FHEM-Dateisystem zur Verf&uuml;gung stellen.
<br>
&nbsp;
@ -1049,22 +1048,21 @@ JSONMETER_doStatisticDeltaSingle ($$$$$$)
<ul>
<li><code>activeTariff &lt; 0 - 9 &gt;</code>
<br>
Erlaubt die gezielte, separate Erfassung der statistischen Verbrauchswerte (doStatistics = 1) f&uuml;r verschiedene Tarife (Doppelstromz&auml;hler), wenn der Stromz&auml;hler dies selbst nicht unterscheiden kann (z.B. LS110) oder wenn gepr&uuml;ft werden soll, ob ein zeitabh&auml;ngiger Tarif preiswerter w&auml;re.<br>
Dieser Wert muss entsprechend des vorhandenen oder geplanten Tarifes zum jeweiligen Zeitpunkt z.B. durch den FHEM-Befehl "at" gesetzt werden.<br>
Erlaubt die gezielte, separate Erfassung der statistischen Verbrauchswerte (doStatistics = 1) f&uuml;r verschiedene Tarife (Doppelstromz&auml;hler), wenn der Stromz&auml;hler dies selbst nicht unterscheiden kann (z.B. LS110) oder wenn gepr&uuml;ft werden soll, ob ein zeitabh&auml;ngiger Tarif preiswerter w&auml;re. Dieser Wert muss entsprechend des vorhandenen oder geplanten Tarifes zum jeweiligen Zeitpunkt z.B. durch den FHEM-Befehl "at" gesetzt werden.<br>
0 = tariflos
</li><br>
<li><code>INTERVAL &lt;Abfrageinterval&gt;</code>
<br>
Abfrageinterval in Sekunden
</li><br>
<li><code>resetStatistics &lt;all|statElectricityConsumed...|statElectricityConsumedTariff...|statElectricityPower...&gt;</code>
<li><code>resetStatistics &lt;statWerte&gt;</code>
<br>
L&ouml;scht die ausgew&auml;hlten statisischen Werte.
L&ouml;scht die ausgew&auml;hlten statisischen Werte: <i>all, statElectricityConsumed..., statElectricityConsumedTariff..., statElectricityPower...</i>
</li><br>
<li><code>restartJsonAnalysis</code>
<br>
Neustart der Analyse der json-Datei zum Auffinden bekannter Ger&auml;tewerte (kompatibel zum OBIS Standard).
<br>
Diese Analysie wird normaler Weise nur einmalig durchgef&uuml;hrt, nachdem Ger&auml;tewerte gefunden wurden.
</li><br>
<li><code>statusRequest</code>
@ -1098,7 +1096,6 @@ JSONMETER_doStatisticDeltaSingle ($$$$$$)
<li><code>doStatistics &lt; 0 | 1 &gt;</code>
<br>
Bildet t&auml;gliche, monatliche und j&auml;hrliche Statistiken bestimmter Ger&auml;tewerte (Mittel/Min/Max oder kumulierte Werte).
<br>
F&uuml;r grafische Auswertungen k&ouml;nnen die Werte der Form 'stat<i>ReadingName</i><b>Last</b>' genutzt werden.
</li><br>
<li><code>pathString &lt;Zeichenkette&gt;</code>

View File

@ -128,9 +128,7 @@ statistics_Define($$)
RemoveInternalTimer($hash);
# Run period change procedure next full hour (15 seconds before).
my $periodEndTime = 3600 * ( int(gettimeofday()/3600) + 1 ) - 15 ;
InternalTimer( $periodEndTime, "statistics_PeriodChange", $hash, 0);
InternalTimer( gettimeofday() + 11, "statistics_PeriodChange", $hash, 0);
return undef;
}
@ -196,7 +194,6 @@ statistics_Notify($$)
delete($hash->{READINGS}{$r});
}
}
statistics_DoStatisticsAll $hash, 0;
my %unknownDevices;
foreach my $r (keys %{$hash->{READINGS}}) {
if ($r =~ /^\.(.*):.*/) { $unknownDevices{$1}++; }
@ -210,7 +207,7 @@ statistics_Notify($$)
}
if ($val ne "") {
Log3 $name,4,"$name: Initialization - Found hidden readings for device(s) '$val'.";
readingsSingleUpdate($hash,"monitoredDevicesUnknownType",$val,1);
readingsSingleUpdate($hash,"monitoredDevicesUnknown",$val,1);
}
return;
}
@ -272,7 +269,7 @@ statistics_PeriodChange($)
RemoveInternalTimer($hash);
# Run period change procedure each full hour ("periodChangePreset" second before).
my $periodEndTime = 3600 * ( int((gettimeofday()+1800)/3600) + 1 ) - $periodChangePreset ;
my $periodEndTime = 3600 * ( int((gettimeofday()+$periodChangePreset)/3600) + 1 ) - $periodChangePreset ;
# Run procedure also for given dayChangeTime
$val = "";
if ( $dayChangeDelay>0 && gettimeofday()<$dayChangeTime && $dayChangeTime<=$periodEndTime ) {
@ -282,12 +279,11 @@ statistics_PeriodChange($)
$val = strftime ("%Y-%m-%d %H:%M:%S", localtime($periodEndTime)) . $val;
InternalTimer( $periodEndTime, "statistics_PeriodChange", $hash, 1);
readingsSingleUpdate($hash, "nextPeriodChangeCalc", $val, 0);
Log3 $name,4,"$name: Next period change will be calculated at ".strftime ("%H:%M:%S", localtime($periodEndTime));
Log3 $name,4,"$name: Next period change will be calculated at $val";
return if( AttrVal($name, "disable", 0 ) == 1 );
# Determine if time period switched (day, month, year)
# Get deltaValue and Tariff of previous call
my $periodSwitch = 0;
my $yearLast;
@ -299,20 +295,23 @@ statistics_PeriodChange($)
my $monthNow;
my $yearNow;
if ($dayChangeDelay>0 && $isDayChange) {
($dummy, $dummy, $hourLast, $dayLast, $monthLast, $yearLast) = localtime (gettimeofday() - $dayChangeDelay);
($dummy, $dummy, $hourNow, $dayNow, $monthNow, $yearNow) = localtime (gettimeofday() + $periodEndTime);
if ($yearNow != $yearLast) { $periodSwitch = -4; }
elsif ($monthNow != $monthLast) { $periodSwitch = -3; }
elsif ($dayNow != $dayLast) { $periodSwitch = -2; }
if ($dayChangeDelay % 3600 == 0) { $periodSwitch = abs($periodSwitch); }
if ($isDayChange) {
Log3 $name,4,"$name: Calculating day change";
($dummy, $dummy, $hourLast, $dayLast, $monthLast, $yearLast) = localtime (gettimeofday() - $dayChangeDelay + $periodChangePreset - 59);
($dummy, $dummy, $hourNow, $dayNow, $monthNow, $yearNow) = localtime (gettimeofday() + $periodChangePreset);
if ($yearNow != $yearLast) { $periodSwitch = -4; }
elsif ($monthNow != $monthLast) { $periodSwitch = -3; }
elsif ($dayNow != $dayLast) { $periodSwitch = -2; }
if ($dayChangeDelay % 3600 == 0) { $periodSwitch = abs($periodSwitch); }
} else {
($dummy, $dummy, $hourLast, $dayLast, $monthLast, $yearLast) = localtime (gettimeofday() - 1800);
($dummy, $dummy, $hourNow, $dayNow, $monthNow, $yearNow) = localtime (gettimeofday() + 1800);
if ($yearNow != $yearLast) { $periodSwitch = 4; }
elsif ($monthNow != $monthLast) { $periodSwitch = 3; }
elsif ($dayNow != $dayLast) { $periodSwitch = 2; }
elsif ($hourNow != $hourLast) { $periodSwitch = 1; }
($dummy, $dummy, $hourLast, $dummy, $dummy, $dummy) = localtime (gettimeofday());
($dummy, $dummy, $hourNow, $dummy, $dummy, $dummy) = localtime (gettimeofday() + $periodChangePreset);
if ($hourNow != $hourLast) {
$periodSwitch = 1;
Log3 $name,4,"$name: Calculating hour change";
} else {
Log3 $name,4,"$name: Calculating statistics at startup";
}
}
statistics_DoStatisticsAll $hash, $periodSwitch;
@ -622,7 +621,7 @@ statistics_doStatisticDelta ($$$$$)
}
# If change of day, change daily statistic
if ($periodSwitch >= 2 || $periodSwitch <= -2){
$last[3] = $stat[3];
$last[3] = sprintf "%.".$decPlaces."f", $stat[3];
$stat[3] = 0;
if ($showDate == 5) { $showDate = 4; } # Do not show the "since:" value for day changes anymore
if ($showDate >= 6) { # Shows the "since:" value for the first day change
@ -671,11 +670,11 @@ statistics_doStatisticDelta ($$$$$)
my $statValue = sprintf "%.".$decPlaces."f", $stat[1];
statistics_storeSingularReadings ($name,$singularReadings,$dev,$statReadingName,$readingName,"Delta","Hour",$statValue,$last[1],$periodSwitch >= 1);
$statValue = sprintf "%.".$decPlaces."f", $stat[3];
statistics_storeSingularReadings ($name,$singularReadings,$dev,$statReadingName,$readingName,"Delta","Day",$statValue,$last[3],$periodSwitch >= 2);
statistics_storeSingularReadings ($name,$singularReadings,$dev,$statReadingName,$readingName,"Delta","Day",$statValue,$last[3],$periodSwitch >= 2 || $periodSwitch <= -2);
$statValue = sprintf "%.".$decPlaces."f", $stat[5];
statistics_storeSingularReadings ($name,$singularReadings,$dev,$statReadingName,$readingName,"Delta","Month",$statValue,$last[5],$periodSwitch >= 3);
statistics_storeSingularReadings ($name,$singularReadings,$dev,$statReadingName,$readingName,"Delta","Month",$statValue,$last[5],$periodSwitch >= 3 || $periodSwitch <= -3);
$statValue = sprintf "%.".$decPlaces."f", $stat[7];
statistics_storeSingularReadings ($name,$singularReadings,$dev,$statReadingName,$readingName,"Delta","Year",$statValue,$last[7],$periodSwitch >= 4);
statistics_storeSingularReadings ($name,$singularReadings,$dev,$statReadingName,$readingName,"Delta","Year",$statValue,$last[7],$periodSwitch == 4 || $periodSwitch == -4);
}
return ;
@ -695,9 +694,9 @@ statistics_doStatisticDuration ($$$$)
Log3 $name, 4, "Calculating duration statistics for '".$dev->{NAME}.":$readingName = $state'";
# Daily Statistic
statistics_doStatisticDurationSingle $hash, $dev, $readingName, "Day", $state, ($periodSwitch >= 2);
statistics_doStatisticDurationSingle $hash, $dev, $readingName, "Day", $state, ($periodSwitch >= 2 || $periodSwitch <= -2);
# Monthly Statistic
statistics_doStatisticDurationSingle $hash, $dev, $readingName, "Month", $state, ($periodSwitch >= 3);
statistics_doStatisticDurationSingle $hash, $dev, $readingName, "Month", $state, ($periodSwitch >= 3 || $periodSwitch <= -3);
return ;
@ -939,7 +938,7 @@ statistics_FormatDuration($)
<ul>
<li><b>Minimal-, Mittel- und Maximalwerte:</b> brightness, current, energy_current, humidity, temperature, voltage, wind, wind_speed, windSpeed</li>
<li><b>Deltawerte:</b> count, energy, energy_total, power, total, rain, rain_rate, rain_total</li>
<li><b>Dauer der Stati:</b> lightsensor, lock, motion, Window, window, state <i>(wenn kein anderer Ger&auml;tewert g&uuml;ltig)</i></li>
<li><b>Dauer der Status:</b> lightsensor, lock, motion, Window, window, state <i>(wenn kein anderer Ger&auml;tewert g&uuml;ltig)</i></li>
</ul>
Weitere Ger&auml;tewerte k&ouml;nnen &uuml;ber die entsprechenden <a href="#statisticsattr">Attribute</a> hinzugef&uuml;gt werden
<br>&nbsp;
@ -1009,12 +1008,15 @@ statistics_FormatDuration($)
Erlaubt die korrekte zeitliche Zuordnung in Plots, kann je nach Systemauslastung verringert oder vergr&ouml;&szlig;ert werden
<br>
</li><br>
<li><code>singularReadings &lt;Ger&auml;tenameRegExp:Ger&auml;tewertRegExp&gt;:Statistiktypen<i>(Min|Avg|Max|Delta)</i>:ZeitPeriode<i>(Hour|Day|Month|Year)</i></code>
<br>
<li><code>singularReadings &lt;Ger&auml;tenameRegExp:Ger&auml;tewertRegExp&gt;:Statistiktypen:ZeitPeriode</code>
<ul>
<li>Statistiktypen: Min|Avg|Max|Delta</li>
<li>ZeitPeriode: Hour|Day|Month|Year</li>
</ul>
Regul&auml;rer Ausdruck statistischer Werte, die nicht nur in zusammengefassten sondern auch als einzelne Werte gespeichert werden sollen.
Erleichtert die Erzeugung von Plots.
<br>
z.B. <code>Wettersensor:rain:Delta:(Hour|Day))|(FritzDect:(current|power):(Avg|Max|Delta):(Hour|Day)</code>
z.B. <code>Wettersensor:rain:Delta:(Hour|Day))|FritzDect:power:Delta:Day</code>
<br>
</li><br>
<li><a href="#readingFnAttributes">readingFnAttributes</a>