From 2f7c744e9ff67bdf6be499d701baffb986ce0709 Mon Sep 17 00:00:00 2001 From: Telekatz <> Date: Mon, 10 Jun 2019 11:39:23 +0000 Subject: [PATCH] 30_DUOFERN: Add attribute positionDeviation git-svn-id: https://svn.fhem.de/fhem/trunk@19588 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/30_DUOFERN.pm | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) 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($)
  • positionInverse
    If attribute is set, the position value of the roller shutter is inverted.

  • +
  • positionDeviation
    + Maximum deviation for displaying the desired position instead of the reported position. +