From 725fb28f4964b16fdaa8aa08041825f42fcd7a18 Mon Sep 17 00:00:00 2001 From: justme1968 Date: Sat, 28 Dec 2013 10:11:46 +0000 Subject: [PATCH] process events only if visible in browser git-svn-id: svn://svn.code.sf.net/p/fhem/code/trunk@4485 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/CHANGED | 1 + fhem/FHEM/33_readingsGroup.pm | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/fhem/CHANGED b/fhem/CHANGED index d2e3b71d7..506e7fd38 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -1,6 +1,7 @@ # Add changes at the top of the list. Keep it in ASCII, and 80-char wide. # Do not insert empty lines here, update check depends on it. - SVN + - feature: readingsGroup: process events only if visible in browser - feature: FLOORPLAN: Style4 (S300TH specific) now keeps its formatting even with longpoll; Text "desiredTemperature" will now be eliminated - for MAX devices. diff --git a/fhem/FHEM/33_readingsGroup.pm b/fhem/FHEM/33_readingsGroup.pm index 20a8719a6..9d058e845 100644 --- a/fhem/FHEM/33_readingsGroup.pm +++ b/fhem/FHEM/33_readingsGroup.pm @@ -437,6 +437,11 @@ readingsGroup_detailFn() { my ($FW_wname, $d, $room, $pageHash) = @_; # pageHash is set for summaryFn. + my $hash = $defs{$d}; + + Log3 $hash->{NAME}, 5, "opened: $FW_cname"; + $hash->{helper}->{myDisplay}->{$FW_cname} = 1; + return readingsGroup_2html($d); } @@ -457,6 +462,30 @@ readingsGroup_Notify($$) return if( AttrVal($name,"disable", 0) > 0 ); + if( !defined($hash->{helper}{myDisplay}) + || !%{$hash->{helper}{myDisplay}} ) { + Log3 $name, 5, "$name: not on any display, ignoring notify"; + return undef; + } else { + foreach my $display ( keys %{$hash->{helper}{myDisplay}} ) { + if( defined($defs{$display}) ) { + my $filter = $defs{$display}->{inform}; + my $rn = AttrVal($name, "room", ""); + if($filter eq "all" || $rn =~ m/\b$filter\b/) { + Log3 $name, 5, "$name: do update"; + } else { + Log3 $name, 5, "$name: $display is not my room, ignoring notify"; + delete( $hash->{helper}{myDisplay}{$display} ); + return undef; + } + } else { + Log3 $name, 5, "$name: $display is closed, ignoring notify"; + delete( $hash->{helper}{myDisplay}{$display} ); + return undef; + } + } + } + return if($dev->{TYPE} eq $hash->{TYPE}); #return if($dev->{NAME} eq $name);