diff --git a/fhem/FHEM/10_RESIDENTS.pm b/fhem/FHEM/10_RESIDENTS.pm index e446a9698..396ae629c 100644 --- a/fhem/FHEM/10_RESIDENTS.pm +++ b/fhem/FHEM/10_RESIDENTS.pm @@ -149,6 +149,8 @@ sub RESIDENTS_Notify($$) { return if ( !$dev->{CHANGED} ); # Some previous notify deleted the array. + readingsBeginUpdate($hash); + foreach my $change ( @{ $dev->{CHANGED} } ) { Log3 $hash, 5, @@ -198,15 +200,17 @@ sub RESIDENTS_Notify($$) { ); # update statistics - readingsBeginUpdate($hash); readingsBulkUpdate( $hash, "lastActivity", ReadingsVal( $devName, "state", $change ) ); readingsBulkUpdate( $hash, "lastActivityBy", $realname ); readingsBulkUpdate( $hash, "lastActivityByDev", $devName ); - readingsEndUpdate( $hash, 1 ); + } + } + readingsEndUpdate( $hash, 1 ); + return; } @@ -552,7 +556,9 @@ sub RESIDENTS_Set($@) { return "No Argument given, choose one of ROOMMATE GUEST "; } + readingsBeginUpdate($hash); RESIDENTS_UpdateReadings($hash); + readingsEndUpdate( $hash, 1 ); } # create @@ -1150,8 +1156,6 @@ sub RESIDENTS_UpdateReadings (@) { } # update counter - readingsBeginUpdate($hash); - readingsBulkUpdate( $hash, "residentsTotal", $state_total ) if ( ReadingsVal( $name, "residentsTotal", "" ) ne $state_total ); @@ -1571,8 +1575,6 @@ sub RESIDENTS_UpdateReadings (@) { } } - - readingsEndUpdate( $hash, 1 ); } 1; @@ -1905,6 +1907,7 @@ sub RESIDENTS_UpdateReadings (@) { wakeuptimer - adds a wake-up timer dummy device with enhanced functions to start with wake-up automations