| $key | $val0 | " ); + $ret .= "
| $key | $val0 | $val1 | " ); + $ret .= "
| /g; + $res .= " |
| ".$row." |
| ID | "; + $res .= "USER | "; + $res .= "HOST | "; + $res .= "DB | "; + $res .= "CMD | "; + $res .= "TIME_Sec | "; + $res .= "STATE | "; + $res .= "INFO | "; + $res .= "PROGRESS | /g; + $res .= " |
| ".$row." |
| PID | "; + $res .= "FUNCTION | "; + $res .= "ARGUMENTS | "; + $res .= "TIMEOUT | "; + $res .= "CONNECTEDVIA | /g; + $res .= " |
| ".$row." |
DbReadingsVal("<name>","<device:reading>","<timestamp>","<default>") | <name> | : name of the DbRep-Device to request |
| <device:reading> | : device:reading whose value is to deliver |
| <timestamp> | : timestamp of reading whose value is to deliver (*) in the form "YYYY-MM-DD hh:mm:ss" |
| <default> | : default value if no reading value can be retrieved |
+ CREATE INDEX Report_Idx ON `history` (TIMESTAMP, READING) USING BTREE;
+
+
+ define <name> DbRep <name of DbLog-instance>
+
+
+ | averageCalcForm | : choose the calculation variant for average determination |
| device | : include or exclude <device> from selection |
| 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'. |
| <old string> : | |
| <new string> : |
| 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 |
| valueFilter | : an additional REGEXP to control the record selection. The REGEXP is applied to the database field 'VALUE'. |
| aggregation | : aggregatiion/grouping of time intervals |
| countEntriesDetail | : detailed report the count of datasets (per reading) |
| device | : include or exclude <device> from selection |
| 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'. |
| adviceDelete | : simulates the datasets to delete in database (nothing will be deleted !) |
| delete | : deletes the doublets |
| allowDeletion | : needs to be set to execute the delete option |
| aggregation | : choose the aggregation period |
| 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 |
| 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'. |
| allowDeletion | : unlock the delete function |
| 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 |
| adviceRemain | : simulates the remaining datasets in database after delete-operation (nothing will be deleted !) |
| adviceDelete | : simulates the datasets to delete in database (nothing will be deleted !) |
| delete | : deletes the consecutive doublets (see example) |
| allowDeletion | : needs to be set to execute the delete option |
| aggregation | : choose the aggregation period |
| 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 |
| 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'. |
| aggregation | : choose the aggregation period |
| diffAccept | : the maximum accepted difference between sequential records |
| device | : include or exclude <device> from selection |
| reading | : include or exclude <reading> from selection |
| readingNameMap | : rename the resulted reading name |
| 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'. |
| dumpComment | : User comment in head of dump file |
| dumpCompress | : compress of dump files after creation |
| dumpDirLocal | : the local destination directory for dump file creation |
| 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 |
| optimizeTablesBeforeDump | : table optimization before dump |
| dumpDirRemote | : destination directory of dump file on remote server |
| 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 |
| optimizeTablesBeforeDump | : table optimization before dump |
| ftpUse | : FTP Transfer after dump will be switched on (without SSL encoding) |
| ftpUser | : User for FTP-server login, default: anonymous |
| ftpUseSSL | : FTP Transfer with SSL encoding after dump |
| ftpDebug | : debugging of FTP communication for diagnostics |
| ftpDir | : directory on FTP-server in which the file will be send into (default: "/") |
| ftpDumpFilesKeep | : leave the number of dump files in FTP-destination <ftpDir> (default: 3) |
| ftpPassive | : set if passive FTP is to be used |
| ftpPort | : FTP-Port, default: 21 |
| ftpPwd | : password of FTP-User, not set by default |
| ftpServer | : name or IP-address of FTP-server. absolutely essential ! |
| ftpTimeout | : timeout of FTP-connection in seconds (default: 30). |
| 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 |
| optimizeTablesBeforeDump | : table optimization before dump |
| 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 |
| 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'. |
+ attr <DbRep-Device> widgetOverride fetchMarkDuplicates:colorpicker
+
+ | 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 |
| 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'. |
| 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 |
| aggregation | : choose the aggregation period |
| device | : include or exclude <device> from selection |
| reading | : include or exclude <reading> from selection |
| readingNameMap | : rename the resulted readings |
| 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 | : choose the aggregation period |
| device | : include or exclude <device> from selection |
| reading | : include or exclude <reading> from selection |
| readingNameMap | : rename the resulted readings |
| 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'. |
| 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 |
| timestamp_end | : records older than this attribute will be reduced |
| timeDiffToNow | : records newer than this attribute will be reduced |
| timestamp_begin | : records newer than this attribute will be reduced |
| valueFilter | : an additional REGEXP to control the record selection. The REGEXP is applied to the database field 'VALUE'. |
| allowDeletion | : activates capabilty to delete datasets |
| sqlResultFormat | : determines presentation style of command result |
| sqlResultFieldSep | : choice of a useful field separator for result |
| sqlCmdHistoryLength | : activates command history and length |
| sqlResultFormat | : determines the formatting of the result |
| sqlResultFieldSep | : determines the used field separator in statement result |
| 50mostFreqLogsLast2days | : reports the 50 most occuring log entries of the last 2 days |
| allDevCount | : all devices occuring in database and their quantity |
| allDevReadCount | : all device/reading combinations occuring in database and their quantity |
| aggregation | : choose the aggregation period |
| device | : include or exclude <device> from selection |
| reading | : include or exclude <reading> from selection |
| readingNameMap | : rename the resulted readings |
| 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 | : adjustment of time slices for data transmission (hour,day,week) |
| device | : include or exclude <device> for transmission |
| 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'. |
+sub dbval($$) {
+ my ($name,$cmd) = @_;
+ my $ret = CommandGet(undef,"$name dbValue $cmd");
+return $ret;
+}
+
+ it can be accessed with e.g. those calls:
+ | avgArithmeticMean : | the arithmetic average is calculated (default) |
| avgDailyMeanGWS : | calculates the daily medium temperature according the
+ specifications of german weather service (pls. see "get <name> versionNotes 2"). + This variant uses aggregation "day" automatically. |
| avgTimeWeightMean : | calculates a time weighted average mean value is calculated |
attr <name> device TYPE=DbRep attr <name> device MySTP_5000 attr <name> device SMA.* attr <name> device SMA_Energymeter,MySTP_5000 attr <name> device %5000 attr <name> device TYPE=SSCam EXCLUDE=SDS1_SVS attr <name> device EXCLUDE=SDS1_SVS attr <name> device EXCLUDE=TYPE=SSCam
+sub adump {
+ my ($name) = @_;
+ my $hash = $defs{$name};
+ # own function, e.g.
+ Log3($name, 3, "DbRep $name -> Dump finished");
+
+ return;
+}
+
+
+sub bdump {
+ my ($name) = @_;
+ my $hash = $defs{$name};
+ # own function, e.g.
+ Log3($name, 3, "DbRep $name -> Dump starts now");
+
+ return;
+}
+
+| %L | : is replaced by the value of global logdir attribute |
| %TSB | : is replaced by the (calculated) value of the timestamp_begin attribute |
| Common used POSIX-wildcards are: | |
| %d | : day of month (01..31) |
| %m | : month (01..12) |
| %Y | : year (1970...) |
| %w | : day of week (0..6); 0 represents Sunday |
| %j | : day of year (001..366) |
| %U | : week number of year with Sunday as first day of week (00..53) |
| %W | : week number of year with Monday as first day of week (00..53) |
attr <name> expimpfile /sds1/backup/exptest_%TSB.csv attr <name> expimpfile /sds1/backup/exptest_%Y-%m-%d.csv attr <name> reading etotal attr <name> reading et% attr <name> reading etotal,etoday attr <name> reading etotal,etoday EXCLUDE=state attr <name> reading etotal,etoday EXCLUDE=Einspeisung% attr <name> seqDoubletsVariance 0.0014 attr <name> seqDoubletsVariance 1.45
+ sub resfromjson {
+ my ($name,$reading,$value) = @_;
+ my $hash = $defs{$name};
+
+ if ($reading eq "SqlResult") {
+ # only reading SqlResult contains JSON encoded data
+ my $data = decode_json($value);
+
+ foreach my $k (keys(%$data)) {
+
+ # use your own processing from here for every hash-element
+ # e.g. output of every element that contains "Cam"
+ my $ke = $data->{$k};
+ if($ke =~ m/Cam/i) {
+ my ($res1,$res2) = split("\\|", $ke);
+ Log3($name, 1, "$name - extract element $k by userExitFn: ".$res1." ".$res2);
+ }
+ }
+ }
+ return;
+ }
+
+ attr <name> timeDiffToNow 86400 attr <name> timeDiffToNow d:2 h:3 m:2 s:10 attr <name> timeDiffToNow m:600 attr <name> timeDiffToNow h:2.5 attr <name> timeDiffToNow y:1 h:2.5 attr <name> timeDiffToNow y:1.5 attr <name> timeOlderThan 86400 attr <name> timeOlderThan d:2 h:3 m:2 s:10 attr <name> timeOlderThan m:600 attr <name> timeOlderThan h:2.5 attr <name> timeOlderThan y:1 h:2.5 attr <name> timeOlderThan y:1.5
+ sub UserFunction {
+ my ($name,$reading,$value) = @_;
+ my $hash = $defs{$name};
+ ...
+ # e.g. output transfered data
+ Log3 $name, 1, "UserExitFn $name called - transfer parameter are Reading: $reading, Value: $value " ;
+ ...
+ return;
+ }
+
+ The interface activation takes place by setting the subroutine name into the attribute.
+ Optional you may set a Reading:Value combination (Regex) as argument. If no Regex is
+ specified, all value combinations will be evaluated as "true" (related to .*:.*).
+
+ define Rep.Agent DbRep LogDB
+ attr Rep.Agent devStateIcon connected:10px-kreis-gelb .*disconnect:10px-kreis-rot .*done:10px-kreis-gruen
+ attr Rep.Agent icon security
+ attr Rep.Agent role Agent
+ attr Rep.Agent room DbLog
+ attr Rep.Agent showproctime 1
+ attr Rep.Agent stateFormat { ReadingsVal("$name","state", undef) eq "running" ? "renaming" : ReadingsVal("$name","state", undef). " »; ProcTime: ".ReadingsVal("$name","sql_processing_time", undef)." sec"}
+ attr Rep.Agent timeout 86400
+
+ DbReadingsVal("<name>","<device:reading>","<timestamp>","<default>") | <name> | : Name des abzufragenden DbRep-Device |
| <device:reading> | : Device:Reading dessen Wert geliefert werden soll |
| <timestamp> | : Zeitpunkt des zu liefernden Readingwertes (*) in der Form "YYYY-MM-DD hh:mm:ss" |
| <default> | : Defaultwert falls kein Readingwert ermittelt werden konnte |
+ CREATE INDEX Report_Idx ON `history` (TIMESTAMP, READING) USING BTREE;
+
+
+ define <name> DbRep <Name der DbLog-Instanz>
+
+
+ | aggregation | : Auswahl einer Aggregationsperiode |
| averageCalcForm | : Auswahl der Berechnungsvariante für den Durchschnitt |
| device | : einschließen oder ausschließen von Datensätzen die <device> enthalten |
| 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 |
| valueFilter | : ein zusätzliches REGEXP um die Datenselektion zu steuern. Der REGEXP wird auf das Datenbankfeld 'VALUE' angewendet. |
| <old string> : | |
| <new string> : |
| device | : einschließen oder ausschließen von Datensätzen die <device> enthalten |
| 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 |
| valueFilter | : ein zusätzliches REGEXP um die Datenselektion zu steuern. Der REGEXP wird auf das Datenbankfeld 'VALUE' angewendet. |
| aggregation | : Zusammenfassung/Gruppierung von Zeitintervallen |
| countEntriesDetail | : detaillierte Ausgabe der Datensatzanzahl |
| 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.* | : eine Reihe von Attributen zur Zeitabgrenzung |
| readingNameMap | : die entstehenden Ergebnisreadings werden partiell umbenannt |
| valueFilter | : ein zusätzliches REGEXP um die Datenselektion zu steuern. Der REGEXP wird auf das Datenbankfeld 'VALUE' angewendet. |
| adviceDelete | : ermittelt die zu löschenden Datensätze (es wird nichts gelöscht !) |
| delete | : löscht die Dubletten |
| allowDeletion | : needs to be set to execute the delete option |
| aggregation | : Auswahl einer Aggregationsperiode |
| device | : einschließen oder ausschließen von Datensätzen die <device> enthalten |
| 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. |
| allowDeletion | : Freischaltung der Löschfunktion |
| device | : einschließen oder ausschließen von Datensätzen die <device> enthalten |
| 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 |
| valueFilter | : ein zusätzliches REGEXP um die Datenselektion zu steuern. Der REGEXP wird auf das Datenbankfeld 'VALUE' angewendet. |
| adviceRemain | : simuliert die nach der Operation in der DB verbleibenden Datensätze (es wird nichts gelöscht !) |
| adviceDelete | : simuliert die zu löschenden Datensätze (es wird nichts gelöscht !) |
| delete | : löscht die sequentiellen Dubletten (siehe Beispiel) |
| allowDeletion | : needs to be set to execute the delete option |
| aggregation | : Auswahl einer Aggregationsperiode |
| device | : einschließen oder ausschließen von Datensätzen die <device> enthalten |
| limit | : begrenzt NUR die Anzahl der anzuzeigenden Datensätze |
| reading | : einschließen oder ausschließen von Datensätzen die <reading> enthalten |
| 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 |
| valueFilter | : ein zusätzliches REGEXP um die Datenselektion zu steuern. Der REGEXP wird auf das Datenbankfeld 'VALUE' angewendet. |
| aggregation | : Auswahl einer Aggregationsperiode |
| device | : einschließen oder ausschließen von Datensätzen die <device> enthalten |
| 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 |
| valueFilter | : ein zusätzliches REGEXP um die Datenselektion zu steuern. Der REGEXP wird auf das Datenbankfeld 'VALUE' angewendet. |
| dumpComment | : User-Kommentar im Dumpfile |
| dumpCompress | : Komprimierung des Dumpfiles nach der Erstellung |
| dumpDirLocal | : das lokale Zielverzeichnis für die Erstellung des Dump |
| 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 |
| optimizeTablesBeforeDump | : Tabelloptimierung vor dem Dump ausführen |
| dumpDirRemote | : das Erstellungsverzeichnis des Dumpfile auf dem entfernten Server |
| 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 |
| optimizeTablesBeforeDump | : Tabelloptimierung vor dem Dump ausführen |
| ftpUse | : FTP Transfer nach dem Dump wird eingeschaltet (ohne SSL Verschlüsselung) |
| ftpUser | : User zur Anmeldung am FTP-Server, default: anonymous |
| ftpUseSSL | : FTP Transfer mit SSL Verschlüsselung nach dem Dump wird eingeschaltet |
| ftpDebug | : Debugging des FTP Verkehrs zur Fehlersuche |
| ftpDir | : Verzeichnis auf dem FTP-Server in welches das File übertragen werden soll (default: "/") |
| ftpDumpFilesKeep | : Es wird die angegebene Anzahl Dumpfiles im <ftpDir> belassen (default: 3) |
| ftpPassive | : setzen wenn passives FTP verwendet werden soll |
| ftpPort | : FTP-Port, default: 21 |
| ftpPwd | : Passwort des FTP-Users, default nicht gesetzt |
| ftpServer | : Name oder IP-Adresse des FTP-Servers. notwendig ! |
| ftpTimeout | : Timeout für die FTP-Verbindung in Sekunden (default: 30). |
| 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 |
| optimizeTablesBeforeDump | : Tabelloptimierung vor dem Dump ausführen |
| 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 |
| 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. |
+ attr <name> widgetOverride fetchMarkDuplicates:colorpicker
+
+ | 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 |
| 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. Der Regex wird auf Werte des DAtenbankfelder 'VALUE' angewendet. |
| 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 |
| aggregation | : Auswahl einer Aggregationsperiode |
| limit | : die Anzahl der ANZUZEIGENDEN Datensätz wird beschränkt |
| device | : einschließen oder ausschließen von Datensätzen die <device> enthalten |
| 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 |
| valueFilter | : ein zusätzliches REGEXP um die Datenselektion zu steuern. Der REGEXP wird auf das Datenbankfeld 'VALUE' angewendet. |
| aggregation | : Auswahl einer Aggregationsperiode |
| limit | : die Anzahl der ANZUZEIGENDEN Datensätz wird beschränkt |
| device | : einschließen oder ausschließen von Datensätzen die <device> enthalten |
| 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 |
| valueFilter | : ein zusätzliches REGEXP um die Datenselektion zu steuern. Der REGEXP wird auf das Datenbankfeld 'VALUE' angewendet. |
| 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 |
| timestamp_end | : es werden Datenbankeinträge älter als dieses Attribut reduziert |
| timeDiffToNow | : es werden Datenbankeinträge neuer als dieses Attribut reduziert |
| timestamp_begin | : es werden Datenbankeinträge neuer als dieses Attribut reduziert |
| valueFilter | : ein zusätzliches REGEXP um die Datenselektion zu steuern. Der REGEXP wird auf das Datenbankfeld 'VALUE' angewendet. |
| allowDeletion | : aktiviert Löschmöglichkeit |
| sqlResultFormat | : legt die Darstellung des Kommandoergebnis fest |
| sqlResultFieldSep | : Auswahl Feldtrenner im Ergebnis |
| sqlCmdHistoryLength | : Aktivierung Kommando-Historie und deren Umfang |
| sqlResultFormat | : Optionen der Ergebnisformatierung |
| sqlResultFieldSep | : Auswahl des Trennzeichens zwischen Ergebnisfeldern |
| 50mostFreqLogsLast2days | : ermittelt die 50 am häufigsten vorkommenden Loggingeinträge der letzten 2 Tage |
| allDevCount | : alle in der Datenbank vorkommenden Devices und deren Anzahl |
| allDevReadCount | : alle in der Datenbank vorkommenden Device/Reading-Kombinationen und deren Anzahl |
| aggregation | : Auswahl einer Aggregationsperiode |
| limit | : die Anzahl der ANZUZEIGENDEN Datensätz wird beschränkt |
| device | : einschließen oder ausschließen von Datensätzen die <device> enthalten |
| 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 |
| valueFilter | : ein zusätzliches REGEXP um die Datenselektion zu steuern. Der REGEXP wird auf das Datenbankfeld 'VALUE' angewendet. |
| aggregation | : Einstellung der Zeitscheiben zur Übertragung (hour,day,week) |
| 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. |
| valueFilter | : ein zusätzliches REGEXP um die Datenselektion zu steuern. Der REGEXP wird auf das Datenbankfeld 'VALUE' angewendet. |
+sub dbval($$) {
+ my ($name,$cmd) = @_;
+ my $ret = CommandGet(undef,"$name dbValue $cmd");
+return $ret;
+}
+
+ kann dbValue vereinfacht verwendet werden mit Aufrufen wie:
+ | avgArithmeticMean : | es wird der arithmetische Mittelwert berechnet (default) |
| avgDailyMeanGWS : | berechnet die Tagesmitteltemperatur entsprechend den
+ Vorschriften des deutschen Wetterdienstes (siehe "get <name> versionNotes 2"). + Diese Variante verwendet automatisch die Aggregation "day". |
| avgTimeWeightMean : | berechnet den zeitgewichteten Mittelwert |
attr <name> device TYPE=DbRep attr <name> device MySTP_5000 attr <name> device SMA.*,MySTP.* attr <name> device SMA_Energymeter,MySTP_5000 attr <name> device %5000 attr <name> device TYPE=SSCam EXCLUDE=SDS1_SVS attr <name> device EXCLUDE=SDS1_SVS attr <name> device EXCLUDE=TYPE=SSCam
+sub adump {
+ my ($name) = @_;
+ my $hash = $defs{$name};
+ # die eigene Funktion, z.B.
+ Log3($name, 3, "DbRep $name -> Dump ist beendet");
+
+ return;
+}
+
+
+sub bdump {
+ my ($name) = @_;
+ my $hash = $defs{$name};
+ # die eigene Funktion, z.B.
+ Log3($name, 3, "DbRep $name -> Dump startet");
+
+ return;
+}
+
+| %L | : wird ersetzt durch den Wert des global logdir Attributs |
| %TSB | : wird ersetzt durch den (berechneten) Wert des timestamp_begin Attributs |
| Allgemein gebräuchliche POSIX-Wildcards sind: | |
| %d | : Tag des Monats (01..31) |
| %m | : Monat (01..12) |
| %Y | : Jahr (1970...) |
| %w | : Wochentag (0..6); beginnend mit Sonntag (0) |
| %j | : Tag des Jahres (001..366) |
| %U | : Wochennummer des Jahres, wobei Wochenbeginn = Sonntag (00..53) |
| %W | : Wochennummer des Jahres, wobei Wochenbeginn = Montag (00..53) |
attr <name> expimpfile /sds1/backup/exptest_%TSB.csv attr <name> expimpfile /sds1/backup/exptest_%Y-%m-%d.csv attr <name> reading etotal attr <name> reading et% attr <name> reading etotal,etoday attr <name> reading etotal,etoday EXCLUDE=state attr <name> reading etotal,etoday EXCLUDE=Einspeisung% attr <name> seqDoubletsVariance 0.0014 attr <name> seqDoubletsVariance 1.45
+ sub resfromjson {
+ my ($name,$reading,$value) = @_;
+ my $hash = $defs{$name};
+
+ if ($reading eq "SqlResult") {
+ # nur Reading SqlResult enthält JSON-kodierte Daten
+ my $data = decode_json($value);
+
+ foreach my $k (keys(%$data)) {
+
+ # ab hier eigene Verarbeitung für jedes Hash-Element
+ # z.B. Ausgabe jedes Element welches "Cam" enthält
+ my $ke = $data->{$k};
+ if($ke =~ m/Cam/i) {
+ my ($res1,$res2) = split("\\|", $ke);
+ Log3($name, 1, "$name - extract element $k by userExitFn: ".$res1." ".$res2);
+ }
+ }
+ }
+ return;
+ }
+
+
+ attr <name> timeDiffToNow 86400 attr <name> timeDiffToNow d:2 h:3 m:2 s:10 attr <name> timeDiffToNow m:600 attr <name> timeDiffToNow h:2.5 attr <name> timeDiffToNow y:1 h:2.5 attr <name> timeDiffToNow y:1.5 attr <name> timeOlderThan 86400 attr <name> timeOlderThan d:2 h:3 m:2 s:10 attr <name> timeOlderThan m:600 attr <name> timeOlderThan h:2.5 attr <name> timeOlderThan y:1 h:2.5 attr <name> timeOlderThan y:1.5
+ sub UserFunction {
+ my ($name,$reading,$value) = @_;
+ my $hash = $defs{$name};
+ ...
+ # z.B. übergebene Daten loggen
+ Log3 $name, 1, "UserExitFn $name called - transfer parameter are Reading: $reading, Value: $value " ;
+ ...
+ return;
+ }
+
+
+ Die Aktivierung der Schnittstelle erfogt durch Setzen des Funktionsnamens im Attribut.
+ Optional kann ein Reading:Value Regex als Argument angegeben werden. Wird kein Regex
+ angegeben, werden alle Wertekombinationen als "wahr" gewertet (entspricht .*:.*).
+
+ define Rep.Agent DbRep LogDB
+ attr Rep.Agent devStateIcon connected:10px-kreis-gelb .*disconnect:10px-kreis-rot .*done:10px-kreis-gruen
+ attr Rep.Agent icon security
+ attr Rep.Agent role Agent
+ attr Rep.Agent room DbLog
+ attr Rep.Agent showproctime 1
+ attr Rep.Agent stateFormat { ReadingsVal("$name","state", undef) eq "running" ? "renaming" : ReadingsVal("$name","state", undef). " »; ProcTime: ".ReadingsVal("$name","sql_processing_time", undef)." sec"}
+ attr Rep.Agent timeout 86400
+
+