diff --git a/fhem/FHEM/01_FHEMWEB.pm b/fhem/FHEM/01_FHEMWEB.pm index 1df729495..32c6735ca 100644 --- a/fhem/FHEM/01_FHEMWEB.pm +++ b/fhem/FHEM/01_FHEMWEB.pm @@ -97,6 +97,7 @@ my $FW_lastWebName = ""; # Name of last FHEMWEB instance, for caching my $FW_lastHashUpdate = 0; my $FW_httpRetCode = ""; my %FW_csrfTokenCache; +my %FW_id2inform; ######################### # As we are _not_ multithreaded, it is safe to use global variables. @@ -270,6 +271,7 @@ FW_Undef($$) my ($hash, $arg) = @_; my $ret = TcpServer_Close($hash); if($hash->{inform}) { + delete $FW_id2inform{$hash->{FW_ID}} if($hash->{FW_ID}); %FW_visibleDeviceHash = FW_visibleDevices(); delete($logInform{$hash->{NAME}}); } @@ -571,6 +573,8 @@ FW_initInform($$) $me->{inform}{type} = ($FW_room ? "status" : "raw"); $me->{inform}{filter} = ($FW_room ? $FW_room : ".*"); } + $FW_id2inform{$FW_id} = $me if($FW_id); + my $filter = $me->{inform}{filter}; $filter =~ s/([[\]().+?])/\\$1/g if($filter =~ m/room=/); # Forum #80390 $filter = "NAME=.*" if($filter eq "room=all"); @@ -2473,10 +2477,11 @@ FW_fC($@) { my ($cmd, $unique) = @_; my $ret; + my $cl = $FW_id && $FW_id2inform{$FW_id} ? $FW_id2inform{$FW_id} : $FW_chash; if($unique) { - $ret = AnalyzeCommand($FW_chash, $cmd); + $ret = AnalyzeCommand($cl, $cmd); } else { - $ret = AnalyzeCommandChain($FW_chash, $cmd); + $ret = AnalyzeCommandChain($cl, $cmd); } return $ret; }