mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-10 03:06:37 +00:00
added support for PCR800 rain gauge
git-svn-id: https://svn.fhem.de/fhem/trunk@703 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
9f9267bf67
commit
16c0e3a89f
@ -231,11 +231,10 @@ my %types =
|
|||||||
part => 'RTGR328N', checksum => \&checksum2, method => \&common_temphydro,
|
part => 'RTGR328N', checksum => \&checksum2, method => \&common_temphydro,
|
||||||
},
|
},
|
||||||
# PCR800. Commented out until fully tested.
|
# PCR800. Commented out until fully tested.
|
||||||
#type_length_key(0x2a19, 92) =>
|
type_length_key(0x2a19, 92) =>
|
||||||
#{
|
{
|
||||||
# part => 'PCR800', checksum => \&checksum8, method => \&rain_PCR800,
|
part => 'PCR800', checksum => \&checksum8, method => \&rain_PCR800,
|
||||||
#},
|
},
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
# --------------------------------------------
|
# --------------------------------------------
|
||||||
@ -502,22 +501,21 @@ sub rain_PCR800 {
|
|||||||
my $type = shift;
|
my $type = shift;
|
||||||
my $bytes = shift;
|
my $bytes = shift;
|
||||||
|
|
||||||
|
#
|
||||||
|
#my $hexline = "";
|
||||||
|
#for (my $i=0;$i<=10;$i++) {
|
||||||
|
# $hexline .= sprintf("%02x",$bytes->[$i]);
|
||||||
|
#}
|
||||||
|
#
|
||||||
my $device = sprintf "%02x", $bytes->[3];
|
my $device = sprintf "%02x", $bytes->[3];
|
||||||
my $dev_str = $type.$DOT.$device;
|
my $dev_str = $type.$DOT.$device;
|
||||||
my @res = ();
|
my @res = ();
|
||||||
|
|
||||||
my $rain = sprintf("%02x%02x",$bytes->[5], $bytes->[4])/100;
|
my $rain = sprintf("%02x",$bytes->[5])/10 + hi_nibble($bytes->[4])/100 + lo_nibble($bytes->[6])/1000;
|
||||||
$rain *= 25.4; # convert from inch/hr to mm/hr
|
$rain *= 25.4; # convert from inch to mm
|
||||||
|
|
||||||
#my $rain = sprintf("%2.2f",(($bytes->[5])/10 + hi_nibble($bytes->[4])/100 + lo_nibble($bytes->[6])/1000));# * 25.4;
|
my $train = sprintf("%2.2f", ( sprintf("%02x",$bytes->[7])/100 + hi_nibble($bytes->[6])/1000 +
|
||||||
|
lo_nibble($bytes->[9])*100 + sprintf("%02x",$bytes->[8]) ) * 25.4);
|
||||||
my $train = lo_nibble($bytes->[9])*100 +
|
|
||||||
sprintf("%02x", $bytes->[8]) + sprintf("%02x", $bytes->[7])/100 +
|
|
||||||
hi_nibble($bytes->[6])/1000;
|
|
||||||
$train *= 25.4; # convert from inch to mm
|
|
||||||
|
|
||||||
# my $train = sprintf("%2.2f", ( ($bytes->[7])/100 + hi_nibble($bytes->[6])/1000 +
|
|
||||||
# lo_nibble($bytes->[9])*100 + ($bytes->[8]) ) * 25.4);
|
|
||||||
|
|
||||||
push @res, {
|
push @res, {
|
||||||
device => $dev_str,
|
device => $dev_str,
|
||||||
@ -531,6 +529,13 @@ sub rain_PCR800 {
|
|||||||
current => $train,
|
current => $train,
|
||||||
units => 'mm',
|
units => 'mm',
|
||||||
};
|
};
|
||||||
|
# hexline debugging
|
||||||
|
#push @res, {
|
||||||
|
# device => $dev_str,
|
||||||
|
# type => 'hexline',
|
||||||
|
# current => $hexline,
|
||||||
|
# units => 'hex',
|
||||||
|
# };
|
||||||
simple_battery($bytes, $dev_str, \@res);
|
simple_battery($bytes, $dev_str, \@res);
|
||||||
return @res;
|
return @res;
|
||||||
}
|
}
|
||||||
@ -745,6 +750,12 @@ OREGON_Parse($$)
|
|||||||
$def->{READINGS}{$sensor}{VAL} = $i->{current};
|
$def->{READINGS}{$sensor}{VAL} = $i->{current};
|
||||||
$def->{CHANGED}[$n++] = $sensor . ": " . $i->{current};;
|
$def->{CHANGED}[$n++] = $sensor . ": " . $i->{current};;
|
||||||
}
|
}
|
||||||
|
case "hexline" {
|
||||||
|
$sensor = "hexline";
|
||||||
|
$def->{READINGS}{$sensor}{TIME} = $tm;
|
||||||
|
$def->{READINGS}{$sensor}{VAL} = $i->{current};
|
||||||
|
$def->{CHANGED}[$n++] = $sensor . ": " . $i->{current};;
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
print "\nOREGON: Unknown: ";
|
print "\nOREGON: Unknown: ";
|
||||||
print "Type: ".$i->{type}.", ";
|
print "Type: ".$i->{type}.", ";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user