mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-03 16:56:54 +00:00
12_HProtocolGateway: PMS-IB checksum calculation corrected
git-svn-id: https://svn.fhem.de/fhem/trunk@18532 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
5e74ba83d8
commit
333fd680de
@ -1,5 +1,6 @@
|
||||
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
|
||||
# Do not insert empty lines here, update check depends on it.
|
||||
- bugfix: 12_HProtocolGateway: PMS-IB checksum calculation corrected
|
||||
- change: 12_HProtocolGateway: move sensorSystem attribute to HProtocolTank
|
||||
- feature: 98_Verkehrsinfo.pm: add attribut timeout
|
||||
- feature: 12_HProtocolGateway: added 843 protocol for PMS-IB P20
|
||||
|
@ -189,19 +189,20 @@ sub HProtocolGateway_ParseMessage($$) {
|
||||
|
||||
my $sensorSystem = AttrVal($tankHash->{NAME}, 'sensorSystem', "");
|
||||
|
||||
my ($tanknumber,$error,$temperature,$tankdata,$water,$checksum,$version,$probe_offset);
|
||||
my ($tanknumber,$error,$temperature,$tankdata,$water,$checksum,$version,$probe_offset,$test);
|
||||
|
||||
# PMS-IB
|
||||
if ( $sensorSystem eq "PMS-IB") {
|
||||
($tanknumber,$error,$temperature,$tankdata,$water,$checksum)=split(/=/,$data);
|
||||
$test = substr($data, 0, length($data)-3);
|
||||
|
||||
# checksum
|
||||
my @ascii = unpack("C*", $data);
|
||||
my @ascii = unpack("C*", $test);
|
||||
my $sum = 0;
|
||||
foreach my $val (@ascii) {
|
||||
$sum = $sum + $val;
|
||||
}
|
||||
if ($sum > 255) {
|
||||
while ($sum > 255) {
|
||||
$sum = $sum - 255;
|
||||
}
|
||||
|
||||
@ -212,7 +213,7 @@ sub HProtocolGateway_ParseMessage($$) {
|
||||
$data =~ s/^.//; # remove #
|
||||
|
||||
($tankdata,$water,$temperature,$probe_offset,$version,$error,$checksum)=split(/@/,$data);
|
||||
my $test = "#".$tankdata.$water.$temperature.$probe_offset.$version.$error;
|
||||
$test = "#".$tankdata.$water.$temperature.$probe_offset.$version.$error;
|
||||
|
||||
# calculate XOR CRC
|
||||
my $check = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user