diff --git a/fhem/CHANGED b/fhem/CHANGED index 45bffd3ea..212f48ef3 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -1,5 +1,7 @@ # Add changes at the top of the list. Keep it in ASCII, and 80-char wide. # Do not insert empty lines here, update check depends on it. + - change: 98_dewpoint: Don't manipulate STATE of target device if has + stateFormat defined. - new: 55_DWD_OpenData: weather and alerts from DWD - bugfix: 74_Unifi: Cookies for UnifiController 5.9.4 - bugfix: 74_GardenaSmartDevice: fix uninitialized value $abilities diff --git a/fhem/FHEM/98_dewpoint.pm b/fhem/FHEM/98_dewpoint.pm index 57ba30c5e..b6cd91bb1 100644 --- a/fhem/FHEM/98_dewpoint.pm +++ b/fhem/FHEM/98_dewpoint.pm @@ -311,7 +311,9 @@ dewpoint_Notify($$) } $sensor = $new_name; - if ($temp_name ne "T") { + + my $has_state_format = defined(AttrVal($dev->{NAME}, "stateFormat", undef)); + if ($temp_name ne "T" || $has_state_format) { $current = $dewpoint; readingsBulkUpdate($dev, $sensor, $current); readingsEndUpdate($dev, 1); @@ -547,9 +549,11 @@ dewpoint_absFeuchte ($$) If optional <temp_name>, <hum_name> and <new_name> is specified then read temperature from reading <temp_name>, humidity from reading <hum_name> and write the calculated dewpoint to reading <new_name>.
- If <temp_name> is T then use temperature from state T: H:, add <new_name> to the state. + Obsolete, avoid for new definitions
+   If <temp_name> is T then use temperature from state T: H:, add <new_name> to the STATE. + The addition to STATE only occurs if the target device does not define attribute "stateFormat". -
+

Example:
     # Compute the dewpoint for the temperature/humidity
@@ -565,12 +569,13 @@ dewpoint_absFeuchte ($$)
 
     # Compute the dewpoint for the temperature/humidity
     # events of the device Aussen_1 offering temperature and humidity
-    # and insert is into STATE.
+    # and insert is into STATE unless Aussen_1 has attribute "stateFormat" defined.
+    # If "stateFormat" is defined then a reading D will be generated.
     define dew_state dewpoint dewpoint Aussen_1 T H D
 
     # Compute the dewpoint for the temperature/humidity
     # events of all devices offering temperature and humidity
-    # and insert the result into the STATE.
+    # and insert the result into the STATE. (See example above).
     # Example STATE: "T: 10 H: 62.5" will change to
     # "T: 10 H: 62.5 D: 3.2"
     define dew_state dewpoint dewpoint .* T H D
@@ -699,9 +704,11 @@ dewpoint_absFeuchte ($$)
     und Luftfeuchte und erzeugt daraus ein neues Reading namens dewpoint.
Wenn <temp_name>, <hum_name> und <new_name> angegeben sind, werden die Temperatur aus dem Reading <temp_name>, die Luftfeuchte aus dem - Reading <hum_name> gelesen und als berechneter Taupunkt ins Reading <new_name> geschrieben.
- Wenn <temp_name> T lautet, wird die Temperatur aus state T: H: benutzt - und <new_name> zu state hinzugefügt. + Reading <hum_name> gelesen und als berechneter Taupunkt ins Reading <new_name> geschrieben.

+ Veraltet, für neue Definitionen nicht mehr benutzen
+   Wenn <temp_name> T lautet, wird die Temperatur aus state T: H: benutzt + und <new_name> zu STATE hinzugefügt. Das hinzufügen zu STATE erfolgt nur, falls im Zielgerät + das Attribut "stateFormat" nicht definiert ist.

Beispiele:
@@ -718,12 +725,13 @@ dewpoint_absFeuchte ($$)
 
     # Berechnet den Taupunkt aufgrund von Temperatur und Luftfeuchte
     # in Ereignissen, die vom Gerät Aussen_1 erzeugt wurden und ergänzt 
-    # mit diesem Wert den Status STATE.
+    # mit diesem Wert den Status STATE, falls in Aussen_1 das Attribut "stateFormat" nicht definiert ist.
+    # Falls "stateFormat" definiert ist, wird das reading "D" angelegt.
     define dew_state dewpoint dewpoint Aussen_1 T H D
 
     # Berechnet den Taupunkt aufgrund von Temperatur und Luftfeuchte
     # in Ereignissen, die von allen Geräten erzeugt wurden die diese Werte ausgeben
-    # und ergänzt mit diesem Wert den Status STATE.
+    # und ergänzt mit diesem Wert den Status STATE. (Siehe Beispiel oben).
     # Beispiel STATE: "T: 10 H: 62.5" wird verändert nach
     # "T: 10 H: 62.5 D: 3.2"
     define dew_state dewpoint dewpoint .* T H D