From a02474c05b51e711fbdb8571b7340255e64f80a4 Mon Sep 17 00:00:00 2001 From: rudolfkoenig <> Date: Sun, 23 May 2021 13:15:58 +0000 Subject: [PATCH] fhem.pl: trying to avoid strange IODev set constellations (Forum #121213) git-svn-id: https://svn.fhem.de/fhem/trunk@24495 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/fhem.pl | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/fhem/fhem.pl b/fhem/fhem.pl index bab1b3b26..61524c54b 100755 --- a/fhem/fhem.pl +++ b/fhem/fhem.pl @@ -2479,12 +2479,22 @@ CommandSetReading($$) return "$sdev: bad reading name '$b1' (allowed chars: A-Za-z/\\d_\\.-)" if(!goodReadingName($b1)); + + if($b1 eq "IODev") { + my $ret = fhem_setIoDev($hash, $b[2]); + if($ret) { + push @rets, $ret; + next; + } + } + if($hash->{".updateTime"}) { # Called from userReadings, #110375 Log 1, "'setreading $def' called form userReadings is prohibited"; return; } else { readingsSingleUpdate($hash, $b1, $b[2], 1, $timestamp); } + } return join("\n", @rets); } @@ -2958,6 +2968,10 @@ fhem_setIoDev($$) return "unknown IODev $val specified"; } + return "$hash->{NAME}: not setting IODev to $val, as different attr exists" + if(AttrVal($hash->{NAME}, "IODev", "") ne $val); + + $hash->{IODev} = $defs{$val}; delete($defs{$val}{".clientArray"}); # Force a recompute if(!$init_done) { @@ -3195,6 +3209,14 @@ CommandSetstate($$) next; } + if($sname eq "IODev") { + my $ret = fhem_setIoDev($d, $sval); + if($ret) { + push @rets, $ret if($init_done); + next; + } + } + Log3 $d, 3, "$sdev: bad reading name '$sname' (allowed chars: A-Za-z/\\d_\\.-)" if(!goodReadingName($sname)); @@ -3206,13 +3228,6 @@ CommandSetstate($$) $d->{READINGS}{$sname}{TIME} = $tim; } - if($sname eq "IODev") { - my $ret = fhem_setIoDev($d, $sval); - if($ret) { - push @rets, $ret if($init_done); - next; - } - } } else {