mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-03 10:46:53 +00:00
KFM rawToReadable
git-svn-id: https://svn.fhem.de/fhem/trunk@913 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
bf758b26e0
commit
40715c0319
@ -129,7 +129,8 @@ CUL_HM_Initialize($)
|
||||
"subType:switch,dimmer,blindActuator,remote,sensor,".
|
||||
"swi,pushButton,threeStateSensor,motionDetector,".
|
||||
"keyMatic,winMatic,smokeDetector " .
|
||||
"hmClass:receiver,sender serialNr firmware devInfo";
|
||||
"hmClass:receiver,sender serialNr firmware devInfo ".
|
||||
"rawToReadable unit";
|
||||
}
|
||||
|
||||
|
||||
@ -499,9 +500,26 @@ Log 1, "WM2";
|
||||
my ($k_cnt, $k_v1, $k_v2, $k_v3) = ($1,$2,$3,$4);
|
||||
my $v = 128-hex($k_v2); # FIXME: calibrate
|
||||
$v = 256+$v if($v < 0);
|
||||
|
||||
$v += 256 if(!($k_v3 & 1));
|
||||
push @event, "rawValue:$v";
|
||||
|
||||
my $r2r = AttrVal($name, "rawToReadable", undef);
|
||||
if($r2r) {
|
||||
my @r2r = split("[ :]", $r2r);
|
||||
foreach(my $idx = 0; $idx < @r2r-2; $idx+=2) {
|
||||
if($v >= $r2r[$idx] && $v <= $r2r[$idx+2]) {
|
||||
my $f = (($v-$r2r[$idx])/($r2r[$idx+2]-$r2r[$idx]));
|
||||
my $cv = ($r2r[$idx+3]-$r2r[$idx+1])*$f + $r2r[$idx+1];
|
||||
my $unit = AttrVal($name, "unit", "");
|
||||
$unit = " $unit" if($unit);
|
||||
push @event, "state:$cv$unit";
|
||||
last;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
push @event, "state:$v";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2502,6 +2502,25 @@ A line ending with \ will be concatenated with the next one, so long lines
|
||||
These attributes are set automatically after a successful pairing.
|
||||
They are not supposed to be set by hand, and are necessary in order to
|
||||
correctly interpret device messages or to be able to send them.</li>
|
||||
<li><a name="#rawToReadable">rawToReadable</a><br>
|
||||
Used to convert raw KFM100 values to readable data, based on measured
|
||||
values. E.g. fill slowly your container, while monitoring the
|
||||
values reported with <a href="#inform">inform</a>. You'll see:
|
||||
<ul>
|
||||
10 (at 0%)<br>
|
||||
50 (at 20%)<br>
|
||||
79 (at 40%)<br>
|
||||
270 (at 100%)<br>
|
||||
</ul>
|
||||
Apply these values with: "attr KFM100 rawToReadable 10:0 50:20 79:40 270:100".
|
||||
fhem will do a linear interpolation for values between the bounderies.
|
||||
</li>
|
||||
<li><a name="#unit">unit</a><br>
|
||||
set the reported unit by the KFM100 if rawToReadable is active. E.g.<br>
|
||||
attr KFM100 unit Liter
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
<br>
|
||||
|
Loading…
x
Reference in New Issue
Block a user