$svgimg | }; $class .= qq{
$filicon | }; $ret .= qq{$chkicon | }; $ret .= qq{$fthicon | }; $ret .= qq{
DBI
and DBD::<dbtype>
are needed to be installed (use cpan -i <module>
if your distribution does not have it).
DBI | : sudo apt-get install libdbi-perl |
MySQL | : sudo apt-get install [mysql-server] mysql-client libdbd-mysql libdbd-mysql-perl (mysql-server only for local MySQL Server installation) |
MariaDB | : sudo apt-get install [mariadb-server] mariadb-client libdbd-mariadb-perl (mariadb-server only for local MariaDB Server installation) |
SQLite | : sudo apt-get install sqlite3 libdbi-perl libdbd-sqlite3-perl |
PostgreSQL | : sudo apt-get install libdbd-pg-perl |
CREATE DATABASE `fhem` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;
current
and history
. current
and history
.
TIMESTAMP | : timestamp of event, e.g. 2007-12-30 21:45:22 |
DEVICE | : device name, e.g. Wetterstation |
TYPE | : device type, e.g. KS300 |
EVENT | : event specification as full string, e.g. humidity: 71 (%) |
READING | : name of reading extracted from event, e.g. humidity |
VALUE | : actual reading extracted from event, e.g. 71 |
UNIT | : unit extracted from event, e.g. % |
MySQL | : CREATE INDEX Search_Idx ON `fhem`.`history` (DEVICE, READING, TIMESTAMP); |
MariaDB | : CREATE INDEX Search_Idx ON `fhem`.`history` (DEVICE, READING, TIMESTAMP); |
SQLite | : CREATE INDEX Search_Idx ON `history` (DEVICE, READING, TIMESTAMP); |
PostgreSQL | : CREATE INDEX "Search_Idx" ON history USING btree (device, reading, "timestamp"); |
#################################################################################### # database configuration file # # NOTE: # If you don't use a value for user / password please delete the leading hash mark # and write 'user => ""' respectively 'password => ""' instead ! # # ## for MySQL #################################################################################### #%dbconfig= ( # connection => "mysql:database=fhem;host=<database host>;port=3306", # # if want communication over socket-file instead of TCP/IP transport, use: # # connection => "mysql:database=fhem;mysql_socket=</path/socket-file>", # user => "fhemuser", # password => "fhempassword", # # optional enable UTF-8 support # # (full UTF-8 support exists from DBD::mysql version 4.032, but installing # # 4.042 is highly suggested) # utf8 => 1, # # optional enable communication compression between client and server # compression => 1 #); #################################################################################### # ## for MariaDB #################################################################################### #%dbconfig= ( # connection => "MariaDB:database=fhem;host=<database host>;port=3306", # # if want communication over socket-file instead of TCP/IP transport, use: # # connection => "MariaDB:database=fhem;mariadb_socket=</path/socket-file>", # user => "fhemuser", # password => "fhempassword", # # optional enable communication compression between client and server # compression => 1 #); #################################################################################### # ## for PostgreSQL #################################################################################### #%dbconfig= ( # connection => "Pg:database=fhem;host=<database host>", # user => "fhemuser", # password => "fhempassword" #); #################################################################################### # ## for SQLite (username and password stay empty for SQLite) #################################################################################### #%dbconfig= ( # connection => "SQLite:dbname=/opt/fhem/fhem.db", # user => "", # password => "" #); ####################################################################################If configDB is used, the configuration file has to be uploaded into the configDB!
FRAME_INITIALIZED | - The basic framework is initialised. Blocking (Get) commands can be executed. |
SUBPROC_INITIALIZED | - The SupProcess is ready for use. Non-blocking (set) commands and Data logging can be executed. |
SUBPROC_DISCONNECTED | - The SupProcess was separated from the DB. |
SUBPROC_STOPPED | - The SupProcess has been stopped. |
<configfilename>
is the prepared configuration file. <regexp>
is identical to the specification of regex in the FileLog definition.
define myDbLog DbLog /etc/fhem/db.conf .*:.*
get <name> configCheck
yes
is translated
to 1
get myDbLog - - 2012-11-10 2012-11-10 KS300:temperature::
<devspec>:<Reading> | The device can be specified as device specification. |
The specification of "Reading" is evaluated as a regular expression. | |
If the reading does not exist and the value "Value" is specified, the reading | |
will be inserted into the DB if it is not a regular expression and a valid reading name. | |
Value | Optionally, "Value" can be specified for the reading value. |
If Value is not specified, the current value of the reading is inserted into the DB. | |
CN=<caller name> | With the key "CN=" (Caller Name) a string, e.g. the name of the calling device, |
can be added to the addLog call. | |
With the help of the function stored in the attribute valueFn | |
this key can be evaluated via the variable $CN. | |
!useExcludes | addLog by default takes into account the readings excluded with the "DbLogExclude" attribute. |
With the keyword "!useExcludes" the set attribute "DbLogExclude" is ignored. |
alldevices | Determines all devices stored in the database. |
allreadings | Determines all readings stored in the database for a specific device. |
required parameters: <device> | |
count | Returns the number of records of the specified table. |
required parameters: <table> (history or current) | |
fetchrows | Determines the stored records of a certain period. |
The number of records in the defined period is returned as the "totalcount" key. | |
required parameters: <from>, <to>, <offset>, <limit> | |
last | Lists the last 10 saved events. |
possible parameters: <limit> (overwrites the default 10) | |
timerange | Determines the stored data sets of the specified Device / Reading combination. |
required parameters: <device>, <reading>, <from>, <to> | |
hourstats | Calculates the statistics SUM, AVG, MIN, MAX, COUNT for one hour. |
required parameters: <device>, <reading>, <from>, <to> | |
daystats | Calculates the statistics SUM, AVG, MIN, MAX, COUNT for one day. |
required parameters: <device>, <reading>, <from>, <to> | |
weekstats | Calculates the statistics SUM, AVG, MIN, MAX, COUNT for one week. |
required parameters: <device>, <reading>, <from>, <to> | |
monthstats | Calculates the statistics SUM, AVG, MIN, MAX, COUNT for one month. |
required parameters: <device>, <reading>, <from>, <to> | |
yearstats | Calculates the statistics SUM, AVG, MIN, MAX, COUNT for one year. |
required parameters: <device>, <reading>, <from>, <to> |
get LogSQLITE3 retrieve alldevices
get LogSQLITE3 retrieve allreadings MySTP_5000
get LogSQLITE3 retrieve last "" "" "" "" "" 50
get LogSQLITE3 retrieve count history
get LogSQLITE3 retrieve timerange MySTP_5000 etotal 2023-01-01_00:00:00 2023-01-25_00:00:00
get LogSQLITE3 retrieve fetchrows MySTP_5000 "" 2023-01-01_00:00:00 2023-01-25_00:00:00 0 100
get LogSQLITE3 retrieve fetchrows "" etotal 2023-01-01_00:00:00 2023-01-25_00:00:00 0 100
get LogSQLITE3 retrieve hourstats MySTP_5000 etotal 2023-01-01_00:00:00 2023-01-25_00:00:00
-
to check the output for plot-computing.all
to get all columns from Database.
YYYY-MM-DD_HH24:MI:SS
get myDbLog - - 2012-11-10 2012-11-20 KS300:temperature
get myDbLog current ALL - - %:temperature
get myDbLog - - 2012-11-10_10 2012-11-10_20 KS300:temperature::int1
get myDbLog - all 2012-11-10 2012-11-20 KS300:temperature
get myDbLog - - 2012-11-10 2012-11-20 KS300:temperature KS300:rain::delta-h KS300:rain::delta-d
get myDbLog - - 2012-11-10 2012-11-20 MyFS20:data:::$val=~s/(on|off).*/$1eq"on"?1:0/eg
get myDbLog - - 2012-11-10 2012-11-20 Bodenfeuchte:data:::$val=~s/.*B:\s([-\.\d]+).*/$1/eg
"A: 49.527 % B: 66.647 % C: 9.797 % D: 0.097 V"
2012-11-20_10:23:54 66.647
get DbLog - - 2013-05-26 2013-05-28 Pumpe:data::delta-ts:$val=~s/on/hide/
-
webchart
.
YYYY-MM-DD_HH24:MI:SS
getreadings
to retrieve the possible readings for a given devicegetdevices
to retrieve all available devicestimerange
to retrieve charting data, which requires a given xaxis, yaxis, device, to and fromsavechart
to save a chart configuration in the database. Requires a given xaxis, yaxis, device, to and from, and a 'savename' used to save the chartdeletechart
to delete a saved chart. Requires a given id which was set on save of the chartgetcharts
to get a list of all saved charts.getTableData
to get jsonformatted data from the database. Uses paging Parameters like start and limit.hourstats
to get statistics for a given value (yaxis) for an hour.daystats
to get statistics for a given value (yaxis) for a day.weekstats
to get statistics for a given value (yaxis) for a week.monthstats
to get statistics for a given value (yaxis) for a month.yearstats
to get statistics for a given value (yaxis) for a year.get logdb - webchart "" "" "" getcharts
get logdb - webchart "" "" "" getdevices
get logdb - webchart "" "" ESA2000_LED_011e getreadings
get logdb - webchart 2013-02-11_00:00:00 2013-02-12_00:00:00 ESA2000_LED_011e timerange TIMESTAMP day_kwh
[{'TIMESTAMP':'2013-02-11 00:10:10','VALUE':'0.22431388090756'},{'TIMESTAMP'.....}]
get logdb - webchart 2013-02-11_00:00:00 2013-02-12_00:00:00 ESA2000_LED_011e savechart TIMESTAMP day_kwh tageskwh
get logdb - webchart "" "" "" deletechart "" "" 7
0 - | Synchronous log mode. The data to be logged is only briefly cached and immediately |
written to the database. (default) | |
Advantages: | |
In principle, the data is immediately available in the database. | |
Very little to no data is lost when FHEM crashes. | |
Disadvantages: | |
An alternative storage in the file system (in case of database problems) is not supported. | |
1 - | Asynchroner Log-Modus. The data to be logged is first cached in a memory cache and written to the database |
depending on a time interval or fill level of the cache. | |
Advantages: | |
The data is cached and will not be lost if the database is unavailable or malfunctions. | |
The alternative storage of data in the file system is supported. | |
Disadvantages: | |
The data is available in the database with a time delay. | |
If FHEM crashes, all data cached in the memory will be lost. |
0 - | No events are generated for CacheUsage. |
1 - | Events are generated for the Reading CacheUsage when a new record is added to the cache. |
2 - | Events are generated for the Reading CacheUsage when the write cycle to the database starts in |
asynchronous mode. CacheUsage contains the number of records in the cache at this time. |
Current | Events are only logged into the current-table. The entries of current-table will evaluated with SVG-creation. |
History | Events are only logged into the history-table. No dropdown list with proposals will created with the SVG-creation. |
Current/History | Events will be logged both the current- and the history-table. The entries of current-table will evaluated with SVG-creation. |
SampleFill/History | Events are only logged into the history-table. The entries of current-table will evaluated with SVG-creation and can be filled up with a customizable extract of the history-table by using a DbRep-device command "set <DbRep-name> tableCurrentFillup" (advanced feature). |
| Modifier | within interval | outside interval | | | Value equal | Value changed | | |----------+--------------------+-----------------+------------------| | <none> | ignore | store | store | | force | ignore | ignore | store |
attr MyDevice1 DbLogInclude .*
attr MyDevice2 DbLogInclude state,(floorplantext|MyUserReading):300,battery:3600
attr MyDevice2 DbLogInclude state,(floorplantext|MyUserReading):300:force,battery:3600:force
| Modifier | within interval | outside interval | | | Value equal | Value changed | | |----------+--------------------+-----------------+------------------| | <none> | ignore | store | store | | force | ignore | ignore | store |
attr MyDevice1 DbLogExclude .*
attr MyDevice2 DbLogExclude state,(floorplantext|MyUserReading):300,battery:3600
attr MyDevice2 DbLogExclude state,(floorplantext|MyUserReading):300:force,battery:3600:force
attr SMA_Energymeter DbLogValueFn { if ($READING eq "Bezug_WirkP_Kosten_Diff") { $UNIT="Diff-W"; } if ($READING =~ /Einspeisung_Wirkleistung_Zaehler/ && $VALUE < 2) { $IGNORE=1; } }
attr dblog defaultMinInterval .*::120::force
attr dblog defaultMinInterval (Weather|SMA)::300
attr dblog defaultMinInterval TYPE=CUL_HM::600::force
attr <device> excludeDevs global,Log.*,Cam.*,TYPE=DbLog
attr <device> excludeDevs .*#.*Wirkleistung.*
attr <device> excludeDevs SMA_Energymeter#Bezug_WirkP_Zaehler_Diff
attr <device> expimpdir /opt/fhem/cache/
0 - | The data is passed as an array to the database interface. (default) |
It is in most cases the most performant way to insert a lot of data into the database at once. | |
1 - | The records are passed sequentially to the database interface and inserted into the DB. |
ALL | turn on all DBI and driver flags |
SQL | trace SQL statements executed (Default) |
CON | trace connection process |
ENC | trace encoding (unicode translations etc) |
DBD | trace only DBD messages |
TXN | trace transactions |
0 | Trace disabled. (Default) |
1 | Trace top-level DBI method calls returning with results or errors. |
2 | As above, adding tracing of top-level method entry with parameters. |
3 | As above, adding some high-level information from the driver and some internal information from the DBI. |
4 | As above, adding more detailed information from the driver. |
5-7 | As above but with more and more internal information. |
attr <device> valueFn {if ($DEVICE eq "living_Clima" && $VALUE eq "off" ){$VALUE=0;} elsif ($DEVICE eq "e-power"){$VALUE= sprintf "%.1f", $VALUE;}}
attr <device> valueFn {if ($DEVICE eq "SMA_Energymeter" && $READING eq "state"){$IGNORE=1;}}
attr <device> valueFn {if ($DEVICE eq "Dum.Energy" && $READING eq "TotalConsumption"){$UNIT="W";}}
attr <device> verbose4Devs sys.*,.*5000.*,Cam.*,global
DBI
und DBD::<dbtype>
müssen installiert werden (use cpan -i <module>
falls die eigene Distribution diese nicht schon mitbringt).
DBI | : sudo apt-get install libdbi-perl |
MySQL | : sudo apt-get install [mysql-server] mysql-client libdbd-mysql libdbd-mysql-perl (mysql-server nur bei lokaler MySQL Server Installation) |
MariaDB | : sudo apt-get install [mariadb-server] mariadb-client libdbd-mariadb-perl (mariadb-server nur bei lokaler MariaDB Server Installation) |
SQLite | : sudo apt-get install sqlite3 libdbi-perl libdbd-sqlite3-perl |
PostgreSQL | : sudo apt-get install libdbd-pg-perl |
CREATE DATABASE `fhem` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;
current
und history
. current
enthält den letzten Stand pro Device und Reading. history
sind alle Events historisch gespeichert. current
und history
festzulegen.
TIMESTAMP | : Zeitpunkt des Events, z.B. 2007-12-30 21:45:22 |
DEVICE | : Name des Devices, z.B. Wetterstation |
TYPE | : Type des Devices, z.B. KS300 |
EVENT | : das auftretende Event als volle Zeichenkette, z.B. humidity: 71 (%) |
READING | : Name des Readings, ermittelt aus dem Event, z.B. humidity |
VALUE | : aktueller Wert des Readings, ermittelt aus dem Event, z.B. 71 |
UNIT | : Einheit, ermittelt aus dem Event, z.B. % |
MySQL | : CREATE INDEX Search_Idx ON `fhem`.`history` (DEVICE, READING, TIMESTAMP); |
MariaDB | : CREATE INDEX Search_Idx ON `fhem`.`history` (DEVICE, READING, TIMESTAMP); |
SQLite | : CREATE INDEX Search_Idx ON `history` (DEVICE, READING, TIMESTAMP); |
PostgreSQL | : CREATE INDEX "Search_Idx" ON history USING btree (device, reading, "timestamp"); |
#################################################################################### # database configuration file # # NOTE: # If you don't use a value for user / password please delete the leading hash mark # and write 'user => ""' respectively 'password => ""' instead ! # # ## for MySQL #################################################################################### #%dbconfig= ( # connection => "mysql:database=fhem;host=<database host>;port=3306", # # if want communication over socket-file instead of TCP/IP transport, use: # # connection => "mysql:database=fhem;mysql_socket=</path/socket-file>", # user => "fhemuser", # password => "fhempassword", # # optional enable UTF-8 support # # (full UTF-8 support exists from DBD::mysql version 4.032, but installing version 4.042 is highly suggested) # utf8 => 1, # # optional enable communication compression between client and server # compression => 1 #); #################################################################################### # ## for MariaDB #################################################################################### #%dbconfig= ( # connection => "MariaDB:database=fhem;host=<database host>;port=3306", # # if want communication over socket-file instead of TCP/IP transport, use: # # connection => "MariaDB:database=fhem;mariadb_socket=</path/socket-file>", # user => "fhemuser", # password => "fhempassword", # # optional enable communication compression between client and server # compression => 1 #); #################################################################################### # ## for PostgreSQL #################################################################################### #%dbconfig= ( # connection => "Pg:database=fhem;host=<database host>", # user => "fhemuser", # password => "fhempassword" #); #################################################################################### # ## for SQLite (username and password stay empty for SQLite) #################################################################################### #%dbconfig= ( # connection => "SQLite:dbname=/opt/fhem/fhem.db", # user => "", # password => "" #); ####################################################################################Wird configDB genutzt, ist das Konfigurationsfile in die configDB hochzuladen!
FRAME_INITIALIZED | - Das grundlegende Rahmenwerk ist initialisiert. Blockierend arbeitende (Get)-Kommandos können ausgeführt werden. |
SUBPROC_INITIALIZED | - Der SupProcess ist einsatzbereit. Nichtblockierend arbeitende (Set)-Kommandos und Daten Logging können ausgeführt werden. |
SUBPROC_DISCONNECTED | - Der SupProcess wurde von der DB getrennt. |
SUBPROC_STOPPED | - Der SupProcess wurde gestoppt. |
define <name> DbLog <configfilename> <regexp>
<configfilename>
ist die vorbereitete Konfigurationsdatei. <regexp>
ist identisch FileLog der Filelog-Definition.
define myDbLog DbLog /etc/fhem/db.conf .*:.*
get <name> configCheck
yes
wird
transformiert nach 1
. get myDbLog - - 2012-11-10 2012-11-10 KS300:temperature
<devspec>:<Reading> | Das Device kann als Geräte-Spezifikation angegeben werden. |
Die Angabe von "Reading" wird als regulärer Ausdruck ausgewertet. | |
Ist das Reading nicht vorhanden und der Wert "Value" angegeben, wird das Reading | |
in die DB eingefügt wenn es kein regulärer Ausdruck und ein valider Readingname ist. | |
Value | Optional kann "Value" für den Readingwert angegeben werden. |
Ist Value nicht angegeben, wird der aktuelle Wert des Readings in die DB eingefügt. | |
CN=<caller name> | Mit dem Schlüssel "CN=" (Caller Name) kann dem addLog-Aufruf ein String, |
z.B. der Name des aufrufenden Devices, mitgegeben werden. | |
Mit Hilfe der im Attribut valueFn hinterlegten Funktion kann | |
dieser Schlüssel über die Variable $CN ausgewertet werden. | |
!useExcludes | addLog berücksichtigt per default die mit dem Attribut "DbLogExclude" ausgeschlossenen Readings. |
Mit dem Schüsselwort "!useExcludes" wird das gesetzte Attribut "DbLogExclude" ignoriert. |
alldevices | Ermittelt alle in der Datenbank gespeicherten Devices. |
allreadings | Ermittelt alle in der Datenbank gespeicherten Readings für ein bestimmtes Device. |
benötigte Parameter: <device> | |
count | Liefert die Anzahl Datensätze der angegebenen Tabelle. |
benötigte Parameter: <table> (history oder current) | |
fetchrows | Ermittelt die gespeicherten Datensätze eines bestimmten Zeitraumes. |
Die Anzahl der Datensätze im definierten Zeitraum wird als Schlüssel "totalcount" zurückgegeben. | |
benötigte Parameter: <from>, <to>, <offset>, <limit> | |
last | Listet die letzten 10 gespeicherten Events auf. |
mögliche Parameter: <limit> (überschreibt den Standard 10) | |
timerange | Ermittelt die gespeicherten Datensätze der angegebenen Device / Reading Kombination. |
benötigte Parameter: <device>, <reading>, <from>, <to> | |
hourstats | Errechnet die Statistiken SUM, AVG, MIN, MAX, COUNT für eine Stunde. |
benötigte Parameter: <device>, <reading>, <from>, <to> | |
daystats | Errechnet die Statistiken SUM, AVG, MIN, MAX, COUNT für einen Tag. |
benötigte Parameter: <device>, <reading>, <from>, <to> | |
weekstats | Errechnet die Statistiken SUM, AVG, MIN, MAX, COUNT für eine Woche. |
benötigte Parameter: <device>, <reading>, <from>, <to> | |
monthstats | Errechnet die Statistiken SUM, AVG, MIN, MAX, COUNT für einen Monat. |
benötigte Parameter: <device>, <reading>, <from>, <to> | |
yearstats | Errechnet die Statistiken SUM, AVG, MIN, MAX, COUNT für ein Jahr. |
benötigte Parameter: <device>, <reading>, <from>, <to> |
get LogSQLITE3 retrieve alldevices
get LogSQLITE3 retrieve allreadings MySTP_5000
get LogSQLITE3 retrieve last "" "" "" "" "" 50
get LogSQLITE3 retrieve count history
get LogSQLITE3 retrieve timerange MySTP_5000 etotal 2023-01-01_00:00:00 2023-01-25_00:00:00
get LogSQLITE3 retrieve fetchrows MySTP_5000 "" 2023-01-01_00:00:00 2023-01-25_00:00:00 0 100
get LogSQLITE3 retrieve fetchrows "" etotal 2023-01-01_00:00:00 2023-01-25_00:00:00 0 100
get LogSQLITE3 retrieve hourstats MySTP_5000 etotal 2023-01-01_00:00:00 2023-01-25_00:00:00
-
zu setzen um die
Ermittlung der Daten aus der Datenbank für die Plotgenerierung zu prüfen.YYYY-MM-DD_HH24:MI:SS
get myDbLog - - 2012-11-10 2012-11-20 KS300:temperature
get myDbLog current ALL - - %:temperature
get myDbLog - - 2012-11-10_10 2012-11-10_20 KS300:temperature::int1
get myDbLog - all 2012-11-10 2012-11-20 KS300:temperature
get myDbLog - - 2012-11-10 2012-11-20 KS300:temperature KS300:rain::delta-h KS300:rain::delta-d
get myDbLog - - 2012-11-10 2012-11-20 MyFS20:data:::$val=~s/(on|off).*/$1eq"on"?1:0/eg
get myDbLog - - 2012-11-10 2012-11-20 Bodenfeuchte:data:::$val=~s/.*B:\s([-\.\d]+).*/$1/eg
"A: 49.527 % B: 66.647 % C: 9.797 % D: 0.097 V"
2012-11-20_10:23:54 66.647
get DbLog - - 2013-05-26 2013-05-28 Pumpe:data::delta-ts:$val=~s/on/hide/
-
zu setzen.
webchart
zu setzen.
YYYY-MM-DD_HH24:MI:SS
getreadings
um für ein bestimmtes device alle Readings zu erhaltengetdevices
um alle verfügbaren devices zu erhaltentimerange
um Chart-Daten abzufragen. Es werden die Parameter 'xaxis', 'yaxis', 'device', 'to' und 'from' benötigtsavechart
um einen Chart unter Angabe eines 'savename' und seiner zugehörigen Konfiguration abzuspeicherndeletechart
um einen zuvor gespeicherten Chart unter Angabe einer id zu löschengetcharts
um eine Liste aller gespeicherten Charts zu bekommen.getTableData
um Daten aus der Datenbank abzufragen und in einer Tabelle darzustellen. Benötigt paging Parameter wie start und limit.hourstats
um Statistiken für einen Wert (yaxis) für eine Stunde abzufragen.daystats
um Statistiken für einen Wert (yaxis) für einen Tag abzufragen.weekstats
um Statistiken für einen Wert (yaxis) für eine Woche abzufragen.monthstats
um Statistiken für einen Wert (yaxis) für einen Monat abzufragen.yearstats
um Statistiken für einen Wert (yaxis) für ein Jahr abzufragen.get logdb - webchart "" "" "" getcharts
get logdb - webchart "" "" "" getdevices
get logdb - webchart "" "" ESA2000_LED_011e getreadings
get logdb - webchart 2013-02-11_00:00:00 2013-02-12_00:00:00 ESA2000_LED_011e timerange TIMESTAMP day_kwh
[{'TIMESTAMP':'2013-02-11 00:10:10','VALUE':'0.22431388090756'},{'TIMESTAMP'.....}]
get logdb - webchart 2013-02-11_00:00:00 2013-02-12_00:00:00 ESA2000_LED_011e savechart TIMESTAMP day_kwh tageskwh
get logdb - webchart "" "" "" deletechart "" "" 7
0 - | Synchroner Log-Modus. Die zu loggenden Daten werden nur kurz im Cache zwischengespeichert und sofort |
in die Datenbank geschrieben. (default) | |
Vorteile: | |
Die Daten stehen im Prinzip sofort in der Datenbank zur Verfügung. | |
Bei einem Absturz von FHEM gehen sehr wenige bis keine Daten verloren. | |
Nachteile: | |
Eine alternative Speicherung im Filesystem (bei Datenbankproblemen) wird nicht unterstützt. | |
1 - | Asynchroner Log-Modus. Die zu loggenden Daten werden zunächst in einem Memory Cache zwischengespeichert |
und abhängig von einem Zeitintervall bzw. Füllgrad des Caches in die Datenbank geschrieben. | |
Vorteile: | |
Die Daten werden zwischengespeichert und gehen nicht verloren wenn die Datenbank nicht verfügbar ist | |
oder fehlerhaft arbeitet. Die alternative Speicherung im Filesystem wird unterstützt. | |
Nachteile: | |
Die Daten stehen zeitlich verzögert in der Datenbank zur Verfügung. | |
Bei einem Absturz von FHEM gehen alle im Memory Cache zwischengespeicherten Daten verloren. |
0 - | Es werden keine Events für CacheUsage erzeugt. |
1 - | Es werden Events für das Reading CacheUsage erzeugt wenn ein neuer Datensatz zum Cache hinzugefügt wurde. |
2 - | Es werden Events für das Reading CacheUsage erzeugt wenn im asynchronen Mode der Schreibzyklus in die |
Datenbank beginnt. CacheUsage enthält zu diesem Zeitpunkt die Anzahl der im Cache befindlichen | |
Datensätze. |
Current | Events werden nur in die current-Tabelle geloggt. Die current-Tabelle wird bei der SVG-Erstellung ausgewertet. |
History | Events werden nur in die history-Tabelle geloggt. Es wird keine DropDown-Liste mit Vorschlägen bei der SVG-Erstellung erzeugt. |
Current/History | Events werden sowohl in die current- also auch in die hitory Tabelle geloggt. Die current-Tabelle wird bei der SVG-Erstellung ausgewertet. |
SampleFill/History | Events werden nur in die history-Tabelle geloggt. Die current-Tabelle wird bei der SVG-Erstellung ausgewertet und
kann zur Erzeugung einer DropDown-Liste mittels einem
DbRep-Device "set <DbRep-Name> tableCurrentFillup" mit einem einstellbaren Extract der history-Tabelle gefüllt werden (advanced Feature). |
| Modifier | innerhalb Intervall | außerhalb Intervall | | | Wert gleich | Wert geändert | | |----------+--------------------+-----------------+---------------------| | <none> | ignorieren | speichern | speichern | | force | ignorieren | ignorieren | speichern |
attr MyDevice1 DbLogInclude .*
attr MyDevice2 DbLogInclude state,(floorplantext|MyUserReading):300,battery:3600
attr MyDevice2 DbLogInclude state,(floorplantext|MyUserReading):300:force,battery:3600:force
| Modifier | innerhalb Intervall | außerhalb Intervall | | | Wert gleich | Wert geändert | | |----------+--------------------+-----------------+---------------------| | <none> | ignorieren | speichern | speichern | | force | ignorieren | ignorieren | speichern |
attr MyDevice1 DbLogExclude .*
attr MyDevice2 DbLogExclude state,(floorplantext|MyUserReading):300,battery:3600
attr MyDevice2 DbLogExclude state,(floorplantext|MyUserReading):300:force,battery:3600:force
attr SMA_Energymeter DbLogValueFn { if ($READING eq "Bezug_WirkP_Kosten_Diff") { $UNIT="Diff-W"; } if ($READING =~ /Einspeisung_Wirkleistung_Zaehler/ && $VALUE < 2) { $IGNORE=1; } }
attr dblog defaultMinInterval .*::120::force
attr dblog defaultMinInterval (Weather|SMA)::300
attr dblog defaultMinInterval TYPE=CUL_HM::600::force
attr <device> excludeDevs global,Log.*,Cam.*,TYPE=DbLog
attr <device> excludeDevs .*#.*Wirkleistung.*
attr <device> excludeDevs SMA_Energymeter#Bezug_WirkP_Zaehler_Diff
attr <device> expimpdir /opt/fhem/cache/
0 - | Die Daten werden als Array der Datenbankschnittstelle übergeben. (default) |
Es ist in den meisten Fällen der performanteste Weg viele Daten auf einmal in die Datenbank einzufügen. | |
1 - | Die Datensätze werden sequentiell der Datenbankschnittstelle übergeben und in die DB eingefügt. |
ALL | schaltet alle DBI- und Treiberflags an. |
SQL | verfolgt die SQL Statement Ausführung. (Default) |
CON | verfolgt den Verbindungsprozess. |
ENC | verfolgt die Kodierung (Unicode Übersetzung etc). |
DBD | verfolgt nur DBD Nachrichten. |
TXN | verfolgt Transaktionen. |
0 | Tracing ist disabled. (Default) |
1 | Tracing von DBI Top-Level Methoden mit deren Ergebnissen und Fehlern |
2 | Wie oben. Zusätzlich Top-Level Methodeneintäge mit Parametern. |
3 | Wie oben. Zusätzliche werden einige High-Level Informationen des Treibers und einige interne Informationen des DBI hinzugefügt. |
4 | Wie oben. Zusätzlich werden mehr detaillierte Informationen des Treibers eingefügt. |
5-7 | Wie oben, aber mit mehr und mehr internen Informationen. |
attr <device> valueFn {if ($DEVICE eq "living_Clima" && $VALUE eq "off" ){$VALUE=0;} elsif ($DEVICE eq "e-power"){$VALUE= sprintf "%.1f", $VALUE;}}
attr <device> valueFn {if ($DEVICE eq "SMA_Energymeter" && $READING eq "state"){$IGNORE=1;}}
attr <device> valueFn {if ($DEVICE eq "Dum.Energy" && $READING eq "TotalConsumption"){$UNIT="W";}}
attr <device> verbose4Devs sys.*,.*5000.*,Cam.*,global