2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-22 20:24:36 +00:00

MAXLAN/CUL_MAX: add firmware and testresult to readings

git-svn-id: https://svn.fhem.de/fhem/trunk@4212 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
mgehre 2013-11-13 10:45:30 +00:00
parent 9f855f4ebe
commit 2d4c6fd096
2 changed files with 26 additions and 7 deletions

View File

@ -539,7 +539,16 @@ MAXLAN_Parse($$)
$len = $len+1; #The len field itself was not counted
Dispatch($hash, "MAX,1,define,$addr,$device_types{$devicetype},$serial,$groupid,1", {}) if($device_types{$devicetype} ne "Cube");
Dispatch($hash, "MAX,1,define,$addr,$device_types{$devicetype},$serial,$groupid", {}) if($device_types{$devicetype} ne "Cube");
#Set firmware and testresult on device
my $dhash = $modules{MAX}{defptr}{$addr};
if(defined($dhash)) {
readingsBeginUpdate($dhash);
readingsBulkUpdate($dhash, "firmware", $firmware);
readingsBulkUpdate($dhash, "testresult", $testresult);
readingsEndUpdate($dhash, 1);
}
if($len != length($bindata)) {
Dispatch($hash, "MAX,1,Error,$addr,Parts of configuration are missing", {});
@ -555,7 +564,6 @@ MAXLAN_Parse($$)
my ($comforttemp,$ecotemp,$maxsetpointtemp,$minsetpointtemp,$tempoffset,$windowopentemp,$windowopendur,$boost,$decalcifiction,$maxvalvesetting,$valveoffset,$weekprofile) = unpack("CCCCCCCCCCCH364",substr($bindata,18));
my $boostValve = ($boost & 0x1F) * 5;
my $boostDuration = $boost >> 5;
#There is some trailing data missing, which maps to the weekly program
$comforttemp = MAXLAN_ExtractTemperature($comforttemp); #convert to degree celcius
$ecotemp = MAXLAN_ExtractTemperature($ecotemp); #convert to degree celcius
$tempoffset = $tempoffset/2.0-3.5; #convert to degree
@ -661,7 +669,7 @@ MAXLAN_Parse($$)
}
my ($type, $addr, $serial) = unpack("CH6a[10]", decode_base64($args[0]));
Log 2, "MAXLAN_Parse: Paired new device, type $device_types{$type}, addr $addr, serial $serial";
Dispatch($hash, "MAX,1,define,$addr,$device_types{$type},$serial,0,1", {});
Dispatch($hash, "MAX,1,define,$addr,$device_types{$type},$serial,0", {});
#After a device has been paired, it automatically appears in the "L" and "C" commands,
MAXLAN_RequestConfiguration($hash,$addr);

View File

@ -308,8 +308,9 @@ CUL_MAX_Parse($$)
Log $ll5, "CUL_MAX_Parse: Got TimeInformation: (in GMT) year $year, mon $month, day $day, hour $hour, min $min, sec $sec, unk ($unk1, $unk2, $unk3)";
}
} elsif($msgType eq "PairPing") {
my ($unk1,$type,$unk2,$serial) = unpack("CCCa*",pack("H*",$payload));
Log $ll5, "CUL_MAX_Parse: Got PairPing (dst $dst, pairmode $shash->{pairmode}), unk1 $unk1, type $type, unk2 $unk2, serial $serial";
my ($firmware,$type,$testresult,$serial) = unpack("CCCa*",pack("H*",$payload));
#What does testresult mean?
Log $ll5, "CUL_MAX_Parse: Got PairPing (dst $dst, pairmode $shash->{pairmode}), firmware $firmware, type $type, testresult $testresult, serial $serial";
#There are two variants of PairPing:
#1. It has a destination address of "000000" and can be paired to any device.
@ -322,11 +323,21 @@ CUL_MAX_Parse($$)
#If $isToMe is true, this device is already paired and just wants to be reacknowledged
if($shash->{pairmode} || $isToMe) {
Log 3, "CUL_MAX_Parse: " . ($isToMe ? "Re-Pairing" : "Pairing") . " device $src of type $device_types{$type} with serial $serial";
Dispatch($shash, "MAX,$isToMe,define,$src,$device_types{$type},$serial,0,0", {});
Dispatch($shash, "MAX,$isToMe,define,$src,$device_types{$type},$serial,0", {});
#Set firmware and testresult on device
my $dhash = CUL_MAX_DeviceHash($src);
if(defined($dhash)) {
readingsBeginUpdate($dhash);
readingsBulkUpdate($dhash, "firmware", $firmware);
readingsBulkUpdate($dhash, "testresult", $testresult);
readingsEndUpdate($dhash, 1);
}
#Send after dispatch the define, otherwise Send will create an invalid device
CUL_MAX_Send($shash, "PairPong", $src, "00");
return $shash->{NAME} if($isToMe); #Skip default values if just rePairing
return $shash->{NAME} if($isToMe); #if just re-pairing, default values are not restored (I checked)
#This are the default values that a device has after factory reset or pairing
if($device_types{$type} =~ /HeatingThermostat.*/) {