diff --git a/fhem/FHEM/01_FHEMWEB.pm b/fhem/FHEM/01_FHEMWEB.pm index fd3ccf71c..80f0d95fb 100755 --- a/fhem/FHEM/01_FHEMWEB.pm +++ b/fhem/FHEM/01_FHEMWEB.pm @@ -2559,13 +2559,6 @@ FW_Notify($$) if($events) { # It gets deleted sometimes (?) my $tn = TimeNow(); my $max = int(@{$events}); - - my $state = ""; - if($max) { - my ($rn,$rv) = split(": ",$events->[$max-1],2); - $state = $rv if($rn eq "state"); - } - for(my $i = 0; $i < $max; $i++) { if($events->[$i] !~ /: /) { if($dev->{NAME} eq 'global') { # Forum #47634 @@ -2576,7 +2569,6 @@ FW_Notify($$) next; #ignore 'set' commands } - next if($events->[$i] eq $state); my ($readingName,$readingVal) = split(": ",$events->[$i],2); push @data, FW_longpollInfo($h->{fmt}, "$dn-$readingName", $readingVal,$readingVal); diff --git a/fhem/FHEM/91_notify.pm b/fhem/FHEM/91_notify.pm index 26a492b25..9aec16277 100755 --- a/fhem/FHEM/91_notify.pm +++ b/fhem/FHEM/91_notify.pm @@ -405,9 +405,9 @@ notify_fhemwebFn($$$$)
  • addStateEvent
    The event associated with the state Reading is special, as the "state: " string is stripped, i.e $EVENT is not "state: on" but just "on". In some - circumstances it is desireable to get an additional event where "state: " - is not stripped. In such a case the addStateEvent attribute should be - set to 1 (default is 0, i.e. do not generate an additional event).
    + circumstances it is desireable to get the event without "state: " + stripped. In such a case the addStateEvent attribute should be set to 1 + (default is 0, i.e. strip the "state: " string).
    Note 1: you have to set this attribute for the event "receiver", i.e. notify, FileLog, etc.
    @@ -612,8 +612,8 @@ notify_fhemwebFn($$$$) Das mit dem state Reading verknüpfte Event ist speziell, da das dazugehörige Prefix "state: " entfernt wird, d.h. $EVENT ist nicht "state: on", sondern nur "on". In manchen Fällen ist es aber - erwünscht ein zusätzliches Event zu bekommen, wo "state: " nicht - entfernt ist. Für diese Fälle sollte addStateEvent auf 1 + erwünscht das unmodifizierte Event zu bekommen, d.h. wo "state: " + nicht entfernt ist. Für diese Fälle sollte addStateEvent auf 1 gesetzt werden, die Voreinstellung ist 0 (deaktiviert).
    Achtung: diff --git a/fhem/fhem.pl b/fhem/fhem.pl index 41fe307e6..90ece03b5 100755 --- a/fhem/fhem.pl +++ b/fhem/fhem.pl @@ -3001,7 +3001,7 @@ GetTimeSpec($) sub deviceEvents($$) { - my ($hash, $withState) = @_; + my ($hash, $withState) = @_; # withState returns stateEvent as state:event return undef if(!$hash || !$hash->{CHANGED}); @@ -3009,9 +3009,12 @@ deviceEvents($$) my $cws = $hash->{CHANGEDWITHSTATE}; if(defined($cws)){ if(int(@{$cws}) == 0) { - @{$cws} = @{$hash->{CHANGED}}; - push @{$cws}, "state: $hash->{READINGS}{state}{VAL}" - if($hash->{READINGS} && $hash->{READINGS}{state}); + if($hash->{READINGS} && $hash->{READINGS}{state}) { + my $state = $hash->{READINGS}{state}{VAL}; + @{$cws} = map { $_ eq $state ? "state: $_" : $_ } @{$hash->{CHANGED}}; + } else { + @{$cws} = @{$hash->{CHANGED}}; + } } return $cws; }