mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-04 22:19:38 +00:00
some rewritings for PCR800
git-svn-id: https://svn.fhem.de/fhem/trunk@787 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
98b1b6e249
commit
ac90921d70
@ -379,6 +379,12 @@ sub alt_temphydro {
|
|||||||
my $type = shift;
|
my $type = shift;
|
||||||
my $bytes = shift;
|
my $bytes = shift;
|
||||||
|
|
||||||
|
#
|
||||||
|
my $hex_line = "";
|
||||||
|
for (my $i=0;$i<=9;$i++) {
|
||||||
|
$hex_line .= 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 = ();
|
||||||
@ -387,6 +393,14 @@ sub alt_temphydro {
|
|||||||
humidity($bytes, $dev_str, \@res);
|
humidity($bytes, $dev_str, \@res);
|
||||||
percentage_battery($bytes, $dev_str, \@res);
|
percentage_battery($bytes, $dev_str, \@res);
|
||||||
|
|
||||||
|
# hexline debugging
|
||||||
|
#push @res, {
|
||||||
|
# device => $dev_str,
|
||||||
|
# type => 'hexline',
|
||||||
|
# current => $hex_line,
|
||||||
|
# units => 'hex',
|
||||||
|
# };
|
||||||
|
|
||||||
return @res;
|
return @res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -528,20 +542,21 @@ sub rain_PCR800 {
|
|||||||
my $bytes = shift;
|
my $bytes = shift;
|
||||||
|
|
||||||
#
|
#
|
||||||
#my $hexline = "";
|
my $hexline = "";
|
||||||
#for (my $i=0;$i<=10;$i++) {
|
for (my $i=0;$i<=10;$i++) {
|
||||||
# $hexline .= sprintf("%02x",$bytes->[$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",$bytes->[5])/10 + hi_nibble($bytes->[4])/100 + lo_nibble($bytes->[6])/1000;
|
my $rain = lo_nibble($bytes->[6])*10 + sprintf("%02x",$bytes->[5])/10 + hi_nibble($bytes->[4])/100;
|
||||||
$rain *= 25.4; # convert from inch to mm
|
$rain *= 25.4; # convert from inch to mm
|
||||||
|
|
||||||
my $train = sprintf("%2.2f", ( sprintf("%02x",$bytes->[7])/100 + hi_nibble($bytes->[6])/1000 +
|
my $train = lo_nibble($bytes->[9])*100 + sprintf("%02x",$bytes->[8]) +
|
||||||
lo_nibble($bytes->[9])*100 + sprintf("%02x",$bytes->[8]) ) * 25.4);
|
sprintf("%02x",$bytes->[7])/100 + hi_nibble($bytes->[6])/1000;
|
||||||
|
$train *= 25.4; # convert from inch to mm
|
||||||
|
|
||||||
push @res, {
|
push @res, {
|
||||||
device => $dev_str,
|
device => $dev_str,
|
||||||
@ -650,6 +665,7 @@ OREGON_Parse($$)
|
|||||||
|
|
||||||
my $rec = $types{$key} || $types{$key&0xfffff};
|
my $rec = $types{$key} || $types{$key&0xfffff};
|
||||||
unless ($rec) {
|
unless ($rec) {
|
||||||
|
#Log 3, "OREGON: ERROR: Unknown sensor_id=$sensor_id bits=$bits message='$hexline'.";
|
||||||
Log 4, "OREGON: ERROR: Unknown sensor_id=$sensor_id bits=$bits message='$hexline'.";
|
Log 4, "OREGON: ERROR: Unknown sensor_id=$sensor_id bits=$bits message='$hexline'.";
|
||||||
return "OREGON: ERROR: Unknown sensor_id=$sensor_id bits=$bits.\n";
|
return "OREGON: ERROR: Unknown sensor_id=$sensor_id bits=$bits.\n";
|
||||||
}
|
}
|
||||||
@ -658,7 +674,7 @@ OREGON_Parse($$)
|
|||||||
my $checksum = $rec->{checksum};
|
my $checksum = $rec->{checksum};
|
||||||
if ($checksum && !$checksum->(\@rfxcom_data_array) ) {
|
if ($checksum && !$checksum->(\@rfxcom_data_array) ) {
|
||||||
Log 3, "OREGON: ERROR: checksum error sensor_id=$sensor_id (bits=$bits)";
|
Log 3, "OREGON: ERROR: checksum error sensor_id=$sensor_id (bits=$bits)";
|
||||||
return;
|
return "OREGON: ERROR: checksum error sensor_id=$sensor_id (bits=$bits)";
|
||||||
}
|
}
|
||||||
|
|
||||||
my $method = $rec->{method};
|
my $method = $rec->{method};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user