diff --git a/fhem/FHEM/00_MAXLAN.pm b/fhem/FHEM/00_MAXLAN.pm index 32a08f242..14ca97efd 100755 --- a/fhem/FHEM/00_MAXLAN.pm +++ b/fhem/FHEM/00_MAXLAN.pm @@ -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); diff --git a/fhem/FHEM/10_MAX.pm b/fhem/FHEM/10_MAX.pm index 73dc5371c..4ac58064f 100755 --- a/fhem/FHEM/10_MAX.pm +++ b/fhem/FHEM/10_MAX.pm @@ -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) { diff --git a/fhem/FHEM/14_CUL_MAX.pm b/fhem/FHEM/14_CUL_MAX.pm index 5529d2c15..ad23f58dc 100644 --- a/fhem/FHEM/14_CUL_MAX.pm +++ b/fhem/FHEM/14_CUL_MAX.pm @@ -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")) {