[gelöst] ReadingsVal gibt nicht korekten Wert aus

Begonnen von FhemPiUser, 25 April 2015, 13:27:12

Vorheriges Thema - Nächstes Thema

FhemPiUser

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

Paul

Cubietruck, HM-USB, CUL, FS20, FHT, HUE, Keymatic

Markus Bloch

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
Developer für Module: YAMAHA_AVR, YAMAHA_BD, FB_CALLMONITOR, FB_CALLLIST, PRESENCE, Pushsafer, LGTV_IP12, version

aktives Mitglied des FHEM e.V. (Technik)

FhemPiUser

danke, funktioniert!

nutze jetzt ausserdem auch dewpoint