2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 18:59:33 +00:00

30_DUOFERN: Add attribute positionDeviation

git-svn-id: https://svn.fhem.de/fhem/trunk@19588 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
Telekatz 2019-06-10 11:39:23 +00:00
parent 520902cb1b
commit 2f7c744e9f

View File

@ -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,6 +926,7 @@ 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($)
<li><b>positionInverse</b><br>
If attribute is set, the position value of the roller shutter is inverted.
</li><br>
<li><b>positionDeviation</b><br>
Maximum deviation for displaying the desired position instead of the reported position.
</li><br>
</ul>
<br>