CUL_MAX: parse Ack payload

git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@2288 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
mgehre 2012-12-09 14:59:02 +00:00
parent 960e805436
commit 9c2d6babc5
2 changed files with 14 additions and 3 deletions

View File

@ -328,7 +328,7 @@ MAX_Parse($$)
my $batterylow = vec($bits2, 7, 1); #1 if battery is low
my $untilStr = defined($until3) ? MAX_ParseDateTime($until1,$until2,$until3)->{str} : "";
my $measuredTemperature = $until2/10;
my $measuredTemperature = defined($until2) ? $until2/10 : "";
#If the control mode is not "temporary", the cube sends the current (measured) temperature
$measuredTemperature = "" if($mode == 2 || $measuredTemperature == 0);
$untilStr = "" if($mode != 2);
@ -416,6 +416,18 @@ MAX_Parse($$)
$shash->{ERROR} = join(",",$args[0]);
}
} elsif($msgtype eq "Ack") {
#The payload of an Ack is a 2-digit hex number (I just saw it being "01")
#with unknown meaning plus the data of a State broadcast from the same device
#For HeatingThermostats, it does not contain the last three "until" bytes (or measured temperature)
if($shash->{type} ~~ ["HeatingThermostat", "WallMountedThermostat"] ) {
return MAX_Parse($hash, "MAX,ThermostatState,$addr,". substr($args[0],2));
} elsif($shash->{type} eq "ShutterContact") {
return MAX_Parse($hash, "MAX,ShutterContactState,$addr,". substr($args[0],2));
} else {
Log 2, "MAX_Parse: Don't know how to interpret Ack payload for $shash->{type}";
}
} else {
Log 1, "MAX_Parse: Unknown message $msgtype";
}

View File

@ -167,6 +167,7 @@ CUL_MAX_Parse($$)
Log 5, "CUL_MAX_Parse: len $len, msgcnt $msgcnt, msgflag $msgFlag, msgTypeRaw $msgType, src $src, dst $dst, groupid $groupid, payload $payload";
if(exists($msgTypes{$msgTypeRaw})) {
if($msgType eq "Ack") {
Dispatch($shash, "MAX,Ack,$src,$payload", {RAWMSG => $rmsg});
my $i = 0;
while ($i < @waitForAck) {
my $packet = $waitForAck[$i];
@ -178,8 +179,6 @@ CUL_MAX_Parse($$)
$i++;
}
}
#TODO: The Ack payload for HeatingThermostats is 01HHHHHH where HHHHHH are the first 3 bytes of the HeatingThermostatState payload
Log 5, "Got Ack (but no match)";
} elsif($msgType eq "TimeInformation") {
if($len == 10) {