diff --git a/fhem/FHEM/30_DUOFERN.pm b/fhem/FHEM/30_DUOFERN.pm index a123d4d43..56e164a96 100644 --- a/fhem/FHEM/30_DUOFERN.pm +++ b/fhem/FHEM/30_DUOFERN.pm @@ -584,7 +584,7 @@ DUOFERN_Initialize($) $hash->{ParseFn} = "DUOFERN_Parse"; $hash->{RenameFn} = "DUOFERN_Rename"; $hash->{AttrFn} = "DUOFERN_Attr"; - $hash->{AttrList} = "IODev timeout toggleUpDown ignore:1,0 positionInverse:1,0 ". $readingFnAttributes; + $hash->{AttrList} = "IODev timeout toggleUpDown ignore:1,0 positionInverse:1,0 positionDeviation ". $readingFnAttributes; #$hash->{AutoCreate}= # { "DUOFERN" => { GPLOT => "", FILTER => "%NAME" } }; } @@ -926,7 +926,8 @@ DUOFERN_Set($@) } else { readingsSingleUpdate($hash, "moving", "stop", 1); } - } + $hash->{helper}{desiredPosition} = $arg; + } $command = $commands{$cmd}{cmd}{$subCmd}; @@ -1153,6 +1154,14 @@ DUOFERN_Parse($$) $value = ($value >> $stFrom) & ((1<<$stLen) - 1); + if(defined($hash->{helper}{desiredPosition}) and $stName eq "position") { + if(abs($value - $hash->{helper}{desiredPosition}) <= AttrVal($name,"positionDeviation",0)) { + $value = $hash->{helper}{desiredPosition}; + } else { + delete $hash->{helper}{desiredPosition}; + } + } + if((exists $statusIds{$statusId}{invert}) && ($positionInverse eq "1")) { $value = $statusIds{$statusId}{invert} - $value; } @@ -1932,6 +1941,9 @@ DUOFERN_StatusTimeout($)