2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-02-07 23:09:26 +00:00

10_ZWave.pm: partial CENTRAL_SCENE

00_ZWDongle: addNode sec attribute


git-svn-id: https://svn.fhem.de/fhem/trunk@8703 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2015-06-06 12:56:01 +00:00
parent 140703c257
commit f065201d5d
2 changed files with 39 additions and 16 deletions

View File

@ -26,9 +26,9 @@ sub ZWave_ProcessSendStack($);
# https://bitbucket.org/bradsjm/aeonzstickdriver # https://bitbucket.org/bradsjm/aeonzstickdriver
my %sets = ( my %sets = (
"addNode" => { cmd => "4a%02x@", # ZW_ADD_NODE_TO_NETWORK' "addNode" => { cmd => "4a%02x@", # ZW_ADD_NODE_TO_NETWORK'
param => {nwOn=>0xc1, on=>0x81, off=>0x05 } }, param => {nwOn=>0xc1, on=>0x81, off=>0x05 } },
"removeNode" => { cmd => "4b%02x@", # ZW_REMOVE_NODE_FROM_NETWORK' "removeNode" => { cmd => "4b%02x@", # ZW_REMOVE_NODE_FROM_NETWORK'
param => {nwOn=>0xc1, on=>0x81, off=>0x05 } }, param => {nwOn=>0xc1, on=>0x81, off=>0x05 } },
"createNode" => { cmd => "60%02x" }, # ZW_REQUEST_NODE_INFO' "createNode" => { cmd => "60%02x" }, # ZW_REQUEST_NODE_INFO'
"removeFailedNode" => { cmd => "61%02x" }, # ZW_REMOVE_FAILED_NODE_ID "removeFailedNode" => { cmd => "61%02x" }, # ZW_REMOVE_FAILED_NODE_ID
"replaceFailedNode"=> { cmd => "63%02x" }, # ZW_REPLACE_FAILED_NODE "replaceFailedNode"=> { cmd => "63%02x" }, # ZW_REPLACE_FAILED_NODE
@ -294,6 +294,15 @@ ZWDongle_Set($@)
$cmd =~ s/\@/$c/g; $cmd =~ s/\@/$c/g;
} }
if($type eq "addNode") {
if(@a == 2 && $a[2] =~ m/^sec/i) {
$hash->{addSecure} = pop(@a);
} else {
delete($hash->{addSecure});
}
Log 1, "CMD:".join("/",@a)."/";
}
my @ca = split("%", $cmd, -1); my @ca = split("%", $cmd, -1);
my $nargs = int(@ca)-1; my $nargs = int(@ca)-1;
return "set $name $type needs $nargs arguments" if($nargs != int(@a)); return "set $name $type needs $nargs arguments" if($nargs != int(@a));
@ -652,9 +661,8 @@ ZWDongle_Read($@)
next; next;
} }
$hash->{nrNAck} = 0; $hash->{nrNAck} = 0;
Log3 $name, 5, "ZWDongle_Read -> sending ACK"; Log3 $name, 5, "ZWDongle_Read $name: ACK, processing $msg";
DevIo_SimpleWrite($hash, "06", 1); # Send ACK DevIo_SimpleWrite($hash, "06", 1); # Send ACK
Log3 $name, 5, "ZWDongle_Read $name: processing $msg";
# SEND_DATA OK: remove message from SendStack. TODO: check the callbackId # SEND_DATA OK: remove message from SendStack. TODO: check the callbackId
if($msg =~ m/^0013..00/ ){ if($msg =~ m/^0013..00/ ){
@ -669,6 +677,7 @@ ZWDongle_Read($@)
last if(defined($local) && (!defined($regexp) || ($msg =~ m/$regexp/))); last if(defined($local) && (!defined($regexp) || ($msg =~ m/$regexp/)));
$hash->{PARTIAL} = $data; # Recursive call by ZWave get, Forum #37418 $hash->{PARTIAL} = $data; # Recursive call by ZWave get, Forum #37418
ZWDongle_Parse($hash, $name, $msg); ZWDongle_Parse($hash, $name, $msg);
$data = $hash->{PARTIAL}; $data = $hash->{PARTIAL};
$msg = undef; $msg = undef;
} }
@ -855,14 +864,17 @@ ZWDongle_Ready($)
<b>Set</b> <b>Set</b>
<ul> <ul>
<li>addNode [nwOn|on|off]<br> <li>addNode [nwOn|on|off] [sec]<br>
Activate (or deactivate) inclusion mode. The controller (i.e. the dongle) Activate (or deactivate) inclusion mode. The controller (i.e. the dongle)
will accept inclusion (i.e. pairing/learning) requests only while in this will accept inclusion (i.e. pairing/learning) requests only while in this
mode. After activating inclusion mode usually you have to press a switch mode. After activating inclusion mode usually you have to press a switch
three times within 1.5 seconds on the node to be included into the network three times within 1.5 seconds on the node to be included into the network
of the controller. If autocreate is active, a fhem device will be created of the controller. If autocreate is active, a fhem device will be created
after inclusion. "on" activates standard inclusion. "nwOn" activates network after inclusion. "on" activates standard inclusion. "nwOn" activates network
wide inclusion (only SDK 4.5-4.9, SDK 6.x and above).</li> wide inclusion (only SDK 4.5-4.9, SDK 6.x and above).<br>
If sec is specified, the ZWDongle networkKey ist set, and the device
supports the SECURITY class, then a secure inclusion is attempted.
</li>
<li>removeNode [nwOn|on|off]<br> <li>removeNode [nwOn|on|off]<br>
Activate (or deactivate) exclusion mode. "on" activates standard exclusion. Activate (or deactivate) exclusion mode. "on" activates standard exclusion.

View File

@ -195,7 +195,10 @@ my %zwave_class = (
ASSOCIATION_GRP_INFO => { id => '59' }, ASSOCIATION_GRP_INFO => { id => '59' },
DEVICE_RESET_LOCALLY => { id => '5a', DEVICE_RESET_LOCALLY => { id => '5a',
parse => { "025a01" => "deviceResetLocally:yes" } }, parse => { "025a01" => "deviceResetLocally:yes" } },
CENTRAL_SCENE => { id => '5b' }, CENTRAL_SCENE => { id => '5b',
parse => { "055b03..00(..)" => '"cSceneSet:".hex($1)',
"055b03..02(..)" => '"cSceneDim:".hex($1)',
"055b03..01(..)" => '"cSceneDimEnd:".hex($1)'} },
IP_ASSOCIATION => { id => '5c' }, IP_ASSOCIATION => { id => '5c' },
ANTITHEFT => { id => '5d' }, ANTITHEFT => { id => '5d' },
ZWAVEPLUS_INFO => { id => '5e', ZWAVEPLUS_INFO => { id => '5e',
@ -1584,14 +1587,17 @@ ZWave_Parse($$@)
return "" if(!$dh); return "" if(!$dh);
$dh->{lastMsgTimestamp} = time(); $dh->{lastMsgTimestamp} = time();
my $classes = AttrVal($dh->{NAME}, "classes", "");
if($classes =~ m/SECURITY/) { if($iodev->{addSecure}) {
my $key = AttrVal($ioName, "networkKey", ""); my $classes = AttrVal($dh->{NAME}, "classes", "");
if($key) { if($classes =~ m/SECURITY/) {
$iodev->{secInitName} = $dh->{NAME}; my $key = AttrVal($ioName, "networkKey", "");
return ZWave_securityInit($dh); if($key) {
} else { $iodev->{secInitName} = $dh->{NAME};
Log3 $ioName, 2, "No secure inclusion as $ioName has no networkKey"; return ZWave_securityInit($dh);
} else {
Log3 $ioName, 2, "No secure inclusion as $ioName has no networkKey";
}
} }
} }
return ZWave_execInits($dh, 0); return ZWave_execInits($dh, 0);
@ -2350,6 +2356,11 @@ s2Hex($)
<br><br><b>Class BATTERY</b> <br><br><b>Class BATTERY</b>
<li>battery:chargelevel %</li> <li>battery:chargelevel %</li>
<br><br><b>Class CENTRAL_SCENE</b>
<li>cSceneSet:X</li>
<li>cSceneDim:X</li>
<li>cSceneDimEnd:X</li>
<br><br><b>Class CLIMATE_CONTROL_SCHEDULE</b> <br><br><b>Class CLIMATE_CONTROL_SCHEDULE</b>
<li>ccsOverride:[no|temporary|permanent], <li>ccsOverride:[no|temporary|permanent],
[frost protection|energy saving|unused]</li> [frost protection|energy saving|unused]</li>