2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-04 05:16:45 +00:00

MAX: parse fields of WallThermostat with new firmware

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

View File

@ -552,7 +552,7 @@ MAXLAN_Parse($$)
#TODO: there is a lot of data left to interpret
}elsif($device_types{$devicetype} =~ /HeatingThermostat.*/){
my ($comforttemp,$ecotemp,$maxsetpointtemp,$minsetpointtemp,$tempoffset,$windowopentemp,$windowopendur,$boost,$decalcifiction,$maxvalvesetting,$valveoffset,$weekprofile) = unpack("CCCCCCCCCCCH*",substr($bindata,18));
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
@ -568,16 +568,25 @@ MAXLAN_Parse($$)
my $decalcDay = ($decalcifiction >> 5) & 0x07;
my $decalcTime = $decalcifiction & 0x1F;
Log $ll5, "comfortemp $comforttemp, ecotemp $ecotemp, boostValve $boostValve, boostDuration $boostDuration, tempoffset $tempoffset, minsetpointtemp $minsetpointtemp, maxsetpointtemp $maxsetpointtemp, windowopentemp $windowopentemp, windowopendur $windowopendur";
Dispatch($hash, "MAX,1,HeatingThermostatConfig,$addr,$ecotemp,$comforttemp,$maxsetpointtemp,$minsetpointtemp,$boostValve,$boostDuration,$tempoffset,$windowopentemp,$windowopendur,$maxvalvesetting,$valveoffset,$decalcDay,$decalcTime,$weekprofile", {});
Dispatch($hash, "MAX,1,HeatingThermostatConfig,$addr,$ecotemp,$comforttemp,$maxsetpointtemp,$minsetpointtemp,$weekprofile,$boostValve,$boostDuration,$tempoffset,$windowopentemp,$windowopendur,$maxvalvesetting,$valveoffset,$decalcDay,$decalcTime", {});
}elsif($device_types{$devicetype} eq "WallMountedThermostat"){
my ($comforttemp,$ecotemp,$maxsetpointtemp,$minsetpointtemp,$weekprofile) = unpack("CCCCH*",substr($bindata,18));
$comforttemp /= 2.0; #convert to degree celcius
$ecotemp /= 2.0; #convert to degree celcius
$maxsetpointtemp /= 2.0;
$minsetpointtemp /= 2.0;
my ($comforttemp,$ecotemp,$maxsetpointtemp,$minsetpointtemp,$weekprofile,$tempoffset,$windowopentemp,$boost) = unpack("CCCCH364CCC",substr($bindata,18));
$comforttemp = MAXLAN_ExtractTemperature($comforttemp);
$ecotemp = MAXLAN_ExtractTemperature($ecotemp);
$maxsetpointtemp = MAXLAN_ExtractTemperature($maxsetpointtemp);
$minsetpointtemp = MAXLAN_ExtractTemperature($minsetpointtemp);
Log $ll5, "comfortemp $comforttemp, ecotemp $ecotemp, minsetpointtemp $minsetpointtemp, maxsetpointtemp $maxsetpointtemp";
Dispatch($hash, "MAX,1,WallThermostatConfig,$addr,$ecotemp,$comforttemp,$maxsetpointtemp,$minsetpointtemp,$weekprofile", {});
if(defined($tempoffset)) { #With firmware 18 (opposed to firmware 16)
$tempoffset = $tempoffset/2.0-3.5; #convert to degree
my $boostValve = ($boost & 0x1F) * 5;
my $boostDuration = $boost >> 5;
$windowopentemp = MAXLAN_ExtractTemperature($windowopentemp);
Log $ll5, "tempoffset $tempoffset, boostValve $boostValve, boostDuration $boostDuration, windowOpenTemp $windowopentemp";
Dispatch($hash, "MAX,1,WallThermostatConfig,$addr,$ecotemp,$comforttemp,$maxsetpointtemp,$minsetpointtemp,$weekprofile,$boostValve,$boostDuration,$tempoffset,$windowopentemp", {});
} else {
Dispatch($hash, "MAX,1,WallThermostatConfig,$addr,$ecotemp,$comforttemp,$maxsetpointtemp,$minsetpointtemp,$weekprofile", {});
}
}elsif($device_types{$devicetype} eq "ShutterContact"){
Log 2, "MAXLAN_Parse: ShutterContact send some configuration, but none was expected" if($len > 18);

View File

@ -680,7 +680,6 @@ MAX_Parse($$)
$untilStr = MAX_ParseDateTime($null1,$heaterTemperature,$null2)->{str};
$heaterTemperature = "";
}
$heaterTemperature = "" if(!defined($heaterTemperature));
Log GetLogLevel($shash->{NAME}, 5), "battery $batterylow, rferror $rferror, panel $panel, langateway $langateway, dstsetting $dstsetting, mode $mode, displayActualTemperature $displayActualTemperature, heaterTemperature $heaterTemperature, untilStr $untilStr";
@ -733,28 +732,21 @@ MAX_Parse($$)
readingsBulkUpdate($shash, "comfortTemperature", MAX_SerializeTemperature($args[1]));
readingsBulkUpdate($shash, "maximumTemperature", MAX_SerializeTemperature($args[2]));
readingsBulkUpdate($shash, "minimumTemperature", MAX_SerializeTemperature($args[3]));
if($shash->{type} =~ /HeatingThermostat.*/) {
readingsBulkUpdate($shash, "boostValveposition", $args[4]);
readingsBulkUpdate($shash, "boostDuration", $boost_durations{$args[5]});
readingsBulkUpdate($shash, "measurementOffset", MAX_SerializeTemperature($args[6]));
readingsBulkUpdate($shash, "windowOpenTemperature", MAX_SerializeTemperature($args[7]));
readingsBulkUpdate($shash, "windowOpenDuration", $args[8]);
readingsBulkUpdate($shash, "maxValveSetting", $args[9]);
readingsBulkUpdate($shash, "valveOffset", $args[10]);
readingsBulkUpdate($shash, "decalcification", "$decalcDays{$args[11]} $args[12]:00");
readingsBulkUpdate($shash, ".weekProfile", $args[13]);
} else {
#With firmware 18 (opposed to firmware 16), the WallThermostat sends 3 more bytes (6 more hex)
my ($weekProfile, $unknownBytes) = $args[4] =~ m/^(.{364})(.*)$/;
readingsBulkUpdate($shash, ".weekProfile", $weekProfile);
#We still have to find out what $unknownBytes mean, so hopefully
#we can observe some other values
if($unknownBytes ne "071830" and $unknownBytes ne "") {
Log GetLogLevel($shash->{NAME}, 2), "While parsing weekProfile of WallThermostat: Additional bytes $unknownBytes differ from 071830. Please report to http://forum.fhem.de/index.php?topic=15567";
}
readingsBulkUpdate($shash, ".weekProfile", $args[4]);
if(@args >= 4) { #HeatingThermostat and WallThermostat with new firmware
readingsBulkUpdate($shash, "boostValveposition", $args[5]);
readingsBulkUpdate($shash, "boostDuration", $boost_durations{$args[6]});
readingsBulkUpdate($shash, "measurementOffset", MAX_SerializeTemperature($args[7]));
readingsBulkUpdate($shash, "windowOpenTemperature", MAX_SerializeTemperature($args[8]));
}
if(@args >= 8) { #HeatingThermostat
readingsBulkUpdate($shash, "windowOpenDuration", $args[9]);
readingsBulkUpdate($shash, "maxValveSetting", $args[10]);
readingsBulkUpdate($shash, "valveOffset", $args[11]);
readingsBulkUpdate($shash, "decalcification", "$decalcDays{$args[12]} $args[13]:00");
}
MAX_ParseWeekProfile($shash);
MAX_ParseWeekProfile($shash);
} elsif($msgtype eq "Error") {
if(@args == 0) {

View File

@ -330,9 +330,9 @@ CUL_MAX_Parse($$)
#This are the default values that a device has after factory reset or pairing
if($device_types{$type} =~ /HeatingThermostat.*/) {
Dispatch($shash, "MAX,$isToMe,HeatingThermostatConfig,$src,17,21,30.5,4.5,80,5,0,12,15,100,0,0,12,$defaultWeekProfile", {});
Dispatch($shash, "MAX,$isToMe,HeatingThermostatConfig,$src,17,21,30.5,4.5,$defaultWeekProfile,80,5,0,12,15,100,0,0,12", {});
} elsif($device_types{$type} eq "WallMountedThermostat") {
Dispatch($shash, "MAX,$isToMe,WallThermostatConfig,$src,17,21,30.5,4.5,$defaultWeekProfile", {});
Dispatch($shash, "MAX,$isToMe,WallThermostatConfig,$src,17,21,30.5,4.5,$defaultWeekProfile,80,5,0,12", {});
}
}
} elsif(grep /^$msgType$/, ("ShutterContactState", "WallThermostatState", "WallThermostatControl", "ThermostatState", "PushButtonState")) {