mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-04 22:19:38 +00:00
MULTI_CHANNEL support
git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@2765 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
64f540bf7e
commit
f1f1103994
1
CHANGED
1
CHANGED
@ -81,6 +81,7 @@
|
|||||||
change in css!
|
change in css!
|
||||||
- feature: floorplan added js-extension from Dirk
|
- feature: floorplan added js-extension from Dirk
|
||||||
- feature: hour resolution in SVG
|
- feature: hour resolution in SVG
|
||||||
|
- feature: ZWave support for MULTI_CHANNEL class
|
||||||
|
|
||||||
- 2012-10-28 (5.3)
|
- 2012-10-28 (5.3)
|
||||||
- feature: added functions trim, ltrim, rtrim, UntoggleDirect,
|
- feature: added functions trim, ltrim, rtrim, UntoggleDirect,
|
||||||
|
@ -257,7 +257,7 @@ ZWDongle_Get($@)
|
|||||||
my $nargs = int(split("%", $gets{$type}, -1))-1;
|
my $nargs = int(split("%", $gets{$type}, -1))-1;
|
||||||
return "get $name $type needs $nargs arguments" if($nargs != int(@a));
|
return "get $name $type needs $nargs arguments" if($nargs != int(@a));
|
||||||
|
|
||||||
return "No $a[1] for dummies" if(IsDummy($name));
|
return "No $type for dummies" if(IsDummy($name));
|
||||||
|
|
||||||
ZWDongle_Write($hash, "00", sprintf($gets{$type}, @a));
|
ZWDongle_Write($hash, "00", sprintf($gets{$type}, @a));
|
||||||
my $re = "^01".substr($gets{$type},0,2); # Start with <01><len><01><CMD>
|
my $re = "^01".substr($gets{$type},0,2); # Start with <01><len><01><CMD>
|
||||||
|
@ -88,7 +88,13 @@ my %zwave_class = (
|
|||||||
THERMOSTAT_SETBACK => { id => '47', },
|
THERMOSTAT_SETBACK => { id => '47', },
|
||||||
BASIC_WINDOW_COVERING => { id => '50', },
|
BASIC_WINDOW_COVERING => { id => '50', },
|
||||||
MTP_WINDOW_COVERING => { id => '51', },
|
MTP_WINDOW_COVERING => { id => '51', },
|
||||||
MULTI_INSTANCE => { id => '60', },
|
MULTI_CHANNEL => { id => '60', # Version 2!
|
||||||
|
get => { mcEndpoints => "07", # Endpoints
|
||||||
|
mcCapability=> "09%02x"},
|
||||||
|
parse => { "^046008(..)(..)" => '"mcEndpoints:total ".hex($2).'.
|
||||||
|
'(hex($1)&0x80 ? ", dynamic":"").'.
|
||||||
|
'(hex($1)&0x40 ? ", identical":", different")',
|
||||||
|
"^..600a(.*)"=> 'ZWave_mcCapability($hash, $1)' }, },
|
||||||
DOOR_LOCK => { id => '62', },
|
DOOR_LOCK => { id => '62', },
|
||||||
USER_CODE => { id => '63', },
|
USER_CODE => { id => '63', },
|
||||||
CONFIGURATION => { id => '70',
|
CONFIGURATION => { id => '70',
|
||||||
@ -120,16 +126,17 @@ my %zwave_class = (
|
|||||||
get => { wakeupInterval => "05" },
|
get => { wakeupInterval => "05" },
|
||||||
parse => { "028407" => 'wakeup:notification',
|
parse => { "028407" => 'wakeup:notification',
|
||||||
"..8406(......)(..)" =>
|
"..8406(......)(..)" =>
|
||||||
'"wakeupReport:interval:".hex($1)." target:".hex($2)',}, },
|
'"wakeupReport:interval ".hex($1)." target ".hex($2)',}, },
|
||||||
ASSOCIATION => { id => '85',
|
ASSOCIATION => { id => '85',
|
||||||
set => { associationAdd => "01%02x%02x*",
|
set => { associationAdd => "01%02x%02x*",
|
||||||
associationDel => "04%02x%02x*", },
|
associationDel => "04%02x%02x*", },
|
||||||
get => { association => "02%02x", },
|
get => { association => "02%02x", },
|
||||||
parse => { "..8503(..)(..)..(.*)" => '"assocGroup_$1:Max:$2 Nodes:$3"',}, },
|
parse => { "..8503(..)(..)..(.*)" => '"assocGroup_$1:Max $2 Nodes $3"',}, },
|
||||||
VERSION => { id => '86',
|
VERSION => { id => '86',
|
||||||
get => { version => "11", },
|
get => { version => "11", },
|
||||||
parse => { "078612(..)(..)(..)(..)(..)" =>
|
parse => { "078612(..)(..)(..)(..)(..)" =>
|
||||||
'sprintf("Lib:%d Prot:%d.%d App:%d.%d",hex($1),hex($2),hex($3),hex($4),hex($5))', } },
|
'sprintf("version:Lib %d Prot %d.%d App %d.%d",'.
|
||||||
|
'hex($1),hex($2),hex($3),hex($4),hex($5))', } },
|
||||||
INDICATOR => { id => '87', },
|
INDICATOR => { id => '87', },
|
||||||
PROPRIETARY => { id => '88', },
|
PROPRIETARY => { id => '88', },
|
||||||
LANGUAGE => { id => '89', },
|
LANGUAGE => { id => '89', },
|
||||||
@ -138,7 +145,7 @@ my %zwave_class = (
|
|||||||
COMPOSITE => { id => '8D', },
|
COMPOSITE => { id => '8D', },
|
||||||
MULTI_CMD => { id => '8F', },
|
MULTI_CMD => { id => '8F', },
|
||||||
TIME => { id => '8a', },
|
TIME => { id => '8a', },
|
||||||
MULTI_INSTANCE_ASSOCIATION => { id => '8E', },
|
MULTI_CHANNEL_ASSOCIATION=> { id => '8E', },
|
||||||
ENERGY_PRODUCTION => { id => '90', },
|
ENERGY_PRODUCTION => { id => '90', },
|
||||||
MANUFACTURER_PROPRIETARY => { id => '91', },
|
MANUFACTURER_PROPRIETARY => { id => '91', },
|
||||||
SCREEN_MD => { id => '92', },
|
SCREEN_MD => { id => '92', },
|
||||||
@ -200,7 +207,7 @@ ZWave_Define($$)
|
|||||||
return "define $name: wrong id ($id): need a number"
|
return "define $name: wrong id ($id): need a number"
|
||||||
if( ($id !~ m/^\d+$/i) );
|
if( ($id !~ m/^\d+$/i) );
|
||||||
|
|
||||||
$id = sprintf("%02x", $id);
|
$id = sprintf("%0*x", ($id > 255 ? 4 : 2), $id);
|
||||||
$hash->{homeId} = $homeId;
|
$hash->{homeId} = $homeId;
|
||||||
$hash->{id} = $id;
|
$hash->{id} = $id;
|
||||||
|
|
||||||
@ -289,6 +296,15 @@ ZWave_Cmd($$@)
|
|||||||
return "$type $cmd needs $parTxt" if($nArg != int(@a));
|
return "$type $cmd needs $parTxt" if($nArg != int(@a));
|
||||||
}
|
}
|
||||||
$cmdFmt = sprintf($cmdFmt, @a) if($nArg);
|
$cmdFmt = sprintf($cmdFmt, @a) if($nArg);
|
||||||
|
|
||||||
|
if($id =~ m/(..)(..)/) { # Multi-Channel, encapsulate
|
||||||
|
my ($lid,$ch) = ($1, $2);
|
||||||
|
$id = $lid;
|
||||||
|
$cmdFmt = "0d01$ch$cmdId$cmdFmt";
|
||||||
|
$cmdId = "60"; # MULTI_CHANNEL
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
my $len = sprintf("%02x", length($cmdFmt)/2+1);
|
my $len = sprintf("%02x", length($cmdFmt)/2+1);
|
||||||
|
|
||||||
my $data = "13$id$len$cmdId${cmdFmt}05";
|
my $data = "13$id$len$cmdId${cmdFmt}05";
|
||||||
@ -379,6 +395,38 @@ ZWave_SetClasses($$$$)
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub
|
||||||
|
ZWave_mcCapability($$)
|
||||||
|
{
|
||||||
|
my ($hash, $caps) = @_;
|
||||||
|
|
||||||
|
my $name = $hash->{NAME};
|
||||||
|
my $iodev = $hash->{IODev};
|
||||||
|
return "Missing IODev for $name" if(!$iodev);
|
||||||
|
|
||||||
|
my $homeId = $iodev->{homeId};
|
||||||
|
my @l = grep /../, split(/(..)/, lc($caps));
|
||||||
|
my $chid = shift(@l);
|
||||||
|
my $id = $hash->{id};
|
||||||
|
|
||||||
|
my @classes;
|
||||||
|
for my $classId (@l) {
|
||||||
|
push @classes, $zwave_id2class{$classId} if($zwave_id2class{$classId});
|
||||||
|
}
|
||||||
|
return "mcCapability_$chid:no classes" if(!@classes);
|
||||||
|
|
||||||
|
if(hex($chid) > 1 && !$modules{ZWave}{defptr}{"$homeId $id$chid"}) {
|
||||||
|
my $lid = hex("$id$chid");
|
||||||
|
my $lcaps = substr($caps, 2);
|
||||||
|
$id = hex($id);
|
||||||
|
DoTrigger("global",
|
||||||
|
"UNDEFINED ZWave_$classes[0]_$id.$chid ZWave $homeId $lid $caps",
|
||||||
|
1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return "mcCapability_$chid:".join(" ", @classes);
|
||||||
|
}
|
||||||
|
|
||||||
###################################
|
###################################
|
||||||
# 0004000a03250300 (sensor binary off for id 11)
|
# 0004000a03250300 (sensor binary off for id 11)
|
||||||
sub
|
sub
|
||||||
@ -434,7 +482,14 @@ ZWave_Parse($$@)
|
|||||||
|
|
||||||
######################################
|
######################################
|
||||||
# device messages
|
# device messages
|
||||||
return "" if($cmd ne "APPLICATION_COMMAND_HANDLER" || $arg !~ m/^..(..)/);
|
return "" if($cmd ne "APPLICATION_COMMAND_HANDLER");
|
||||||
|
|
||||||
|
if($arg =~ /^..600d(..)(..)(.*)/) { # MULTI_CHANNEL CMD_ENCAP
|
||||||
|
$id = "$id$1";
|
||||||
|
$arg = sprintf("%02x$3", length($3)/2);
|
||||||
|
}
|
||||||
|
|
||||||
|
return if($arg !~ m/^..(..)/);
|
||||||
my $class = $1;
|
my $class = $1;
|
||||||
my $hash = $modules{ZWave}{defptr}{"$homeId $id"};
|
my $hash = $modules{ZWave}{defptr}{"$homeId $id"};
|
||||||
if(!$hash) {
|
if(!$hash) {
|
||||||
@ -633,19 +688,32 @@ ZWave_Undef($$)
|
|||||||
<br><br><b>Class WAKE_UP</b>
|
<br><br><b>Class WAKE_UP</b>
|
||||||
<li>wakeupInterval<br>
|
<li>wakeupInterval<br>
|
||||||
return the wakeup interval in seconds, in the form<br>
|
return the wakeup interval in seconds, in the form<br>
|
||||||
wakeupReport:interval:seconds target:id
|
wakeupReport:interval seconds target id
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<br><br><b>Class ASSOCIATION</b>
|
<br><br><b>Class ASSOCIATION</b>
|
||||||
<li>association groupId<br>
|
<li>association groupId<br>
|
||||||
return the list of nodeIds in the association group groupId in the form:<br>
|
return the list of nodeIds in the association group groupId in the form:<br>
|
||||||
assocGroup_X:Max:Y Nodes:id,id...
|
assocGroup_X:Max Y, Nodes id,id...
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<br><br><b>Class VERSION</b>
|
<br><br><b>Class VERSION</b>
|
||||||
<li>version<br>
|
<li>version<br>
|
||||||
return the version information of this node in the form:<br>
|
return the version information of this node in the form:<br>
|
||||||
Lib:A Prot:x.y App:a.b
|
Lib A Prot x.y App a.b
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<br><br><b>Class MULTI_CHANNEL</b>
|
||||||
|
<li>mcEndpoints<br>
|
||||||
|
return the list of endpoints available, e.g.:<br>
|
||||||
|
mcEndpoints: total 2, identical
|
||||||
|
</li>
|
||||||
|
<li>mcCapability chid<br>
|
||||||
|
return the classes supported by the endpoint/channel chid. If the channel
|
||||||
|
does not exists, create a FHEM node for it. Example:<br>
|
||||||
|
mcCapability_02:SWITCH_BINARY<br>
|
||||||
|
<b>Note:</b> This is the best way to create the secondary nodes of a
|
||||||
|
MULTI_CHANNEL device. The device is only created for channel 2 or greater.
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
@ -709,16 +777,17 @@ ZWave_Undef($$)
|
|||||||
<li>wakeupReport:interval:X target:Y</li>
|
<li>wakeupReport:interval:X target:Y</li>
|
||||||
|
|
||||||
<br><br><b>Class ASSOCIATION</b>
|
<br><br><b>Class ASSOCIATION</b>
|
||||||
<li>assocGroup_X:Max:Y Nodes:A,B,...</li>
|
<li>assocGroup_X:Max Y Nodes A,B,...</li>
|
||||||
|
|
||||||
<br><br><b>Class VERSION</b>
|
<br><br><b>Class VERSION</b>
|
||||||
<li>Lib:A Prot:x.y App:a.b</li>
|
<li>version:Lib A Prot x.y App a.b</li>
|
||||||
|
|
||||||
|
<br><br><b>Class MULTI_CHANNEL</b>
|
||||||
|
<li>endpoints:total X $dynamic $identical</li>
|
||||||
|
<li>mcCapability_X:class1 class2 ...</li>
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
=end html
|
=end html
|
||||||
=cut
|
=cut
|
||||||
|
Loading…
x
Reference in New Issue
Block a user