2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-04 05:16:45 +00:00

20_ROOMMATE,20_GUEST: fix use of r*_presenceDevices together with r*_wakeupDevice

git-svn-id: https://svn.fhem.de/fhem/trunk@13044 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
jpawlowski 2017-01-11 19:51:16 +00:00
parent 67311bf634
commit 3d32c5d9b7
2 changed files with 11 additions and 13 deletions

View File

@ -269,9 +269,9 @@ sub GUEST_Notify($$) {
# if this is a notification of a registered sub dummy device # if this is a notification of a registered sub dummy device
# of one of our wakeup devices # of one of our wakeup devices
if ( defined( $attr{$wakeupDev}{wakeupResetSwitcher} ) if (
&& $attr{$wakeupDev}{wakeupResetSwitcher} eq $devName AttrVal( $wakeupDev, "wakeupResetSwitcher", "" ) eq $devName
&& $defs{$devName}{TYPE} eq "dummy" ) && $dev->{TYPE} eq "dummy" )
{ {
# Some previous notify deleted the array. # Some previous notify deleted the array.
@ -289,14 +289,14 @@ sub GUEST_Notify($$) {
} }
# process PRESENCE # process PRESENCE
elsif (@presenceDevices) { if ( @presenceDevices && $devName ~~ @presenceDevices ) {
my $counter = { my $counter = {
absent => 0, absent => 0,
present => 0, present => 0,
}; };
foreach (@presenceDevices) { foreach (@presenceDevices) {
next unless ( $_ eq $devName );
my $presenceState = my $presenceState =
ReadingsVal( $_, "presence", ReadingsVal( $_, "state", "" ) ); ReadingsVal( $_, "presence", ReadingsVal( $_, "state", "" ) );
next next
@ -306,7 +306,6 @@ sub GUEST_Notify($$) {
$counter->{absent}++ if ($2); $counter->{absent}++ if ($2);
$counter->{present}++ if ($3); $counter->{present}++ if ($3);
last;
} }
if ( $counter->{absent} && !$counter->{present} ) { if ( $counter->{absent} && !$counter->{present} ) {

View File

@ -274,9 +274,9 @@ sub ROOMMATE_Notify($$) {
# if this is a notification of a registered sub dummy device # if this is a notification of a registered sub dummy device
# of one of our wakeup devices # of one of our wakeup devices
if ( defined( $attr{$wakeupDev}{wakeupResetSwitcher} ) if (
&& $attr{$wakeupDev}{wakeupResetSwitcher} eq $devName AttrVal( $wakeupDev, "wakeupResetSwitcher", "" ) eq $devName
&& $defs{$devName}{TYPE} eq "dummy" ) && $dev->{TYPE} eq "dummy" )
{ {
# Some previous notify deleted the array. # Some previous notify deleted the array.
@ -294,14 +294,14 @@ sub ROOMMATE_Notify($$) {
} }
# process PRESENCE # process PRESENCE
elsif (@presenceDevices) { if ( @presenceDevices && $devName ~~ @presenceDevices ) {
my $counter = { my $counter = {
absent => 0, absent => 0,
present => 0, present => 0,
}; };
foreach (@presenceDevices) { for (@presenceDevices) {
next unless ( $_ eq $devName );
my $presenceState = my $presenceState =
ReadingsVal( $_, "presence", ReadingsVal( $_, "state", "" ) ); ReadingsVal( $_, "presence", ReadingsVal( $_, "state", "" ) );
next next
@ -311,7 +311,6 @@ sub ROOMMATE_Notify($$) {
$counter->{absent}++ if ($2); $counter->{absent}++ if ($2);
$counter->{present}++ if ($3); $counter->{present}++ if ($3);
last;
} }
if ( $counter->{absent} && !$counter->{present} ) { if ( $counter->{absent} && !$counter->{present} ) {