From 27f389ab443223d656ada3e1df8b14cbd1a64b5c Mon Sep 17 00:00:00 2001 From: rudolfkoenig <> Date: Wed, 4 Jan 2017 15:33:06 +0000 Subject: [PATCH] fhem.pl: allow STATE with space/tab in it (Forum #61566) git-svn-id: https://svn.fhem.de/fhem/trunk@12955 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/fhem.pl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fhem/fhem.pl b/fhem/fhem.pl index 7d55955a6..f71c74f4c 100755 --- a/fhem/fhem.pl +++ b/fhem/fhem.pl @@ -1384,6 +1384,7 @@ GetAllReadings($) $val ne "" && $val ne "???") { $val =~ s/;/;;/g; + $val =~ s/([ \t])/sprintf("\\%03o",ord($1))/eg if($val =~ m/^[ \t]*$/); $val =~ s/\n/\\\n/g; push @ret, "setstate $d $val"; } @@ -2748,6 +2749,7 @@ CommandSetstate($$) # The timestamp is not the correct one, but we do not store a timestamp # for this reading. my $tn = TimeNow(); + $a[1] =~ s/\\(...)/chr(oct($1))/ge if($a[1] =~ m/^(\\011|\\040)+$/); $oldvalue{$sdev}{TIME} = $tn; $oldvalue{$sdev}{VAL} = ($init_done ? $d->{STATE} : $a[1]);