FHEM Forum

FHEM => Anfängerfragen => Thema gestartet von: ChrisW am 21 Januar 2019, 17:16:58

Titel: Hilfe DBlog nur spezielle Geräte ?
Beitrag von: ChrisW am 21 Januar 2019, 17:16:58
Hallo,
ich möchte für spezielle Geräte meine Daten in mysql speichern.
Aktuell habe ich zum test folgendes def /opt/fhem/db.conf .*:(temperature|valveposition|humidity).*

Schön wäre wenn ich in dem Gerät z.b hausstrom unter attr da dblog 1 oder so reintrage und das Gerät wird geloggt.
Geht so etwas ? Beim "Auschließen" scheint das ja zu klappen aber meine ganzen Geräte erst alle ausschließen ??
Titel: Antw:Hilfe DBlog nur spezielle Geräte ?
Beitrag von: sledge am 21 Januar 2019, 17:34:38
Man kann jetzt betateilchens Empfehlung / Ansatz folgen...

Ich habe es für mich so gelöst:

1. DbLogSelectionMode = Include
2. Bewusst bei jedem Device, welches ich loggen möchte, via attr <device>DbLogInclude battery,temperature,dewpoint,humidity hinzugefügt (you get the picture).

Ist vielleicht nicht ganz das, was Du möchtest. Aber geht in die Richtung, gehört zum Standard und erfüllt die Aufgabe.

Im Gegensatz zu betateilchen habe ich diese Einstellung lieber bei meinen Devices, nicht zentral am dblog-Device.

Gruß, Tom
Titel: Antw:Hilfe DBlog nur spezielle Geräte ?
Beitrag von: ChrisW am 21 Januar 2019, 18:06:31
Danke. Wie ich jetzt sehe gibt es einige möglichkeiten.
Im dem Video https://youtu.be/xwKBsGhviC0 habe ich auch einen schönen ansatz gesehen.

Ich kann dort Include/exclude wählen und jedem gerät erstmal alles .* exclude sagen.

Jetzt wäre nur schön wenn ich einen befehl hätte um schonmal bei jedem meiner Geräte wenn vorhanden das include hinzufüge
also temperature ..
wenn ein gerät also das reading temperature hat dann soll es in das dbinclude.
Aber ich glaube das ganze ist zu großer aufwand ? Werde dann wohl nicht drum herumkommen alles manuell duchzugehen was ich haben will. Aber das wäre ja auch Okay.
Titel: Antw:Hilfe DBlog nur spezielle Geräte ?
Beitrag von: sledge am 21 Januar 2019, 18:14:07

DbLogSelectionMode
attr <device> DbLogSelectionMode [Exclude|Include|Exclude/Include]
Thise DbLog-Device-Attribute specifies how the device specific Attributes DbLogExclude and DbLogInclude are handled. If this Attribute is missing it defaults to "Exclude".
Exclude: DbLog behaves just as usual. This means everything specified in the regex in DEF will be logged by default and anything excluded via the DbLogExclude attribute will not be logged
Include: Nothing will be logged, except the readings specified via regex in the DbLogInclude attribute (in source devices). Neither the Regex set in DEF will be considered nor the device name of the source device itself.
Exclude/Include: Just almost the same as Exclude, but if the reading matches the DbLogExclude attribute, then it will further be checked against the regex in DbLogInclude whicht may possibly re-include the already excluded reading.

DbLogInclude
attr <device> DbLogInclude regex:MinInterval,[regex:MinInterval] ...
A new Attribute DbLogInclude will be propagated to all Devices if DBLog is used. DbLogInclude works just like DbLogExclude but to include matching readings. See also DbLogSelectionMode-Attribute of DbLog-Device which takes influence on on how DbLogExclude and DbLogInclude are handled.
Example
attr MyDevice1 DbLogInclude .*
attr MyDevice2 DbLogInclude state,(floorplantext|MyUserReading):300,battery:3600

DbLogExclude
attr <device> DbLogExclude regex:MinInterval,[regex:MinInterval] ...
A new Attribute DbLogExclude will be propagated to all Devices if DBLog is used. DbLogExclude will work as regexp to exclude defined readings to log. Each individual regexp-group are separated by comma. If a MinInterval is set, the logentry is dropped if the defined interval is not reached and value vs. lastvalue is eqal.


Um mal die commandref zu stressen. Mit einer entsprechendenKombi aus selectionmode=exclude/include und den beiden weiteren Attributen müsste Deine Vorstellung abbildbar sein.

Give it a try.