From a09ca54e88d709faf7ad52a703fef137cc384f57 Mon Sep 17 00:00:00 2001 From: nasseeder1 Date: Fri, 23 Aug 2019 19:13:55 +0000 Subject: [PATCH] 93_DbRep: contrib 8.22.0 git-svn-id: https://svn.fhem.de/fhem/trunk@20047 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/contrib/DS_Starter/93_DbRep.pm | 286 ++++++++++++++++++---------- 1 file changed, 184 insertions(+), 102 deletions(-) diff --git a/fhem/contrib/DS_Starter/93_DbRep.pm b/fhem/contrib/DS_Starter/93_DbRep.pm index 1e5d3d750..c537057e5 100644 --- a/fhem/contrib/DS_Starter/93_DbRep.pm +++ b/fhem/contrib/DS_Starter/93_DbRep.pm @@ -1,5 +1,5 @@ ########################################################################################################## -# $Id: 93_DbRep.pm 19155 2019-04-10 22:19:42Z DS_Starter $ +# $Id: 93_DbRep.pm 19507 2019-05-31 09:03:18Z DS_Starter $ ########################################################################################################## # 93_DbRep.pm # @@ -58,6 +58,9 @@ no if $] >= 5.017011, warnings => 'experimental::smartmatch'; # Version History intern our %DbRep_vNotesIntern = ( + "8.22.0" => "23.08.2019 new attr fetchValueFn. When fetching the database content, manipulate the VALUE-field before create reading ", + "8.21.2" => "14.08.2019 commandRef revised ", + "8.21.1" => "31.05.2019 syncStandby considers executeBeforeProc, commandRef revised ", "8.21.0" => "28.04.2019 implement FHEM command \"dbReadingsVal\" ", "8.20.1" => "28.04.2019 set index verbose changed, check index \"Report_Idx\" in getInitData ", "8.20.0" => "27.04.2019 don't save hash refs in central hash to prevent potential memory leak, new set \"index\" ". @@ -152,6 +155,9 @@ our %DbRep_vNotesIntern = ( # Version History extern: our %DbRep_vNotesExtern = ( + "8.22.0" => "23.08.2019 A new attribute \"fetchValueFn\" is provided. When fetching the database content, you are able to manipulate ". + "the value displayed from the VALUE database field before create the appropriate reading. ", + "8.21.0" => "28.04.2019 FHEM command \"dbReadingsVal\" implemented.", "8.20.0" => "27.04.2019 With the new set \"index\" command it is now possible to list and (re)create the indexes which are ". "needed for DbLog and/or DbRep operation.", "8.19.0" => "04.04.2019 The \"explain\" SQL-command is possible in sqlCmd ", @@ -338,6 +344,7 @@ sub DbRep_Initialize($) { "fastStart:1,0 ". "fetchRoute:ascent,descent ". "fetchMarkDuplicates:red,blue,brown,green,orange ". + "fetchValueFn:textField-long ". "ftpDebug:1,0 ". "ftpDir ". "ftpDumpFilesKeep:1,2,3,4,5,6,7,8,9,10 ". @@ -884,7 +891,8 @@ sub DbRep_Set($@) { if(!exists($defs{$prop}) || $defs{$prop}->{TYPE} ne "DbLog") { return "The device \"$prop\" doesn't exist or is not a DbLog-device. "; } - $hash->{LASTCMD} = $prop?"$opt $prop":"$opt"; + $hash->{LASTCMD} = $prop?"$opt $prop":"$opt"; + DbRep_beforeproc($hash, "syncStandby"); DbRep_Main($hash,$opt,$prop); } else { @@ -1140,6 +1148,21 @@ sub DbRep_Attr($$$$) { } } + if ($aName eq "fetchValueFn") { + if($cmd eq "set") { + my $VALUE = "Hello"; + # Funktion aus Attr validieren + if( $aVal =~ m/^\s*(\{.*\})\s*$/s ) { + $aVal = $1; + } else { + $aVal = ""; + } + return "Your function does not match the form \"{}\"" if(!$aVal); + eval $aVal; + return "Bad function: $@" if($@); + } + } + if ($aName eq "sqlCmdHistoryLength") { if($cmd eq "set") { $do = ($aVal) ? 1 : 0; @@ -4871,6 +4894,7 @@ sub fetchrows_ParseDone($) { my $name = $hash->{NAME}; my $reading = AttrVal($name, "reading", undef); my $limit = AttrVal($name, "limit", 1000); + my $fvfn = AttrVal($name, "fetchValueFn", undef); my $color = ""; # Highlighting doppelter DB-Einträge $color =~ s/#// if($color =~ /red|blue|brown|green|orange/); my $ecolor = ""; # Ende Highlighting @@ -4942,6 +4966,19 @@ sub fetchrows_ParseDone($) { $reading_runtime_string = $ts."__".$dz."__".$dev."__".$rea.$zs; } } + + if($fvfn) { + my $VALUE = $val; + if( $fvfn =~ m/^\s*(\{.*\})\s*$/s ) { + $fvfn = $1; + } else { + $fvfn = ""; + } + if ($fvfn) { + eval $fvfn; + $val = $VALUE if(!$@); + } + } ReadingsBulkUpdateValue($hash, $reading_runtime_string, $val); } @@ -8215,6 +8252,10 @@ sub DbRep_syncStandbyDone($) { my $bt = $a[2]; my ($rt,$brt) = split(",", $bt); my $err = $a[3]?decode_base64($a[3]):undef; + my $erread; + + # Befehl nach Procedure ausführen + $erread = DbRep_afterproc($hash, "syncStandby"); if ($err) { ReadingsSingleUpdateValue ($hash, "errortext", $err, 1); @@ -8224,16 +8265,14 @@ sub DbRep_syncStandbyDone($) { return; } - # only for this block because of warnings if details of readings are not set no warnings 'uninitialized'; + my $state = $erread?$erread:"done"; + readingsBeginUpdate($hash); ReadingsBulkUpdateValue ($hash, "number_lines_inserted_Standby", $irows); - ReadingsBulkUpdateTimeState($hash,$brt,$rt,"done"); + ReadingsBulkUpdateTimeState($hash,$brt,$rt,$state); readingsEndUpdate($hash, 1); - - # Befehl nach Procedure ausführen - my $erread = DbRep_afterproc($hash, "syncStandby"); delete($hash->{HELPER}{RUNNING_PID}); @@ -9538,13 +9577,11 @@ sub DbRep_delread($;$$) { # Highlighted Readings löschen und save statefile wegen Inkompatibilitär beim Restart if($key =~ / 5.9 und zu lang nach der neuen Festlegung if($do == 0 && $featurelevel > 5.9 && !goodReadingName($key)) { $do = 1; - # delete($defs{$name}{READINGS}{$key}); readingsDelete($hash,$key); } } @@ -10518,12 +10555,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 19155 2019-04-10 22:19:42Z DS_Starter $ im Kopf komplett! vorhanden ) + if($modules{$type}{META}{x_version}) { # {x_version} ( nur gesetzt wenn $Id: 93_DbRep.pm 19507 2019-05-31 09:03:18Z 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 19155 2019-04-10 22:19:42Z DS_Starter $ im Kopf komplett! vorhanden ) + return $@ unless (FHEM::Meta::SetInternals($hash)); # FVERSION wird gesetzt ( nur gesetzt wenn $Id: 93_DbRep.pm 19507 2019-05-31 09:03:18Z DS_Starter $ im Kopf komplett! vorhanden ) if(__PACKAGE__ eq "FHEM::$type" || __PACKAGE__ eq $type) { # es wird mit Packages gearbeitet -> Perl übliche Modulversion setzen # mit {->VERSION()} im FHEMWEB kann Modulversion abgefragt werden @@ -10987,8 +11024,8 @@ return; averageCalcForm : choose the calculation variant for average determination device : include or exclude <device> from selection - executeBeforeProc : execution of FHEM command (or perl-routine) before operation - executeAfterProc : execution of FHEM command (or perl-routine) after operation + executeBeforeProc : execution of FHEM command (or Perl-routine) before operation + executeAfterProc : execution of FHEM command (or Perl-routine) after operation reading : include or exclude <reading> from selection time.* : a number of attributes to limit selection by time valueFilter : an additional REGEXP to control the record selection. The REGEXP is applied to the database field 'VALUE'. @@ -11051,8 +11088,8 @@ return; device : include or exclude <device> from selection reading : include or exclude <reading> from selection time.* : a number of attributes to limit selection by time - executeBeforeProc : execute a FHEM command (or perl-routine) before start of changeValue - executeAfterProc : execute a FHEM command (or perl-routine) after changeValue is finished + executeBeforeProc : execute a FHEM command (or Perl-routine) before start of changeValue + executeAfterProc : execute a FHEM command (or Perl-routine) after changeValue is finished valueFilter : an additional REGEXP to control the record selection. The REGEXP is applied to the database field 'VALUE'. @@ -11141,8 +11178,8 @@ return; limit : limits ONLY the count of datasets to display device : include or exclude <device> from selection reading : include or exclude <reading> from selection - executeBeforeProc : execute a FHEM command (or perl-routine) before start of the function - executeAfterProc : execute a FHEM command (or perl-routine) after the function is finished + executeBeforeProc : execute a FHEM command (or Perl-routine) before start of the function + executeAfterProc : execute a FHEM command (or Perl-routine) after the function is finished time.* : a number of attributes to limit selection by time valueFilter : an additional REGEXP to control the record selection. The REGEXP is applied to the database field 'VALUE'. @@ -11175,8 +11212,8 @@ return; device : include or exclude <device> from selection reading : include or exclude <reading> from selection time.* : a number of attributes to limit selection by time - executeBeforeProc : execute a FHEM command (or perl-routine) before start of delEntries - executeAfterProc : execute a FHEM command (or perl-routine) after delEntries is finished + executeBeforeProc : execute a FHEM command (or Perl-routine) before start of delEntries + executeAfterProc : execute a FHEM command (or Perl-routine) after delEntries is finished
@@ -11262,8 +11299,8 @@ return; limit : limits ONLY the count of datasets to display device : include or exclude <device> from selection reading : include or exclude <reading> from selection - executeBeforeProc : execute a FHEM command (or perl-routine) before start of the function - executeAfterProc : execute a FHEM command (or perl-routine) after the function is finished + executeBeforeProc : execute a FHEM command (or Perl-routine) before start of the function + executeAfterProc : execute a FHEM command (or Perl-routine) after the function is finished seqDoubletsVariance : Up to this value consecutive numerical datasets are handled as identical and should be deleted time.* : a number of attributes to limit selection by time valueFilter : an additional REGEXP to control the record selection. The REGEXP is applied to the database field 'VALUE'. @@ -11342,8 +11379,8 @@ return; aggregation : choose the aggregation period diffAccept : the maximum accepted difference between sequential records device : include or exclude <device> from selection - executeBeforeProc : execution of FHEM command (or perl-routine) before operation - executeAfterProc : execution of FHEM command (or perl-routine) after operation + executeBeforeProc : execution of FHEM command (or Perl-routine) before operation + executeAfterProc : execution of FHEM command (or Perl-routine) after operation reading : include or exclude <reading> from selection readingNameMap : rename the resulted reading name time.* : a number of attributes to limit selection by time @@ -11393,8 +11430,8 @@ return; dumpMemlimit : limits memory usage dumpSpeed : limits CPU utilization dumpFilesKeep : number of dump files to keep - executeBeforeProc : execution of FHEM command (or perl-routine) before dump - executeAfterProc : execution of FHEM command (or perl-routine) after dump + executeBeforeProc : execution of FHEM command (or Perl-routine) before dump + executeAfterProc : execution of FHEM command (or Perl-routine) after dump optimizeTablesBeforeDump : table optimization before dump @@ -11448,8 +11485,8 @@ return; dumpCompress : compress of dump files after creation dumpDirLocal : the local mounted directory dumpDirRemote dumpFilesKeep : number of dump files to keep - executeBeforeProc : execution of FHEM command (or perl-routine) before dump - executeAfterProc : execution of FHEM command (or perl-routine) after dump + executeBeforeProc : execution of FHEM command (or Perl-routine) before dump + executeAfterProc : execution of FHEM command (or Perl-routine) after dump optimizeTablesBeforeDump : table optimization before dump @@ -11547,8 +11584,8 @@ return; dumpCompress : compress of dump files after creation dumpDirLocal : the local mounted directory dumpDirRemote dumpFilesKeep : number of dump files to keep - executeBeforeProc : execution of FHEM command (or perl-routine) before dump - executeAfterProc : execution of FHEM command (or perl-routine) after dump + executeBeforeProc : execution of FHEM command (or Perl-routine) before dump + executeAfterProc : execution of FHEM command (or Perl-routine) after dump optimizeTablesBeforeDump : table optimization before dump @@ -11597,8 +11634,8 @@ return; aggregation : determination of selection time slices device : include or exclude <device> from selection reading : include or exclude <reading> from selection time.* : a number of attributes to limit selection by time - executeBeforeProc : execution of FHEM command (or perl-routine) before export - executeAfterProc : execution of FHEM command (or perl-routine) after export + executeBeforeProc : execution of FHEM command (or Perl-routine) before export + executeAfterProc : execution of FHEM command (or Perl-routine) after export expimpfile : the name of exportfile time.* : a number of attributes to limit selection by time valueFilter : an additional REGEXP to control the record selection. The REGEXP is applied to the database field 'VALUE'. @@ -11619,7 +11656,8 @@ return; Every reading of result is composed of the dataset timestring , an index, the device name and the reading name. The function has the capability to reconize multiple occuring datasets (doublets). - Such doublets are marked by an index > 1.
+ Such doublets are marked by an index > 1. Optional a Unique-Index is appended if + datasets with identical timestamp, device and reading but different value are existing.
Doublets can be highlighted in terms of color by setting attribut e"fetchMarkDuplicates".

Note:
@@ -11639,8 +11677,8 @@ return;
    Example:
    - 2017-10-22_03-04-43__1__SMA_Energymeter__Bezug_WirkP_Kosten_Diff
    - # <date>_<time>__<index>__<device>__<reading> + 2017-10-22_03-04-43__1__SMA_Energymeter__Bezug_WirkP_Kosten_Diff__[1]
    + # <date>_<time>__<index>__<device>__<reading>__[Unique-Index]

@@ -11649,10 +11687,11 @@ return;
    - - - + + + + @@ -11669,7 +11708,7 @@ return;
  • index <Option> - - Reports the existing indexes in the database or creates the needed indexes. + - Reports the existing indexes in the database or creates the index which is needed. If the index is already created, it will be renewed (dropped and new created)

    The possible options are:

    @@ -11685,6 +11724,9 @@ return;
  • fetchRoute : direction of selection read in database
    limit : limits the number of datasets to select and display
    fetchMarkDuplicates : Highlighting of found doublets
    device : include or exclude <device> from selection
    fetchRoute : direction of selection read in database
    fetchMarkDuplicates : Highlighting of found doublets
    fetchValueFn : the displayed value of the VALUE database field can be changed by a function before the reading is created
    limit : limits the number of datasets to select and display
    reading : include or exclude <reading> from selection
    time.* : A number of attributes to limit selection by time
    valueFilter : an additional REGEXP to control the record selection. The REGEXP is applied to the database field 'VALUE'.

+ + Note:
+ The used database user needs the ALTER and INDEX privilege.

@@ -11730,8 +11772,8 @@ return;
    - - + +
    executeBeforeProc : execution of FHEM command (or perl-routine) before import
    executeAfterProc : execution of FHEM command (or perl-routine) after import
    executeBeforeProc : execution of FHEM command (or Perl-routine) before import
    executeAfterProc : execution of FHEM command (or Perl-routine) after import
    expimpfile : the name of exportfile
@@ -11771,8 +11813,8 @@ return; aggregation : choose the aggregation period device : include or exclude <device> from selection - executeBeforeProc : execution of FHEM command (or perl-routine) before operation - executeAfterProc : execution of FHEM command (or perl-routine) after operation + executeBeforeProc : execution of FHEM command (or Perl-routine) before operation + executeAfterProc : execution of FHEM command (or Perl-routine) after operation reading : include or exclude <reading> from selection readingNameMap : rename the resulted readings time.* : a number of attributes to limit selection by time @@ -11813,8 +11855,8 @@ return; aggregation : choose the aggregation period device : include or exclude <device> from selection - executeBeforeProc : execution of FHEM command (or perl-routine) before operation - executeAfterProc : execution of FHEM command (or perl-routine) after operation + executeBeforeProc : execution of FHEM command (or Perl-routine) before operation + executeAfterProc : execution of FHEM command (or Perl-routine) after operation reading : include or exclude <reading> from selection readingNameMap : rename the resulted readings time.* : a number of attributes to limit selection by time @@ -11882,8 +11924,8 @@ return;
    - - + + @@ -12071,8 +12113,8 @@ return;
    executeBeforeProc : execution of FHEM command (or perl-routine) before reducelog
    executeAfterProc : execution of FHEM command (or perl-routine) after reducelog
    executeBeforeProc : execution of FHEM command (or Perl-routine) before reducelog
    executeAfterProc : execution of FHEM command (or Perl-routine) after reducelog
    device : include or exclude <device> for selection
    reading : include or exclude <reading> for selection
    timeOlderThan : records older than this attribute will be reduced
    - - + + @@ -12103,8 +12145,8 @@ return;
    allowDeletion : activates capabilty to delete datasets
    executeBeforeProc : execution of FHEM command (or perl-routine) before operation
    executeAfterProc : execution of FHEM command (or perl-routine) after operation
    executeBeforeProc : execution of FHEM command (or Perl-routine) before operation
    executeAfterProc : execution of FHEM command (or Perl-routine) after operation
    sqlResultFormat : determines presentation style of command result
    sqlResultFieldSep : choice of a useful field separator for result
    sqlCmdHistoryLength : activates command history and length
    - - + +
    allowDeletion : activates capabilty to delete datasets
    executeBeforeProc : execution of FHEM command (or perl-routine) before operation
    executeAfterProc : execution of FHEM command (or perl-routine) after operation
    executeBeforeProc : execution of FHEM command (or Perl-routine) before operation
    executeAfterProc : execution of FHEM command (or Perl-routine) after operation
    sqlResultFormat : determines presentation style of command result
    sqlResultFieldSep : choice of a useful field separator for result
    @@ -12123,8 +12165,8 @@ return;
      - - + +
      executeBeforeProc : execution of FHEM command (or perl-routine) before operation
      executeAfterProc : execution of FHEM command (or perl-routine) after operation
      executeBeforeProc : execution of FHEM command (or Perl-routine) before operation
      executeAfterProc : execution of FHEM command (or Perl-routine) after operation
      sqlResultFormat : determines the formatting of the result
      sqlResultFieldSep : determines the used field separator in statement result
      @@ -12174,8 +12216,8 @@ return; aggregation : choose the aggregation period device : include or exclude <device> from selection - executeBeforeProc : execution of FHEM command (or perl-routine) before operation - executeAfterProc : execution of FHEM command (or perl-routine) after operation + executeBeforeProc : execution of FHEM command (or Perl-routine) before operation + executeAfterProc : execution of FHEM command (or Perl-routine) after operation reading : include or exclude <reading> from selection readingNameMap : rename the resulted readings time.* : a number of attributes to limit selection by time @@ -12190,7 +12232,7 @@ return; (Standby-database).
      Here the "<DbLog-Device Standby>" is the DbLog-Device what is connected to the Standby-database.

      - All the datasets which are determined by timestamp-attributes + All the datasets which are determined by timestamp-attributes or respectively the attributes "device", "reading" are transmitted.
      The datasets are transmitted in time slices accordingly to the adjusted aggregation. If the attribute "aggregation" has value "no" or "month", the datasets are transmitted @@ -12203,8 +12245,10 @@ return;
        - + + + @@ -12672,6 +12716,21 @@ sub bdump {

        + + +
      • fetchValueFn - When fetching the database content, you are able to manipulate the value fetched from the + VALUE database field before create the appropriate reading. You have to insert a Perl + function which is enclosed in {} .
        + The value of the database field VALUE is provided in variable $VALUE.

        + +
          + Example:
          + attr <name> fetchValueFn { $VALUE =~ s/^.*Used:\s(.*)\sMB,.*/$1." MB"/e }
          + + # From a long line a specific pattern is extracted and will be displayed als VALUE instead + the whole line +
        +


      • ftpUse - FTP Transfer after dump will be switched on (without SSL encoding). The created @@ -13402,8 +13461,8 @@ sub bdump {
      • - - + + @@ -13466,8 +13525,8 @@ sub bdump { - - + +
        aggregation : adjustment of time slices for data transmission (hour,day,week)
        aggregation : adjustment of time slices for data transmission (hour,day,week,...)
        device : include or exclude <device> for transmission
        executeBeforeProc : execution of FHEM command (or Perl-routine) before operation
        executeAfterProc : execution of FHEM command (or Perl-routine) after operation
        reading : include or exclude <reading> for transmission
        time.* : a number of attributes to limit selection by time
        valueFilter : an additional REGEXP to control the record selection. The REGEXP is applied to the database field 'VALUE'.
        aggregation : Auswahl einer Aggregationsperiode
        averageCalcForm : Auswahl der Berechnungsvariante für den Durchschnitt
        device : einschließen oder ausschließen von Datensätzen die <device> enthalten
        executeBeforeProc : ausführen FHEM Kommando (oder perl-Routine) vor Start Operation
        executeAfterProc : ausführen FHEM Kommando (oder perl-Routine) nach Ende Operation
        executeBeforeProc : ausführen FHEM Kommando (oder Perl-Routine) vor Start Operation
        executeAfterProc : ausführen FHEM Kommando (oder Perl-Routine) nach Ende Operation
        reading : einschließen oder ausschließen von Datensätzen die <reading> enthalten
        readingNameMap : die entstehenden Ergebnisreadings werden partiell umbenannt
        time.* : eine Reihe von Attributen zur Zeitabgrenzung
        aggregation : Auswahl einer Aggregationsperiode
        reading : einschließen oder ausschließen von Datensätzen die <reading> enthalten
        time.* : eine Reihe von Attributen zur Zeitabgrenzung
        executeBeforeProc : ausführen FHEM Kommando (oder perl-Routine) vor Start changeValue
        executeAfterProc : ausführen FHEM Kommando (oder perl-Routine) nach Ende changeValue
        executeBeforeProc : ausführen FHEM Kommando (oder Perl-Routine) vor Start changeValue
        executeAfterProc : ausführen FHEM Kommando (oder Perl-Routine) nach Ende changeValue
        valueFilter : ein zusätzliches REGEXP um die Datenselektion zu steuern. Der REGEXP wird auf das Datenbankfeld 'VALUE' angewendet.
      @@ -13560,8 +13619,8 @@ sub bdump { limit : begrenzt NUR die Anzahl der anzuzeigenden Datensätze reading : einschließen oder ausschließen von Datensätzen die <reading> enthalten time.* : eine Reihe von Attributen zur Zeitabgrenzung - executeBeforeProc : ausführen FHEM Kommando (oder perl-Routine) vor Start des Befehls - executeAfterProc : ausführen FHEM Kommando (oder perl-Routine) nach Ende des Befehls valueFilter : ein zusätzliches REGEXP um die Datenselektion zu steuern. Der REGEXP wird auf das Datenbankfeld 'VALUE' angewendet. + executeBeforeProc : ausführen FHEM Kommando (oder Perl-Routine) vor Start des Befehls + executeAfterProc : ausführen FHEM Kommando (oder Perl-Routine) nach Ende des Befehls valueFilter : ein zusätzliches REGEXP um die Datenselektion zu steuern. Der REGEXP wird auf das Datenbankfeld 'VALUE' angewendet.

    @@ -13595,8 +13654,8 @@ sub bdump { reading : einschließen oder ausschließen von Datensätzen die <reading> enthalten readingNameMap : die entstehenden Ergebnisreadings werden partiell umbenannt time.* : eine Reihe von Attributen zur Zeitabgrenzung - executeBeforeProc : ausführen FHEM Kommando (oder perl-Routine) vor Start delEntries - executeAfterProc : ausführen FHEM Kommando (oder perl-Routine) nach Ende delEntries + executeBeforeProc : ausführen FHEM Kommando (oder Perl-Routine) vor Start delEntries + executeAfterProc : ausführen FHEM Kommando (oder Perl-Routine) nach Ende delEntries valueFilter : ein zusätzliches REGEXP um die Datenselektion zu steuern. Der REGEXP wird auf das Datenbankfeld 'VALUE' angewendet.
@@ -13685,8 +13744,8 @@ sub bdump { readingNameMap : die entstehenden Ergebnisreadings werden partiell umbenannt seqDoubletsVariance : bis zu diesem Wert werden aufeinander folgende numerische Datensätze als identisch angesehen und werden gelöscht time.* : eine Reihe von Attributen zur Zeitabgrenzung - executeBeforeProc : ausführen FHEM Kommando (oder perl-Routine) vor Start des Befehls - executeAfterProc : ausführen FHEM Kommando (oder perl-Routine) nach Ende des Befehls + executeBeforeProc : ausführen FHEM Kommando (oder Perl-Routine) vor Start des Befehls + executeAfterProc : ausführen FHEM Kommando (oder Perl-Routine) nach Ende des Befehls valueFilter : ein zusätzliches REGEXP um die Datenselektion zu steuern. Der REGEXP wird auf das Datenbankfeld 'VALUE' angewendet. @@ -13761,8 +13820,8 @@ sub bdump { aggregation : Auswahl einer Aggregationsperiode device : einschließen oder ausschließen von Datensätzen die <device> enthalten - executeBeforeProc : ausführen FHEM Kommando (oder perl-Routine) vor Start Operation - executeAfterProc : ausführen FHEM Kommando (oder perl-Routine) nach Ende Operation + executeBeforeProc : ausführen FHEM Kommando (oder Perl-Routine) vor Start Operation + executeAfterProc : ausführen FHEM Kommando (oder Perl-Routine) nach Ende Operation reading : einschließen oder ausschließen von Datensätzen die <reading> enthalten readingNameMap : die entstehenden Ergebnisreadings werden partiell umbenannt time.* : eine Reihe von Attributen zur Zeitabgrenzung @@ -13810,8 +13869,8 @@ sub bdump { dumpMemlimit : Begrenzung der Speicherverwendung dumpSpeed : Begrenzung die CPU-Belastung dumpFilesKeep : Anzahl der aufzubwahrenden Dumpfiles - executeBeforeProc : ausführen FHEM Kommando (oder perl-Routine) vor dem Dump - executeAfterProc : ausführen FHEM Kommando (oder perl-Routine) nach dem Dump + executeBeforeProc : ausführen FHEM Kommando (oder Perl-Routine) vor dem Dump + executeAfterProc : ausführen FHEM Kommando (oder Perl-Routine) nach dem Dump optimizeTablesBeforeDump : Tabelloptimierung vor dem Dump ausführen @@ -13865,8 +13924,8 @@ sub bdump { dumpCompress : Komprimierung des Dumpfiles nach der Erstellung dumpDirLocal : Directory des lokal gemounteten dumpDirRemote-Verzeichnisses dumpFilesKeep : Anzahl der aufzubwahrenden Dumpfiles - executeBeforeProc : ausführen FHEM Kommando (oder perl-Routine) vor dem Dump - executeAfterProc : ausführen FHEM Kommando (oder perl-Routine) nach dem Dump + executeBeforeProc : ausführen FHEM Kommando (oder Perl-Routine) vor dem Dump + executeAfterProc : ausführen FHEM Kommando (oder Perl-Routine) nach dem Dump optimizeTablesBeforeDump : Tabelloptimierung vor dem Dump ausführen @@ -13963,8 +14022,8 @@ sub bdump { dumpCompress : Komprimierung des Dumpfiles nach der Erstellung dumpDirLocal : Directory des lokal gemounteten dumpDirRemote-Verzeichnisses dumpFilesKeep : Anzahl der aufzubwahrenden Dumpfiles - executeBeforeProc : ausführen FHEM Kommando (oder perl-Routine) vor dem Dump - executeAfterProc : ausführen FHEM Kommando (oder perl-Routine) nach dem Dump + executeBeforeProc : ausführen FHEM Kommando (oder Perl-Routine) vor dem Dump + executeAfterProc : ausführen FHEM Kommando (oder Perl-Routine) nach dem Dump optimizeTablesBeforeDump : Tabelloptimierung vor dem Dump ausführen @@ -14012,8 +14071,8 @@ sub bdump { aggregation : Festlegung der Selektionspaketierung device : einschließen oder ausschließen von Datensätzen die <device> enthalten reading : einschließen oder ausschließen von Datensätzen die <reading> enthalten - executeBeforeProc : FHEM Kommando (oder perl-Routine) vor dem Export ausführen - executeAfterProc : FHEM Kommando (oder perl-Routine) nach dem Export ausführen + executeBeforeProc : FHEM Kommando (oder Perl-Routine) vor dem Export ausführen + executeAfterProc : FHEM Kommando (oder Perl-Routine) nach dem Export ausführen expimpfile : der Name des Exportfiles time.* : eine Reihe von Attributen zur Zeitabgrenzung valueFilter : ein zusätzliches REGEXP um die Datenselektion zu steuern. Der REGEXP wird auf das Datenbankfeld 'VALUE' angewendet. @@ -14030,10 +14089,12 @@ sub bdump { Die Leserichtung in der Datenbank kann durch das Attribut "fetchRoute" bestimmt werden.

- Jedes Ergebnisreading setzt sich aus dem Timestring des Datensatzes, einem Index, dem Device - und dem Reading zusammen. + Jedes Ergebnisreading setzt sich aus dem Timestring des Datensatzes, einem Dubletten-Index, + dem Device und dem Reading zusammen. Die Funktion fetchrows ist in der Lage, mehrfach vorkommende Datensätze (Dubletten) zu erkennen. - Solche Dubletten sind mit einem Index > 1 gekennzeichnet.
+ Solche Dubletten sind mit einem Dubletten-Index > 1 gekennzeichnet. Optional wird noch ein + Unique-Index angehängt, wenn Datensätze mit identischem Timestamp, Device und Reading aber + unterschiedlichem Value vorhanden sind.
Dubletten können mit dem Attribut "fetchMarkDuplicates" farblich hervorgehoben werden.

Hinweis:
@@ -14055,8 +14116,8 @@ sub bdump {
    Beispiel:
    - 2017-10-22_03-04-43__1__SMA_Energymeter__Bezug_WirkP_Kosten_Diff
    - # <Datum>_<Zeit>__<Index>__<Device>__<Reading> + 2017-10-22_03-04-43__1__SMA_Energymeter__Bezug_WirkP_Kosten_Diff__[1]
    + # <Datum>_<Zeit>__<Dubletten-Index>__<Device>__<Reading>__[Unique-Index]

@@ -14066,10 +14127,11 @@ sub bdump {
    - - - + + + + @@ -14091,7 +14153,7 @@ sub bdump { - Listet die in der Datenbank vorhandenen Indexe auf bzw. legt die benötigten Indexe an. Ist ein Index bereits angelegt, wird er erneuert (gelöscht und erneut angelegt)

    - Die möglichen Optionen sind:

    + Die möglichen Optionen sind:

    fetchRoute : Leserichtung der Selektion innerhalb der Datenbank
    limit : begrenzt die Anzahl zu selektierenden bzw. anzuzeigenden Datensätze
    fetchMarkDuplicates : Hervorhebung von gefundenen Dubletten
    device : einschließen oder ausschließen von Datensätzen die <device> enthalten
    fetchRoute : Leserichtung der Selektion innerhalb der Datenbank
    fetchMarkDuplicates : Hervorhebung von gefundenen Dubletten
    fetchValueFn : der angezeigte Wert des VALUE Datenbankfeldes kann mit einer Funktion vor der Readingerstellung geändert werden
    limit : begrenzt die Anzahl zu selektierenden bzw. anzuzeigenden Datensätze
    reading : einschließen oder ausschließen von Datensätzen die <reading> enthalten
    time.* : eine Reihe von Attributen zur Zeitabgrenzung
    valueFilter : filtert die anzuzeigenden Datensätze mit einem regulären Ausdruck (Datenbank spezifischer REGEXP). Der REGEXP wird auf Werte des Datenbankfeldes 'VALUE' angewendet.
    @@ -14104,6 +14166,9 @@ sub bdump {

+ + Hinweis:
+ Der verwendete Datenbank-Nutzer benötigt das ALTER und INDEX Privileg.

@@ -14151,8 +14216,8 @@ sub bdump {
    - - + +
    executeBeforeProc : FHEM Kommando (oder perl-Routine) vor dem Import ausführen
    executeAfterProc : FHEM Kommando (oder perl-Routine) nach dem Import ausführen
    executeBeforeProc : FHEM Kommando (oder Perl-Routine) vor dem Import ausführen
    executeAfterProc : FHEM Kommando (oder Perl-Routine) nach dem Import ausführen
    expimpfile : der Name des Importfiles
@@ -14194,8 +14259,8 @@ sub bdump { aggregation : Auswahl einer Aggregationsperiode device : einschließen oder ausschließen von Datensätzen die <device> enthalten - executeBeforeProc : ausführen FHEM Kommando (oder perl-Routine) vor Start Operation - executeAfterProc : ausführen FHEM Kommando (oder perl-Routine) nach Ende Operation + executeBeforeProc : ausführen FHEM Kommando (oder Perl-Routine) vor Start Operation + executeAfterProc : ausführen FHEM Kommando (oder Perl-Routine) nach Ende Operation reading : einschließen oder ausschließen von Datensätzen die <reading> enthalten readingNameMap : die entstehenden Ergebnisreadings werden partiell umbenannt time.* : eine Reihe von Attributen zur Zeitabgrenzung @@ -14241,8 +14306,8 @@ sub bdump { aggregation : Auswahl einer Aggregationsperiode device : einschließen oder ausschließen von Datensätzen die <device> enthalten - executeBeforeProc : ausführen FHEM Kommando (oder perl-Routine) vor Start Operation - executeAfterProc : ausführen FHEM Kommando (oder perl-Routine) nach Ende Operation + executeBeforeProc : ausführen FHEM Kommando (oder Perl-Routine) vor Start Operation + executeAfterProc : ausführen FHEM Kommando (oder Perl-Routine) nach Ende Operation reading : einschließen oder ausschließen von Datensätzen die <reading> enthalten readingNameMap : die entstehenden Ergebnisreadings werden partiell umbenannt time.* : eine Reihe von Attributen zur Zeitabgrenzung @@ -14314,8 +14379,8 @@ sub bdump {
    - - + + @@ -14508,8 +14573,8 @@ sub bdump {
    executeBeforeProc : FHEM Kommando (oder perl-Routine) vor dem Export ausführen
    executeAfterProc : FHEM Kommando (oder perl-Routine) nach dem Export ausführen
    executeBeforeProc : FHEM Kommando (oder Perl-Routine) vor dem Export ausführen
    executeAfterProc : FHEM Kommando (oder Perl-Routine) nach dem Export ausführen
    device : einschließen oder ausschließen von Datensätzen die <device> enthalten
    reading : einschließen oder ausschließen von Datensätzen die <reading> enthalten
    timeOlderThan : es werden Datenbankeinträge älter als dieses Attribut reduziert
    - - + + @@ -14541,8 +14606,8 @@ sub bdump {
    executeBeforeProc : FHEM Kommando (oder perl-Routine) vor der Operation ausführen
    executeAfterProc : FHEM Kommando (oder perl-Routine) nach der Operation ausführen
    executeBeforeProc : FHEM Kommando (oder Perl-Routine) vor der Operation ausführen
    executeAfterProc : FHEM Kommando (oder Perl-Routine) nach der Operation ausführen
    allowDeletion : aktiviert Löschmöglichkeit
    sqlResultFormat : legt die Darstellung des Kommandoergebnis fest
    sqlResultFieldSep : Auswahl Feldtrenner im Ergebnis
    - - + + @@ -14564,8 +14629,8 @@ sub bdump {
    executeBeforeProc : FHEM Kommando (oder perl-Routine) vor der Operation ausführen
    executeAfterProc : FHEM Kommando (oder perl-Routine) nach der Operation ausführen
    executeBeforeProc : FHEM Kommando (oder Perl-Routine) vor der Operation ausführen
    executeAfterProc : FHEM Kommando (oder Perl-Routine) nach der Operation ausführen
    allowDeletion : aktiviert Löschmöglichkeit
    sqlResultFormat : legt die Darstellung des Kommandoergebnis fest
    sqlResultFieldSep : Auswahl Feldtrenner im Ergebnis
    - - + +
    executeBeforeProc : FHEM Kommando (oder perl-Routine) vor der Operation ausführen
    executeAfterProc : FHEM Kommando (oder perl-Routine) nach der Operation ausführen
    executeBeforeProc : FHEM Kommando (oder Perl-Routine) vor der Operation ausführen
    executeAfterProc : FHEM Kommando (oder Perl-Routine) nach der Operation ausführen
    sqlResultFormat : Optionen der Ergebnisformatierung
    sqlResultFieldSep : Auswahl des Trennzeichens zwischen Ergebnisfeldern
    @@ -14615,8 +14680,8 @@ sub bdump { aggregation : Auswahl einer Aggregationsperiode device : einschließen oder ausschließen von Datensätzen die <device> enthalten - executeBeforeProc : ausführen FHEM Kommando (oder perl-Routine) vor Start Operation - executeAfterProc : ausführen FHEM Kommando (oder perl-Routine) nach Ende Operation + executeBeforeProc : ausführen FHEM Kommando (oder Perl-Routine) vor Start Operation + executeAfterProc : ausführen FHEM Kommando (oder Perl-Routine) nach Ende Operation reading : einschließen oder ausschließen von Datensätzen die <reading> enthalten readingNameMap : die entstehenden Ergebnisreadings werden partiell umbenannt time.* : eine Reihe von Attributen zur Zeitabgrenzung @@ -14632,7 +14697,7 @@ sub bdump { Datenbank (Standby-Datenbank) übertragen. Dabei ist "<DbLog-Device Standby>" das DbLog-Device, welches mit der Standby-Datenbank verbunden ist.

    - Es werden alle Datensätze übertragen, die durch Timestamp-Attribute + Es werden alle Datensätze übertragen, die durch Timestamp-Attribute bzw. die Attribute "device", "reading" bestimmt sind.
    Die Datensätze werden dabei in Zeitscheiben entsprechend der eingestellten Aggregation übertragen. Hat das Attribut "aggregation" den Wert "no" oder "month", werden die Datensätze automatisch @@ -14646,6 +14711,8 @@ sub bdump { + + @@ -15108,6 +15175,21 @@ sub bdump {

    + + +
  • fetchValueFn - Der angezeigte Wert des Datenbankfeldes VALUE kann vor der Erstellung des entsprechenden + Readings geändert werden. Das Attribut muss eine Perl Funktion eingeschlossen in {} + enthalten.
    + Der Wert des Datenbankfeldes VALUE wird in der Variable $VALUE zur Verfügung gestellt.

    + +
      + Beispiel:
      + attr <name> fetchValueFn { $VALUE =~ s/^.*Used:\s(.*)\sMB,.*/$1." MB"/e }
      + + # Von einer langen Ausgabe wird ein spezifisches Zeichenmuster extrahiert und als VALUE + anstatt der gesamten Zeile im Reading angezeigt. +
    +


  • ftpUse - FTP Transfer nach einem Dump wird eingeschaltet (ohne SSL Verschlüsselung). Das erzeugte
  • aggregation : Einstellung der Zeitscheiben zur Übertragung (hour,day,week)
    executeBeforeProc : ausführen FHEM Kommando (oder Perl-Routine) vor Start Operation
    executeAfterProc : ausführen FHEM Kommando (oder Perl-Routine) nach Ende Operation
    device : einschließen oder ausschließen von Datensätzen die <device> enthalten
    reading : einschließen oder ausschließen von Datensätzen die <reading> enthalten
    time.* : Attribute zur Zeitabgrenzung der zu übertragenden Datensätze.