diff --git a/fhem/docs/commandref_frame.html b/fhem/docs/commandref_frame.html index 51dd72e82..1dfb3371c 100644 --- a/fhem/docs/commandref_frame.html +++ b/fhem/docs/commandref_frame.html @@ -601,7 +601,10 @@ attribute list if you want to know if a device supports these attributes.
This attribute takes a comma-separated list of readings. You may use regular expressions in that list. For each reading in the list FHEM will internaly store the previous value if the readings value changes. To access - the storead value use the OldReadings.* functions. + the storead value use the OldReadings.* functions. + If the previous value is always to be stored (even if it didn't changed), + then set the last value of the comma-separated list to oldreadingsAlways. +
  • userReadings
    diff --git a/fhem/docs/commandref_frame_DE.html b/fhem/docs/commandref_frame_DE.html index 61aaf3d97..ccebd0996 100644 --- a/fhem/docs/commandref_frame_DE.html +++ b/fhem/docs/commandref_frame_DE.html @@ -609,6 +609,9 @@ Gerät dokumentiert. Readings. regex sind erlaubt. Für jedes Reading aus der Liste speichert FHEM intern den vorherigen Wert wenn sich das Reading ändert. Zum Zugriff auf die Werte gibt es die OldReadings.* Routinen. + Falls der vorherige Wert immer, d.h. auch wenn es sich nicht ändert, + gespeichert werden soll, dann muss der letzte Werte der Komma getrennten + Liste oldreadingsAlways sein.
  • diff --git a/fhem/fhem.pl b/fhem/fhem.pl index 12a594832..9adcec877 100755 --- a/fhem/fhem.pl +++ b/fhem/fhem.pl @@ -4799,12 +4799,15 @@ setReadingsVal($$$$) return if($rname eq "IODev" && !fhem_devSupportsAttr($hash->{NAME}, "IODev")); - if($hash->{".or"} && grep($rname =~ m/^$_$/, @{$hash->{".or"}}) ) { - if(defined($hash->{READINGS}{$rname}) && - defined($hash->{READINGS}{$rname}{VAL}) && - $hash->{READINGS}{$rname}{VAL} ne $val ) { - $hash->{OLDREADINGS}{$rname}{VAL} = $hash->{READINGS}{$rname}{VAL}; - $hash->{OLDREADINGS}{$rname}{TIME} = $hash->{READINGS}{$rname}{TIME}; + my $or = $hash->{".or"}; + if($or && grep($rname =~ m/^$_$/, @{$or}) ) { + my $rd = $hash->{READINGS}; + if(defined($rd->{$rname}) && + defined($rd->{$rname}{VAL}) && + ($or->[@{$or}-1] eq "oldreadingsAlways" || + $rd->{$rname}{VAL} ne $val) ) { + $hash->{OLDREADINGS}{$rname}{VAL} = $rd->{$rname}{VAL}; + $hash->{OLDREADINGS}{$rname}{TIME} = $rd->{$rname}{TIME}; } }