mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-04 22:19:38 +00:00
10_ZWave.pm: negative numbers for the meter class (reported by goap)
git-svn-id: https://svn.fhem.de/fhem/trunk@21023 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
d0f00e1ee7
commit
441ee2f9dd
@ -1798,8 +1798,14 @@ ZWave_meterParse($$)
|
||||
$meter_type_text = "current" if ($unit_text eq "A");
|
||||
|
||||
my $mv = hex(substr($v3, 0, 2*$size));
|
||||
$mv = ($mv >> 31 ? $mv - 2 ** 32 : $mv) if($size == 4);
|
||||
$mv = ($mv >> 24 ? $mv - 2 ** 24 : $mv) if($size == 3);
|
||||
$mv = ($mv >> 16 ? $mv - 2 ** 16 : $mv) if($size == 2);
|
||||
$mv = ($mv >> 8 ? $mv - 2 ** 8 : $mv) if($size == 1);
|
||||
|
||||
$mv = $mv / (10 ** $precision);
|
||||
$mv -= (2 ** ($size*8)) if $mv >= (2 ** ($size*8-1));
|
||||
# Log 1, "$v1 $v2 $v3 precision:$precision size:$size scale:$scale val:$mv";
|
||||
$v3 = substr($v3, 2*$size, length($v3)-(2*$size));
|
||||
|
||||
if (length($v3) < 4) { # V1 report
|
||||
|
Loading…
x
Reference in New Issue
Block a user