FHEM Forum

FHEM => Automatisierung => Thema gestartet von: FhemPiUser am 25 April 2015, 13:27:12

Titel: [gelöst] ReadingsVal gibt nicht korekten Wert aus
Beitrag von: FhemPiUser am 25 April 2015, 13:27:12
Hallo Zusammen,

ich habe folgendes in der fhem.cfg, um aus humidity und measured-temp des devices WT_Kellerwaschraum_Climate die absolute Luftfeuchte zu berechnen und zu loggen:

define AbsLuftf_Kellerwaschraum dummy
attr AbsLuftf_Kellerwaschraum room Luftfeuchtigkeit
define AbsLuftfNotify_Kellerwaschraum notify (WT_Kellerwaschraum_Climate:humidity.*|WT_Kellerwaschraum_Climate:measured-temp.*) { fhem("set AbsLuftf_Kellerwaschraum ".sprintf("%.1f",GetAbsLuftfeuchtigkeit(ReadingsVal('WT_Kellerwaschraum_Climate','humidity',0),ReadingsVal('WT_Kellerwaschraum_Climate','measured-temp',0))));; }
attr AbsLuftfNotify_Kellerwaschraum room Luftfeuchtigkeit

define FileLog_AbsLuftf_Kellerwaschraum FileLog ./log/AbsLuftf_Kellerwaschraum-%Y-%m.log AbsLuftf_Kellerwaschraum
attr FileLog_AbsLuftf_Kellerwaschraum logtype text

Leider sieht das Log FileLog_AbsLuftf_Kellerwaschraum wie folgt aus:

2015-04-25_13:22:02 AbsLuftf_Kellerwaschraum humidity: 51.1f
2015-04-25_13:22:02 AbsLuftf_Kellerwaschraum measured-temp: 16.4.1f
2015-04-25_13:24:35 AbsLuftf_Kellerwaschraum humidity: 51.1f
2015-04-25_13:24:35 AbsLuftf_Kellerwaschraum measured-temp: 16.4.1f

Das Log des devices WT_Kellerwaschraum_Climate ist wie folgt:

2015-04-25_13:22:02 WT_Kellerwaschraum_Climate measured-temp: 16.4
2015-04-25_13:22:02 WT_Kellerwaschraum_Climate T: 16.4 desired: 21.0
2015-04-25_13:24:35 WT_Kellerwaschraum_Climate desired-temp: 21.0
2015-04-25_13:24:35 WT_Kellerwaschraum_Climate humidity: 51
2015-04-25_13:24:35 WT_Kellerwaschraum_Climate measured-temp: 16.4
2015-04-25_13:24:35 WT_Kellerwaschraum_Climate T: 16.4 desired: 21.0

Irgendwie scheint das ReadingsVal oben immer das gesamte Event zurückzugeben, anstatt nur die Werte für humidity oder measured-temp. Kann mir jemand erklären, warum das so ist?

Vielen Dank
Titel: Antw:ReadingsVal gibt nicht korekten Wert aus
Beitrag von: Paul am 25 April 2015, 13:47:16
Swarum benutzt du nicht dewpoint
Titel: Antw:ReadingsVal gibt nicht korekten Wert aus
Beitrag von: Markus Bloch am 25 April 2015, 13:57:55
Richtig wäre es folgendermaßen:

define AbsLuftf_Kellerwaschraum dummy
attr AbsLuftf_Kellerwaschraum room Luftfeuchtigkeit
define AbsLuftfNotify_Kellerwaschraum notify (WT_Kellerwaschraum_Climate:humidity.*|WT_Kellerwaschraum_Climate:measured-temp.*) { fhem("set AbsLuftf_Kellerwaschraum ".sprintf("%%.1f",GetAbsLuftfeuchtigkeit(ReadingsVal('WT_Kellerwaschraum_Climate','humidity',0),ReadingsVal('WT_Kellerwaschraum_Climate','measured-temp',0))));; }
attr AbsLuftfNotify_Kellerwaschraum room Luftfeuchtigkeit


Siehe dazu die commandref von notify: http://fhem.de/commandref.html#notify


Note: the following is deprecated and will be removed in a future release. The described replacement is attempted if none of the above variables ($NAME/$EVENT/etc) found in the command.
- The character % will be replaced with the received event, e.g. with on or off or measured-temp: 21.7 (Celsius)
...
-  To use % or @ in the text itself, use the double mode (%% or @@).


Viele Grüße

Markus
Titel: Antw:ReadingsVal gibt nicht korekten Wert aus
Beitrag von: FhemPiUser am 26 April 2015, 22:16:16
danke, funktioniert!

nutze jetzt ausserdem auch dewpoint