2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-03 16:56:54 +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
# of one of our wakeup devices
if ( defined( $attr{$wakeupDev}{wakeupResetSwitcher} )
&& $attr{$wakeupDev}{wakeupResetSwitcher} eq $devName
&& $defs{$devName}{TYPE} eq "dummy" )
if (
AttrVal( $wakeupDev, "wakeupResetSwitcher", "" ) eq $devName
&& $dev->{TYPE} eq "dummy" )
{
# Some previous notify deleted the array.
@ -289,14 +289,14 @@ sub GUEST_Notify($$) {
}
# process PRESENCE
elsif (@presenceDevices) {
if ( @presenceDevices && $devName ~~ @presenceDevices ) {
my $counter = {
absent => 0,
present => 0,
};
foreach (@presenceDevices) {
next unless ( $_ eq $devName );
my $presenceState =
ReadingsVal( $_, "presence", ReadingsVal( $_, "state", "" ) );
next
@ -306,7 +306,6 @@ sub GUEST_Notify($$) {
$counter->{absent}++ if ($2);
$counter->{present}++ if ($3);
last;
}
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
# of one of our wakeup devices
if ( defined( $attr{$wakeupDev}{wakeupResetSwitcher} )
&& $attr{$wakeupDev}{wakeupResetSwitcher} eq $devName
&& $defs{$devName}{TYPE} eq "dummy" )
if (
AttrVal( $wakeupDev, "wakeupResetSwitcher", "" ) eq $devName
&& $dev->{TYPE} eq "dummy" )
{
# Some previous notify deleted the array.
@ -294,14 +294,14 @@ sub ROOMMATE_Notify($$) {
}
# process PRESENCE
elsif (@presenceDevices) {
if ( @presenceDevices && $devName ~~ @presenceDevices ) {
my $counter = {
absent => 0,
present => 0,
};
foreach (@presenceDevices) {
next unless ( $_ eq $devName );
for (@presenceDevices) {
my $presenceState =
ReadingsVal( $_, "presence", ReadingsVal( $_, "state", "" ) );
next
@ -311,7 +311,6 @@ sub ROOMMATE_Notify($$) {
$counter->{absent}++ if ($2);
$counter->{present}++ if ($3);
last;
}
if ( $counter->{absent} && !$counter->{present} ) {