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

MAX: remove RAWMSG from $hash

git-svn-id: https://svn.fhem.de/fhem/trunk@4178 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
mgehre 2013-11-08 10:44:31 +00:00
parent dccaebfff0
commit cc9119eaec
2 changed files with 23 additions and 23 deletions

View File

@ -221,7 +221,7 @@ MAXLAN_Set($@)
my $time = time()-946684774;
my $rmsg = "v:".$timezones.",".sprintf("%08x",$time);
my $ret = MAXLAN_Write($hash,$rmsg, "A:");
Dispatch($hash, "MAX,1,CubeClockState,$hash->{rfaddr},1", {RAWMSG => $rmsg}) if(!$ret);
Dispatch($hash, "MAX,1,CubeClockState,$hash->{rfaddr},1", {}) if(!$ret);
return $ret;
}elsif($setting eq "factoryReset") {
@ -476,10 +476,10 @@ MAXLAN_Parse($$)
Log 2, "MAXLAN_Parse: Cube has no time set";
}
Dispatch($hash, "MAX,1,define,$hash->{rfaddr},Cube,$hash->{serial},0,1", {RAWMSG => $rmsg});
Dispatch($hash, "MAX,1,CubeConnectionState,$hash->{rfaddr},1", {RAWMSG => $rmsg});
Dispatch($hash, "MAX,1,CubeClockState,$hash->{rfaddr},$clockset", {RAWMSG => $rmsg});
Dispatch($hash, "MAX,1,CubeDutyCycleState,$hash->{rfaddr},$dutycycle", {RAWMSG => $rmsg});
Dispatch($hash, "MAX,1,define,$hash->{rfaddr},Cube,$hash->{serial},0,1", {});
Dispatch($hash, "MAX,1,CubeConnectionState,$hash->{rfaddr},1", {});
Dispatch($hash, "MAX,1,CubeClockState,$hash->{rfaddr},$clockset", {});
Dispatch($hash, "MAX,1,CubeDutyCycleState,$hash->{rfaddr},$dutycycle", {});
Log $ll5, "MAXLAN_Parse: Got hello, connection ip $args[4], duty cycle $dutycycle, freememory $freememory, clockset $clockset";
} elsif($cmd eq 'M') {
@ -544,10 +544,10 @@ MAXLAN_Parse($$)
$len = $len+1; #The len field itself was not counted
$groupid = 0 if($device_types{$devicetype} eq "Cube"); #That field does not mean "groupid" for Cube
Dispatch($hash, "MAX,1,define,$addr,$device_types{$devicetype},$serial,$groupid,1", {RAWMSG => $rmsg});
Dispatch($hash, "MAX,1,define,$addr,$device_types{$devicetype},$serial,$groupid,1", {});
if($len != length($bindata)) {
Dispatch($hash, "MAX,1,Error,$addr,Parts of configuration are missing", {RAWMSG => $rmsg});
Dispatch($hash, "MAX,1,Error,$addr,Parts of configuration are missing", {});
return $name;
}
@ -573,7 +573,7 @@ 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", {RAWMSG => $rmsg});
Dispatch($hash, "MAX,1,HeatingThermostatConfig,$addr,$ecotemp,$comforttemp,$maxsetpointtemp,$minsetpointtemp,$boostValve,$boostDuration,$tempoffset,$windowopentemp,$windowopendur,$maxvalvesetting,$valveoffset,$decalcDay,$decalcTime,$weekprofile", {});
}elsif($device_types{$devicetype} eq "WallMountedThermostat"){
my ($comforttemp,$ecotemp,$maxsetpointtemp,$minsetpointtemp,$weekprofile) = unpack("CCCCH*",substr($bindata,18));
@ -582,7 +582,7 @@ MAXLAN_Parse($$)
$maxsetpointtemp /= 2.0;
$minsetpointtemp /= 2.0;
Log $ll5, "comfortemp $comforttemp, ecotemp $ecotemp, minsetpointtemp $minsetpointtemp, maxsetpointtemp $maxsetpointtemp";
Dispatch($hash, "MAX,1,WallThermostatConfig,$addr,$ecotemp,$comforttemp,$maxsetpointtemp,$minsetpointtemp,$weekprofile", {RAWMSG => $rmsg});
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);
@ -593,7 +593,7 @@ MAXLAN_Parse($$)
}
#Clear Error
Dispatch($hash, "MAX,1,Error,$addr", {RAWMSG => $rmsg});
Dispatch($hash, "MAX,1,Error,$addr", {});
#Check if it is already recorded in devices
my $found = 0;
@ -633,13 +633,13 @@ MAXLAN_Parse($$)
if(!$shash) {
Log 2, "Got List response for undefined device with addr $addr";
}elsif($shash->{type} =~ /HeatingThermostat.*/){
Dispatch($hash, "MAX,1,ThermostatState,$addr,$payload", {RAWMSG => $rmsg});
Dispatch($hash, "MAX,1,ThermostatState,$addr,$payload", {});
}elsif($shash->{type} eq "WallMountedThermostat"){
Dispatch($hash, "MAX,1,WallThermostatState,$addr,$payload", {RAWMSG => $rmsg});
Dispatch($hash, "MAX,1,WallThermostatState,$addr,$payload", {});
}elsif($shash->{type} eq "ShutterContact"){
Dispatch($hash, "MAX,1,ShutterContactState,$addr,$payload", {RAWMSG => $rmsg});
Dispatch($hash, "MAX,1,ShutterContactState,$addr,$payload", {});
}elsif($shash->{type} eq "PushButton"){
Dispatch($hash, "MAX,1,PushButtonState,$addr,$payload", {RAWMSG => $rmsg});
Dispatch($hash, "MAX,1,PushButtonState,$addr,$payload", {});
}else{
Log 2, "MAXLAN_Parse: Got status for unimplemented device type $shash->{type}";
}
@ -655,7 +655,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", {RAWMSG => $rmsg});
Dispatch($hash, "MAX,1,define,$addr,$device_types{$type},$serial,0,1", {});
#After a device has been paired, it automatically appears in the "L" and "C" commands,
MAXLAN_RequestConfiguration($hash,$addr);
@ -663,7 +663,7 @@ MAXLAN_Parse($$)
} elsif($cmd eq "S"){#Response to s:
$hash->{dutycycle} = hex($args[0]); #number of command send over the air
Dispatch($hash, "MAX,1,CubeDutyCycleState,$hash->{rfaddr},$hash->{dutycycle}", {RAWMSG => $rmsg});
Dispatch($hash, "MAX,1,CubeDutyCycleState,$hash->{rfaddr},$hash->{dutycycle}", {});
my $discarded = $args[1];
$hash->{freememoryslot} = $args[2];
Log 5, "MAXLAN_Parse: dutycyle $hash->{dutycycle}, freememoryslot $hash->{freememoryslot}";
@ -771,7 +771,7 @@ MAXLAN_Send(@)
my $ret = MAXLAN_Write($hash,"s:".encode_base64($payload,""), "S:");
#TODO: actually check return value
if(defined($opts{callbackParam})) {
Dispatch($hash, "MAX,1,Ack$cmd,$dst,$opts{callbackParam}", {RAWMSG => ""});
Dispatch($hash, "MAX,1,Ack$cmd,$dst,$opts{callbackParam}", {});
}
#Reschedule a poll in the near future after the cube will
#have gotten an answer

View File

@ -270,7 +270,7 @@ CUL_MAX_Parse($$)
return $shash->{NAME} if($src eq CUL_MAX_fakeWTaddr($hash));
return $shash->{NAME} if($src eq CUL_MAX_fakeSCaddr($hash));
Dispatch($shash, "MAX,$isToMe,Ack,$src,$payload", {RAWMSG => $rmsg});
Dispatch($shash, "MAX,$isToMe,Ack,$src,$payload", {});
return $shash->{NAME} if(!@{$shash->{sendQueue}}); #we are not waiting for any Ack
@ -322,7 +322,7 @@ 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", {RAWMSG => $rmsg});
Dispatch($shash, "MAX,$isToMe,define,$src,$device_types{$type},$serial,0,0", {});
#Send after dispatch the define, otherwise Send will create an invalid device
CUL_MAX_Send($shash, "PairPong", $src, "00");
@ -330,13 +330,13 @@ 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", {RAWMSG => $rmsg});
Dispatch($shash, "MAX,$isToMe,HeatingThermostatConfig,$src,17,21,30.5,4.5,80,5,0,12,15,100,0,0,12,$defaultWeekProfile", {});
} elsif($device_types{$type} eq "WallMountedThermostat") {
Dispatch($shash, "MAX,$isToMe,WallThermostatConfig,$src,17,21,30.5,4.5,$defaultWeekProfile", {RAWMSG => $rmsg});
Dispatch($shash, "MAX,$isToMe,WallThermostatConfig,$src,17,21,30.5,4.5,$defaultWeekProfile", {});
}
}
} elsif(grep /^$msgType$/, ("ShutterContactState", "WallThermostatState", "WallThermostatControl", "ThermostatState", "PushButtonState")) {
Dispatch($shash, "MAX,$isToMe,$msgType,$src,$payload", {RAWMSG => $rmsg});
Dispatch($shash, "MAX,$isToMe,$msgType,$src,$payload", {});
} else {
Log $ll5, "Unhandled message $msgType";
}
@ -503,7 +503,7 @@ CUL_MAX_SendQueueHandler($$)
} elsif( $packet->{sent} == 2 ) { #Got ack
if(defined($packet->{callbackParam})) {
Dispatch($hash, "MAX,1,Ack$packet->{cmd},$packet->{dst},$packet->{callbackParam}", {RAWMSG => ""});
Dispatch($hash, "MAX,1,Ack$packet->{cmd},$packet->{dst},$packet->{callbackParam}", {});
}
splice @{$hash->{sendQueue}}, $pktIdx, 1; #Remove from array