mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 06:39:11 +00:00
ZWave.pm: METER class: change undef to UNKNOWN_X (Forum #124642)
git-svn-id: https://svn.fhem.de/fhem/trunk@25317 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
851f902784
commit
881e76524d
@ -1817,7 +1817,14 @@ my %zwm_unit = (
|
||||
heating => ["kWh" ],
|
||||
cooling => ["kWh" ]
|
||||
);
|
||||
my @meter_type_text = ("undef", "energy", "gas", "water", "heating", "cooling");
|
||||
my @meter_type_text = (
|
||||
"UNKNOWN_0",
|
||||
"energy",
|
||||
"gas",
|
||||
"water",
|
||||
"heating",
|
||||
"cooling"
|
||||
);
|
||||
|
||||
sub
|
||||
ZWave_meterParse($$)
|
||||
@ -1836,7 +1843,7 @@ ZWave_meterParse($$)
|
||||
|
||||
my $meter_type = ($v1 & 0x1f);
|
||||
my $meter_type_text = ($meter_type > $#meter_type_text ?
|
||||
"undef" : $meter_type_text[$meter_type]);
|
||||
"UNKNOWN_${meter_type}" : $meter_type_text[$meter_type]);
|
||||
|
||||
my $precision = ($v2>>5) & 0x7; # 3 bits
|
||||
my $scale = ($v2>>3) & 0x3; # 2 bits, meaning unit
|
||||
@ -1845,8 +1852,8 @@ ZWave_meterParse($$)
|
||||
$scale |= (($v1 & 0x80) >> 5);
|
||||
$scale = 8+hex(substr($v3, -2)) if($scale == 7); # V4
|
||||
|
||||
my $unit_text = ($meter_type_text eq "undef" ?
|
||||
"undef" : $zwm_unit{$meter_type_text}[$scale]);
|
||||
my $unit_text = ($meter_type_text =~ m/^UNKNOWN/ ?
|
||||
"UNKNOWN" : $zwm_unit{$meter_type_text}[$scale]);
|
||||
$meter_type_text = "power" if ($unit_text eq "W");
|
||||
$meter_type_text = "voltage" if ($unit_text eq "V");
|
||||
$meter_type_text = "current" if ($unit_text eq "A");
|
||||
|
Loading…
Reference in New Issue
Block a user