mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-04 22:19:38 +00:00
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:
parent
9fa93e6ab0
commit
fddc177a2f
@ -60,6 +60,8 @@ sub RESIDENTS_Define($$) {
|
|||||||
|
|
||||||
Log3 $name, 5, "RESIDENTS $name: called function RESIDENTS_Define()";
|
Log3 $name, 5, "RESIDENTS $name: called function RESIDENTS_Define()";
|
||||||
|
|
||||||
|
RESIDENTStk_findResidentSlaves($hash);
|
||||||
|
|
||||||
# set default settings on first define
|
# set default settings on first define
|
||||||
if ( $init_done && !defined( $hash->{OLDDEF} ) ) {
|
if ( $init_done && !defined( $hash->{OLDDEF} ) ) {
|
||||||
$attr{$name}{alias} = "Residents";
|
$attr{$name}{alias} = "Residents";
|
||||||
@ -129,8 +131,6 @@ sub RESIDENTS_Notify($$) {
|
|||||||
&& defined( $defs{$devName}{TYPE} )
|
&& defined( $defs{$devName}{TYPE} )
|
||||||
&& $defs{$devName}{TYPE} =~ /^(ROOMMATE|GUEST|DUMMY)$/ );
|
&& $defs{$devName}{TYPE} =~ /^(ROOMMATE|GUEST|DUMMY)$/ );
|
||||||
|
|
||||||
RESIDENTStk_findResidentSlaves($hash);
|
|
||||||
|
|
||||||
my @registeredRoommates =
|
my @registeredRoommates =
|
||||||
split( /,/, $hash->{ROOMMATES} )
|
split( /,/, $hash->{ROOMMATES} )
|
||||||
if ( defined( $hash->{ROOMMATES} )
|
if ( defined( $hash->{ROOMMATES} )
|
||||||
@ -268,15 +268,13 @@ sub RESIDENTS_Set($@) {
|
|||||||
my ( $hash, @a ) = @_;
|
my ( $hash, @a ) = @_;
|
||||||
my $name = $hash->{NAME};
|
my $name = $hash->{NAME};
|
||||||
my $state = ReadingsVal( $name, "state", "initialized" );
|
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()";
|
Log3 $name, 5, "RESIDENTS $name: called function RESIDENTS_Set()";
|
||||||
|
|
||||||
return "No Argument given" if ( !defined( $a[1] ) );
|
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,
|
# depending on current FHEMWEB instance's allowedCommands,
|
||||||
# restrict set commands if there is "set-user" in it
|
# restrict set commands if there is "set-user" in it
|
||||||
my $adminMode = 1;
|
my $adminMode = 1;
|
||||||
|
@ -131,7 +131,9 @@ sub GUEST_Undefine($$) {
|
|||||||
RESIDENTStk_RemoveInternalTimer( "DurationTimer", $hash );
|
RESIDENTStk_RemoveInternalTimer( "DurationTimer", $hash );
|
||||||
|
|
||||||
if ( defined( $hash->{RESIDENTGROUPS} ) ) {
|
if ( defined( $hash->{RESIDENTGROUPS} ) ) {
|
||||||
foreach ( split( /,/, $hash->{RESIDENTGROUPS} ) ) {
|
my $old = $hash->{RESIDENTGROUPS};
|
||||||
|
delete $hash->{RESIDENTGROUPS};
|
||||||
|
foreach ( split( /,/, $old ) ) {
|
||||||
RESIDENTStk_findResidentSlaves( $defs{$_} )
|
RESIDENTStk_findResidentSlaves( $defs{$_} )
|
||||||
if ( defined( $defs{$_} ) );
|
if ( defined( $defs{$_} ) );
|
||||||
}
|
}
|
||||||
|
@ -136,7 +136,9 @@ sub ROOMMATE_Undefine($$) {
|
|||||||
RESIDENTStk_RemoveInternalTimer( "DurationTimer", $hash );
|
RESIDENTStk_RemoveInternalTimer( "DurationTimer", $hash );
|
||||||
|
|
||||||
if ( defined( $hash->{RESIDENTGROUPS} ) ) {
|
if ( defined( $hash->{RESIDENTGROUPS} ) ) {
|
||||||
foreach ( split( /,/, $hash->{RESIDENTGROUPS} ) ) {
|
my $old = $hash->{RESIDENTGROUPS};
|
||||||
|
delete $hash->{RESIDENTGROUPS};
|
||||||
|
foreach ( split( /,/, $old ) ) {
|
||||||
RESIDENTStk_findResidentSlaves( $defs{$_} )
|
RESIDENTStk_findResidentSlaves( $defs{$_} )
|
||||||
if ( defined( $defs{$_} ) );
|
if ( defined( $defs{$_} ) );
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user