mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-10 09:16:53 +00:00
fhem.pl: next round in the IODev prohibing code (Forum #120603)
git-svn-id: https://svn.fhem.de/fhem/trunk@24724 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
ea0ed5f778
commit
613735e19e
16
fhem/fhem.pl
16
fhem/fhem.pl
@ -2504,8 +2504,8 @@ CommandSetReading($$)
|
|||||||
return "$sdev: bad reading name '$b1' (allowed chars: A-Za-z/\\d_\\.-)"
|
return "$sdev: bad reading name '$b1' (allowed chars: A-Za-z/\\d_\\.-)"
|
||||||
if(!goodReadingName($b1));
|
if(!goodReadingName($b1));
|
||||||
|
|
||||||
|
|
||||||
if($b1 eq "IODev") {
|
if($b1 eq "IODev") {
|
||||||
|
next if(!fhem_devSupportsAttr($sdev, "IODev"));
|
||||||
my $ret = fhem_setIoDev($hash, $b[2]);
|
my $ret = fhem_setIoDev($hash, $b[2]);
|
||||||
push @rets, $ret if($ret);
|
push @rets, $ret if($ret);
|
||||||
next;
|
next;
|
||||||
@ -3203,6 +3203,7 @@ CommandSetstate($$)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if($sname eq "IODev") {
|
if($sname eq "IODev") {
|
||||||
|
next if(!fhem_devSupportsAttr($sdev, "IODev"));
|
||||||
my $ret = fhem_setIoDev($d, $sval);
|
my $ret = fhem_setIoDev($d, $sval);
|
||||||
if($ret) {
|
if($ret) {
|
||||||
push @rets, $ret if($init_done);
|
push @rets, $ret if($init_done);
|
||||||
@ -4692,6 +4693,14 @@ AttrNum($$$;$)
|
|||||||
return $val;
|
return $val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub
|
||||||
|
fhem_devSupportsAttr($$)
|
||||||
|
{
|
||||||
|
my ($devName,$attrName) = @_;
|
||||||
|
my $attrList = getAllAttr($devName);
|
||||||
|
return (" $attrList " =~ m/ $attrName[ :;]/);
|
||||||
|
}
|
||||||
|
|
||||||
################################################################
|
################################################################
|
||||||
# Functions used by modules.
|
# Functions used by modules.
|
||||||
sub
|
sub
|
||||||
@ -4699,10 +4708,7 @@ setReadingsVal($$$$)
|
|||||||
{
|
{
|
||||||
my ($hash,$rname,$val,$ts) = @_;
|
my ($hash,$rname,$val,$ts) = @_;
|
||||||
|
|
||||||
if($rname eq "IODev") {
|
return if($rname eq "IODev" && !fhem_devSupportsAttr($hash->{NAME}, "IODev"));
|
||||||
my $attrList = getAllAttr($hash->{NAME}); # Forum #120603
|
|
||||||
return if(" $attrList " !~ m/ IODev[ :;]/);
|
|
||||||
}
|
|
||||||
|
|
||||||
if($hash->{".or"} && grep($rname =~ m/^$_$/, @{$hash->{".or"}}) ) {
|
if($hash->{".or"} && grep($rname =~ m/^$_$/, @{$hash->{".or"}}) ) {
|
||||||
if(defined($hash->{READINGS}{$rname}) &&
|
if(defined($hash->{READINGS}{$rname}) &&
|
||||||
|
Loading…
x
Reference in New Issue
Block a user