mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 06:39:11 +00:00
fhem.pl: oldreadings enhancements (Forum #133383)
git-svn-id: https://svn.fhem.de/fhem/trunk@27498 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
64bc0311eb
commit
c29eae106d
@ -601,7 +601,10 @@ attribute list if you want to know if a device supports these attributes. <br>
|
|||||||
This attribute takes a comma-separated list of readings. You may use
|
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
|
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
|
internaly store the previous value if the readings value changes. To access
|
||||||
the storead value use the OldReadings.* functions.</li>
|
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.
|
||||||
|
</li>
|
||||||
|
|
||||||
<a name="userReadings"></a>
|
<a name="userReadings"></a>
|
||||||
<li>userReadings<br>
|
<li>userReadings<br>
|
||||||
|
@ -609,6 +609,9 @@ Gerät dokumentiert.
|
|||||||
Readings. regex sind erlaubt. Für jedes Reading aus der Liste
|
Readings. regex sind erlaubt. Für jedes Reading aus der Liste
|
||||||
speichert FHEM intern den vorherigen Wert wenn sich das Reading
|
speichert FHEM intern den vorherigen Wert wenn sich das Reading
|
||||||
ändert. Zum Zugriff auf die Werte gibt es die OldReadings.* Routinen.
|
ä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.
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<a name="userReadings"></a>
|
<a name="userReadings"></a>
|
||||||
|
15
fhem/fhem.pl
15
fhem/fhem.pl
@ -4799,12 +4799,15 @@ setReadingsVal($$$$)
|
|||||||
|
|
||||||
return if($rname eq "IODev" && !fhem_devSupportsAttr($hash->{NAME}, "IODev"));
|
return if($rname eq "IODev" && !fhem_devSupportsAttr($hash->{NAME}, "IODev"));
|
||||||
|
|
||||||
if($hash->{".or"} && grep($rname =~ m/^$_$/, @{$hash->{".or"}}) ) {
|
my $or = $hash->{".or"};
|
||||||
if(defined($hash->{READINGS}{$rname}) &&
|
if($or && grep($rname =~ m/^$_$/, @{$or}) ) {
|
||||||
defined($hash->{READINGS}{$rname}{VAL}) &&
|
my $rd = $hash->{READINGS};
|
||||||
$hash->{READINGS}{$rname}{VAL} ne $val ) {
|
if(defined($rd->{$rname}) &&
|
||||||
$hash->{OLDREADINGS}{$rname}{VAL} = $hash->{READINGS}{$rname}{VAL};
|
defined($rd->{$rname}{VAL}) &&
|
||||||
$hash->{OLDREADINGS}{$rname}{TIME} = $hash->{READINGS}{$rname}{TIME};
|
($or->[@{$or}-1] eq "oldreadingsAlways" ||
|
||||||
|
$rd->{$rname}{VAL} ne $val) ) {
|
||||||
|
$hash->{OLDREADINGS}{$rname}{VAL} = $rd->{$rname}{VAL};
|
||||||
|
$hash->{OLDREADINGS}{$rname}{TIME} = $rd->{$rname}{TIME};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user