From f27639b288544f73893164b6b8723cf05004d76c Mon Sep 17 00:00:00 2001 From: mgehre <> Date: Sun, 2 Dec 2012 23:27:31 +0000 Subject: [PATCH] MAX: remember if a device is paired to the MAXLAN or CUL_MAX git-svn-id: https://svn.fhem.de/fhem/trunk@2253 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/00_MAXLAN.pm | 7 +++---- fhem/FHEM/10_MAX.pm | 7 +++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/fhem/FHEM/00_MAXLAN.pm b/fhem/FHEM/00_MAXLAN.pm index e746ae87e..26186c344 100755 --- a/fhem/FHEM/00_MAXLAN.pm +++ b/fhem/FHEM/00_MAXLAN.pm @@ -377,7 +377,7 @@ MAXLAN_Parse($$) Log 3, "Time difference is $difference minutes"; } - Dispatch($hash, "MAX,define,$hash->{rfaddr},Cube,$hash->{serial}", {RAWMSG => $rmsg}); + Dispatch($hash, "MAX,define,$hash->{rfaddr},Cube,$hash->{serial},0,1", {RAWMSG => $rmsg}); Dispatch($hash, "MAX,CubeConnectionState,$hash->{rfaddr},1", {RAWMSG => $rmsg}); Dispatch($hash, "MAX,CubeClockState,$hash->{rfaddr},$clockset", {RAWMSG => $rmsg}); Log $ll5, "MAXLAN_Parse: Got hello, connection ip $args[4], duty cycle $dutycycle, freememory $freememory, clockset $clockset"; @@ -424,7 +424,6 @@ MAXLAN_Parse($$) $hash->{devices}[-1]->{serial} = $groupsdevices[$i+2]; $hash->{devices}[-1]->{name} = $groupsdevices[$i+3]; $hash->{devices}[-1]->{groupid} = $groupsdevices[$i+4]; - Dispatch($hash, "MAX,define,$hash->{devices}[-1]->{addr},$device_types{$hash->{devices}[-1]->{type}},$hash->{devices}[-1]->{serial},$hash->{devices}[-1]->{groupid}", {RAWMSG => $rmsg}); } #Log $ll5, "Got Metadata, hash: ".Dumper($hash); @@ -444,7 +443,7 @@ MAXLAN_Parse($$) $len = $len+1; #The len field itself was not counted - Dispatch($hash, "MAX,define,$addr,$device_types{$devicetype},$serial,$groupid", {RAWMSG => $rmsg}); + Dispatch($hash, "MAX,define,$addr,$device_types{$devicetype},$serial,$groupid,1", {RAWMSG => $rmsg}); if($len != length($bindata)) { Dispatch($hash, "MAX,Error,$addr,Parts of configuration are missing", {RAWMSG => $rmsg}); @@ -538,7 +537,7 @@ MAXLAN_Parse($$) } my ($type, $addr, $serial) = unpack("CH6a[10]", decode_base64($args[0])); Log 2, "Paired new device, type $device_types{$type}, addr $addr, serial $serial"; - Dispatch($hash, "MAX,define,$addr,$device_types{$type},$serial", {RAWMSG => $rmsg}); + Dispatch($hash, "MAX,define,$addr,$device_types{$type},$serial,0,1", {RAWMSG => $rmsg}); #After a device has been paired, it automatically appears in the "L" and "C" commands, MAXLAN_RequestConfiguration($hash,$addr); diff --git a/fhem/FHEM/10_MAX.pm b/fhem/FHEM/10_MAX.pm index ba878b62b..6ee80fa89 100755 --- a/fhem/FHEM/10_MAX.pm +++ b/fhem/FHEM/10_MAX.pm @@ -56,6 +56,7 @@ MAX_Define($$) $hash->{type} = $type; $hash->{addr} = $addr; $hash->{STATE} = "waiting for data"; + $hash->{isMAXLAN} = 0; $modules{MAX}{defptr}{$addr} = $hash; $hash->{internals}{interfaces} = $interfaces{$type}; @@ -232,10 +233,8 @@ MAX_Parse($$) Log 1, "Device changed serial from $shash->{serial} to $serial" if($shash->{serial} and ($shash->{serial} ne $serial)); $shash->{serial} = $serial; } - if(@args > 2){ - my $groupid = $args[2]; - $shash->{groupid} = $groupid; - } + $shash->{groupid} = $args[2]; + $shash->{isMAXLAN} = $args[3]; } elsif($msgtype eq "HeatingThermostatState") {