10_RESIDENTS,20_ROOMMATE,20_GUEST: update slaves for define and undefine

git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@13609 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
jpawlowski 2017-03-05 13:18:54 +00:00
parent 9fa93e6ab0
commit fddc177a2f
3 changed files with 10 additions and 8 deletions

View File

@ -60,6 +60,8 @@ sub RESIDENTS_Define($$) {
Log3 $name, 5, "RESIDENTS $name: called function RESIDENTS_Define()";
RESIDENTStk_findResidentSlaves($hash);
# set default settings on first define
if ( $init_done && !defined( $hash->{OLDDEF} ) ) {
$attr{$name}{alias} = "Residents";
@ -129,8 +131,6 @@ sub RESIDENTS_Notify($$) {
&& defined( $defs{$devName}{TYPE} )
&& $defs{$devName}{TYPE} =~ /^(ROOMMATE|GUEST|DUMMY)$/ );
RESIDENTStk_findResidentSlaves($hash);
my @registeredRoommates =
split( /,/, $hash->{ROOMMATES} )
if ( defined( $hash->{ROOMMATES} )
@ -268,15 +268,13 @@ sub RESIDENTS_Set($@) {
my ( $hash, @a ) = @_;
my $name = $hash->{NAME};
my $state = ReadingsVal( $name, "state", "initialized" );
my $roommates = ( $hash->{ROOMMATES} ? $hash->{ROOMMATES} : "" );
my $guests = ( $hash->{GUESTS} ? $hash->{GUESTS} : "" );
Log3 $name, 5, "RESIDENTS $name: called function RESIDENTS_Set()";
return "No Argument given" if ( !defined( $a[1] ) );
RESIDENTStk_findResidentSlaves($hash);
my $roommates = ( $hash->{ROOMMATES} ? $hash->{ROOMMATES} : "" );
my $guests = ( $hash->{GUESTS} ? $hash->{GUESTS} : "" );
# depending on current FHEMWEB instance's allowedCommands,
# restrict set commands if there is "set-user" in it
my $adminMode = 1;

View File

@ -131,7 +131,9 @@ sub GUEST_Undefine($$) {
RESIDENTStk_RemoveInternalTimer( "DurationTimer", $hash );
if ( defined( $hash->{RESIDENTGROUPS} ) ) {
foreach ( split( /,/, $hash->{RESIDENTGROUPS} ) ) {
my $old = $hash->{RESIDENTGROUPS};
delete $hash->{RESIDENTGROUPS};
foreach ( split( /,/, $old ) ) {
RESIDENTStk_findResidentSlaves( $defs{$_} )
if ( defined( $defs{$_} ) );
}

View File

@ -136,7 +136,9 @@ sub ROOMMATE_Undefine($$) {
RESIDENTStk_RemoveInternalTimer( "DurationTimer", $hash );
if ( defined( $hash->{RESIDENTGROUPS} ) ) {
foreach ( split( /,/, $hash->{RESIDENTGROUPS} ) ) {
my $old = $hash->{RESIDENTGROUPS};
delete $hash->{RESIDENTGROUPS};
foreach ( split( /,/, $old ) ) {
RESIDENTStk_findResidentSlaves( $defs{$_} )
if ( defined( $defs{$_} ) );
}