diff --git a/fhem/CHANGED b/fhem/CHANGED
index 73cf82024..ca48cdb94 100644
--- a/fhem/CHANGED
+++ b/fhem/CHANGED
@@ -1,5 +1,6 @@
# 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.
+ - feature: 11_OWDevice: new attribute cstrings, fix for trimvalues
- new: 98_powerMap: introducing new module to calculate power and
energy for every FHEM device w/o power meter
- updated: 38_netatmo.pm: added support for Presence, Homecoach & Webhook
diff --git a/fhem/FHEM/10_OWServer.pm b/fhem/FHEM/10_OWServer.pm
index 692501f86..a928fa29a 100644
--- a/fhem/FHEM/10_OWServer.pm
+++ b/fhem/FHEM/10_OWServer.pm
@@ -661,7 +661,7 @@ OWServer_Set($@)
-
+
Attributes
- nonblocking
@@ -804,7 +804,7 @@ OWServer_Set($@)
-
+
Attribute
- nonblocking
diff --git a/fhem/FHEM/11_OWDevice.pm b/fhem/FHEM/11_OWDevice.pm
index 87cf38f7d..3f6f3780c 100644
--- a/fhem/FHEM/11_OWDevice.pm
+++ b/fhem/FHEM/11_OWDevice.pm
@@ -374,7 +374,7 @@ OWDevice_Initialize($)
$hash->{UndefFn} = "OWDevice_Undef";
$hash->{AttrFn} = "OWDevice_Attr";
- $hash->{AttrList} = "IODev uncached trimvalues polls interfaces model ".
+ $hash->{AttrList} = "IODev uncached trimvalues polls interfaces model cstrings ".
"resolution:9,10,11,12 ".
$readingFnAttributes;
}
@@ -465,7 +465,8 @@ OWDevice_ReadValue($$) {
#Debug "$path => $value; $msec";
if($interface ne "id") {
if(defined($value)) {
- $value= trim($value) if(AttrVal($hash,"trimvalues",1));
+ $value=~ s/\0.*$//g if(AttrVal($hash->{NAME},"cstrings",0));
+ $value= trim($value) if(AttrVal($hash->{NAME},"trimvalues",1));
} else {
Log3 $hash, 3, $hash->{NAME} . ": reading $reading did not return a value";
}
@@ -886,6 +887,7 @@ OWDevice_InitValues($)
belong to it, then continue with the next OWServer and the attached OWDevices, and so on.
- trimvalues: removes leading and trailing whitespace from readings. Default is 1 (on).
+ - cstrings: interprets reading as C-style string, i.e. stops reading on the first zero byte. Default is 0 (off).
- polls: a comma-separated list of readings to poll. This supersedes the list of default readings to poll.
- interfaces: supersedes the interfaces exposed by that device.
- model: preset with device type, e.g. DS18S20.
@@ -1044,6 +1046,7 @@ OWDevice_InitValues($)
nächste OWServer-Instanz, gefolgt von den zugehörigen OWDevice-Geräten, usw.
- trimvalues: Entfernt voran- und nachgestellte Leerzeichen aus den readings. Standartwert ist 1 (ein).
+ - cstrings: Interpretiert die readings als C-String, d.h. hört mit dem ersten 0-Byte zu lesen auf. Standardwert ist 0 (off).
- polls: Eine per Komma getrennte Liste der abzurufenden readings. Mit diesem Attribut unterdrückt man alle standartmäßig abgerufenen readings und ersetzt sie durch die eigene Zusammenstellung.
- interfaces: Ersetzt die durch dieses Gerät erzeugten Interfaces.
- model: Angabe des Gerätetyps, z.B.: DS18S20.