mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-25 22:09:21 +00:00
structure: relativeKnown fix
git-svn-id: https://svn.fhem.de/fhem/trunk@4051 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
cc480aa578
commit
0bfa50910b
@ -208,7 +208,10 @@ sub structure_Notify($$)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(defined($devstate)) {
|
if(defined($devstate)) {
|
||||||
return "" if(!$priority{$devstate} && $behavior eq "relativeKnown");
|
if(!$priority{$devstate} && $behavior eq "relativeKnown") {
|
||||||
|
delete($hash->{INNTFY});
|
||||||
|
return "";
|
||||||
|
}
|
||||||
$minprio = $priority{$devstate}
|
$minprio = $priority{$devstate}
|
||||||
if($priority{$devstate} && $priority{$devstate} < $minprio);
|
if($priority{$devstate} && $priority{$devstate} < $minprio);
|
||||||
$clientstate{$devstate} = 1;
|
$clientstate{$devstate} = 1;
|
||||||
@ -218,7 +221,10 @@ sub structure_Notify($$)
|
|||||||
} else {
|
} else {
|
||||||
$devstate = ReadingsVal($d, "state", undef);
|
$devstate = ReadingsVal($d, "state", undef);
|
||||||
if(defined($devstate)) {
|
if(defined($devstate)) {
|
||||||
return "" if(!$priority{$devstate} && $behavior eq "relativeKnown");
|
if(!$priority{$devstate} && $behavior eq "relativeKnown") {
|
||||||
|
delete($hash->{INNTFY});
|
||||||
|
return "";
|
||||||
|
}
|
||||||
$minprio = $priority{$devstate}
|
$minprio = $priority{$devstate}
|
||||||
if($priority{$devstate} && $priority{$devstate} < $minprio);
|
if($priority{$devstate} && $priority{$devstate} < $minprio);
|
||||||
$clientstate{$devstate} = 1;
|
$clientstate{$devstate} = 1;
|
||||||
@ -232,7 +238,7 @@ sub structure_Notify($$)
|
|||||||
my @cKeys = keys %clientstate;
|
my @cKeys = keys %clientstate;
|
||||||
$newState = (@cKeys == 1 ? $cKeys[0] : "undefined");
|
$newState = (@cKeys == 1 ? $cKeys[0] : "undefined");
|
||||||
|
|
||||||
} elsif($behavior eq "relative" && $minprio < 99999) {
|
} elsif($behavior =~ "^relative" && $minprio < 99999) {
|
||||||
$newState = $priority[$minprio];
|
$newState = $priority[$minprio];
|
||||||
|
|
||||||
} elsif($behavior eq "last"){
|
} elsif($behavior eq "last"){
|
||||||
@ -244,7 +250,8 @@ sub structure_Notify($$)
|
|||||||
" because device $dev->{NAME} has changed";
|
" because device $dev->{NAME} has changed";
|
||||||
readingsBeginUpdate($hash);
|
readingsBeginUpdate($hash);
|
||||||
readingsBulkUpdate($hash, "LastDevice", $dev->{NAME});
|
readingsBulkUpdate($hash, "LastDevice", $dev->{NAME});
|
||||||
readingsBulkUpdate($hash, "LastDevice_Abs", structure_getChangedDevice($dev->{NAME}));
|
readingsBulkUpdate($hash, "LastDevice_Abs",
|
||||||
|
structure_getChangedDevice($dev->{NAME}));
|
||||||
readingsBulkUpdate($hash, "state", $newState);
|
readingsBulkUpdate($hash, "state", $newState);
|
||||||
readingsEndUpdate($hash, 1);
|
readingsEndUpdate($hash, 1);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user