mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-04 22:19:38 +00:00
32_yowsup.pm: support new allowed modell (see forum: http://forum.fhem.de/index.php/topic,46380.msg381374.html#msg381374)
git-svn-id: https://svn.fhem.de/fhem/trunk@10302 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
e0c1a0bca3
commit
779b68525b
@ -450,8 +450,7 @@ yowsup_Parse($$)
|
|||||||
if( !$accept_from || $last_sender || ",$accept_from," =~/,$last_sender,/ ) {
|
if( !$accept_from || $last_sender || ",$accept_from," =~/,$last_sender,/ ) {
|
||||||
Log3 $name, 3, "$cname: received command: $cmd";
|
Log3 $name, 3, "$cname: received command: $cmd";
|
||||||
|
|
||||||
my $allowed = AttrVal($cname, "allowedCommands", undef );
|
my $ret = AnalyzeCommandChain( $hash, $cmd );
|
||||||
my $ret = AnalyzeCommandChain( $hash, $cmd, $allowed );
|
|
||||||
|
|
||||||
Log3 $name, 4, "$cname: command result: $ret";
|
Log3 $name, 4, "$cname: command result: $ret";
|
||||||
|
|
||||||
@ -531,11 +530,21 @@ yowsup_Write($$)
|
|||||||
sub
|
sub
|
||||||
yowsup_Attr($$$)
|
yowsup_Attr($$$)
|
||||||
{
|
{
|
||||||
my ($cmd, $name, $attrName, $attrVal) = @_;
|
my ($cmd, $name, $attrName, @params) = @_;
|
||||||
|
my ($attrVal) = @params;
|
||||||
|
|
||||||
my $orig = $attrVal;
|
my $orig = $attrVal;
|
||||||
|
|
||||||
if( $attrName eq "disable" ) {
|
if($attrName eq "allowedCommands" && $cmd eq "set") {
|
||||||
|
my $aName = "allowed_$name";
|
||||||
|
my $exists = ($defs{$aName} ? 1 : 0);
|
||||||
|
AnalyzeCommand(undef, "defmod $aName allowed");
|
||||||
|
AnalyzeCommand(undef, "attr $aName validFor $name");
|
||||||
|
AnalyzeCommand(undef, "attr $aName $attrName ".join(" ",@params));
|
||||||
|
return "$name: ".($exists ? "modifying":"creating").
|
||||||
|
" device $aName for attribute $attrName";
|
||||||
|
|
||||||
|
} elsif( $attrName eq "disable" ) {
|
||||||
my $hash = $defs{$name};
|
my $hash = $defs{$name};
|
||||||
yowsup_Disconnect($hash);
|
yowsup_Disconnect($hash);
|
||||||
if( $cmd eq "set" && $attrVal ne "0" ) {
|
if( $cmd eq "set" && $attrVal ne "0" ) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user