From 2c714aa45a07a03756e64c394a772f4f51e83bc5 Mon Sep 17 00:00:00 2001 From: mgehre <> Date: Tue, 11 Dec 2012 22:43:44 +0000 Subject: [PATCH] MAX: show more configuration, fix adding of measurementOffset git-svn-id: https://svn.fhem.de/fhem/trunk@2317 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/00_MAXLAN.pm | 20 ++++++++++++-------- fhem/FHEM/10_MAX.pm | 10 +++++++++- fhem/FHEM/14_CUL_MAX.pm | 6 +++++- 3 files changed, 26 insertions(+), 10 deletions(-) diff --git a/fhem/FHEM/00_MAXLAN.pm b/fhem/FHEM/00_MAXLAN.pm index d698f2245..40bf09c20 100755 --- a/fhem/FHEM/00_MAXLAN.pm +++ b/fhem/FHEM/00_MAXLAN.pm @@ -521,20 +521,24 @@ MAXLAN_Parse($$) if($devicetype == 0){#Cube #TODO: there is a lot of data left to interpret }elsif($devicetype == 1 or $devicetype == 3){#HeatingThermostat or #WallMountedThermostat - my ($comforttemp,$ecotemp,$maxsetpointtemp,$minsetpointtemp,$tempoffset,$windowopentemp,$windowopendur,$boost,$decalcifiction,$maxvalvesetting,$valveoffset,$weekprofile) = unpack("CCCCCCCCCCCa*",substr($bindata,18)); + my ($comforttemp,$ecotemp,$maxsetpointtemp,$minsetpointtemp,$tempoffset,$windowopentemp,$windowopendur,$boost,$decalcifiction,$maxvalvesetting,$valveoffset,$weekprofile) = unpack("CCCCCCCCCCCH*",substr($bindata,18)); #TODO: parse week profile my $boostValve = ($boost & 0x1F) * 5; my $boostDuration = $boost_durations[$boost >> 5]; #in minutes #There is some trailing data missing, which maps to the weekly program - $comforttemp=$comforttemp/2.0; #convert to degree celcius - $ecotemp=$ecotemp/2.0; #convert to degree celcius + $comforttemp /= 2.0; #convert to degree celcius + $ecotemp /= 2.0; #convert to degree celcius $tempoffset = $tempoffset/2.0-3.5; #convert to degree - $maxsetpointtemp=$maxsetpointtemp/2.0; - $minsetpointtemp=$minsetpointtemp/2.0; - $windowopentemp=$windowopentemp/2.0; - $windowopendur=$windowopendur*5; + $maxsetpointtemp /= 2.0; + $minsetpointtemp /= 2.0; + $windowopentemp /= 2.0; + $windowopendur *= 5; + $maxvalvesetting *= 100/255; + $valveoffset *= 100/255; + 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,ThermostatConfig,$addr,$ecotemp,$comforttemp,$boostValve,$boostDuration,$tempoffset,$maxsetpointtemp,$minsetpointtemp,$windowopentemp,$windowopendur", {RAWMSG => $rmsg}); + Dispatch($hash, "MAX,1,ThermostatConfig,$addr,$ecotemp,$comforttemp,$boostValve,$boostDuration,$tempoffset,$maxsetpointtemp,$minsetpointtemp,$windowopentemp,$windowopendur,$maxvalvesetting,$valveoffset,$decalcDay,$decalcTime,$weekprofile", {RAWMSG => $rmsg}); }elsif($devicetype == 4){#ShutterContact Log 2, "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 d2f4b5ef0..45a9d232b 100755 --- a/fhem/FHEM/10_MAX.pm +++ b/fhem/FHEM/10_MAX.pm @@ -35,6 +35,7 @@ use vars qw(%msgCmd2Id); "01" => "PairPong", "02" => "Ack", "03" => "TimeInformation", + "10" => "ConfigWeekProfile", "11" => "ConfigTemperatures", #like boost/eco/comfort etc "30" => "ShutterContactState", "42" => "WallThermostatState", #by WallMountedThermostat @@ -49,6 +50,8 @@ use vars qw(%msgCmd2Id); ); %msgCmd2Id = reverse %msgId2Cmd; +my @decalcDays = ("Sat", "Sun", "Mon", "Tue", "Wed", "Thu", "Fri"); + my %interfaces = ( "Cube" => undef, "HeatingThermostat" => "thermostat;battery;temperature", @@ -366,7 +369,7 @@ MAX_Parse($$) #The HeatingThermostat uses the measurementOffset during control #but does not apply it to measuredTemperature before sending it to us - my $measOffset = ReadingsVal($hash->{NAME},"measurementOffset",""); + my $measOffset = ReadingsVal($shash->{NAME},"measurementOffset",""); $measuredTemperature += $measOffset if($measuredTemperature ne "" and $measOffset ne ""); $shash->{mode} = $mode; @@ -429,6 +432,11 @@ MAX_Parse($$) readingsBulkUpdate($shash, "minimumTemperature", $args[6]); readingsBulkUpdate($shash, "windowOpenTemperature", $args[7]); readingsBulkUpdate($shash, "windowOpenDuration", $args[8]) if($shash->{type} eq "HeatingThermostat"); + readingsBulkUpdate($shash, "maxValveSetting", $args[9]); + readingsBulkUpdate($shash, "valveOffset", $args[10]); + readingsBulkUpdate($shash, "decalcification", "$decalcDays[$args[11]], $args[12]:00"); + #readingsBulkUpdate($shash, "weekProfile", "$args[13]"); + $shash->{internal}{weekProfile} = $args[13]; readingsEndUpdate($shash, 0); } elsif($msgtype eq "Error") { diff --git a/fhem/FHEM/14_CUL_MAX.pm b/fhem/FHEM/14_CUL_MAX.pm index 9c87e4283..b49a80044 100644 --- a/fhem/FHEM/14_CUL_MAX.pm +++ b/fhem/FHEM/14_CUL_MAX.pm @@ -129,7 +129,11 @@ CUL_MAX_Parse($$) $rmsg =~ m/Z(..)(..)(..)(..)(......)(......)(..)(.*)/; my ($len,$msgcnt,$msgFlag,$msgTypeRaw,$src,$dst,$groupid,$payload) = ($1,$2,$3,$4,$5,$6,$7,$8); $len = hex($len); - Log 1, "CUL_MAX_Parse: len mismatch" if(2*$len+3 != length($rmsg)); #+3 = +1 for 'Z' and +2 for len field in hex + if(2*$len+3 != length($rmsg)) { #+3 = +1 for 'Z' and +2 for len field in hex + my $msg = "CUL_MAX_Parse: len mismatch"; + Log 1, $msg; + return $msg; + } $groupid = hex($groupid);