diff --git a/docs/commandref_frame.html b/docs/commandref_frame.html
index e3b7c384e..59b1b2488 100644
--- a/docs/commandref_frame.html
+++ b/docs/commandref_frame.html
@@ -1083,10 +1083,11 @@ The following local attributes are used by a wider range of devices:
From featurelevel 5.7 on the set and setreading command replaces:
- - [device:reading] with the corresponding reading of device, if both device
- and reading exists.
- - [device:reading:d] same as above, but only the number is retrieved, see
- ReadingsNum
+ - [device:name] with the reading, internal or attribute of the device, if
+ both device and the reading, internal or attribute exists. You can use the
+ r:, i: or a: prefix to restrict the search to one type, analogue to the
+ devspec filtering.
+ - [device:name:d] same as above, but only the number is retrieved
- {(perlExpression)} with the result of perlExpression.
The $DEV variable is additionally available, designating the set device
name.
@@ -1650,6 +1651,14 @@ The following local attributes are used by a wider range of devices:
ReadingsNum(<devicename>,<reading>,<defaultvalue>)
Return the reading as a number, i.e. delete non-numerical values.
+ - ReadingsTimestamp(<devicename>,<reading>,<
+ defaultvalue>)
+ returns the timestamp of the reading.
+
+ - ReadingsAge(<devicename>,<reading>,<defaultvalue>)
+
+ returns the age of the reading in seconds.
+
-
AttrVal(<devicename>,<attribute>,<defaultvalue>)
Return the attribute of the device
diff --git a/docs/commandref_frame_DE.html b/docs/commandref_frame_DE.html
index 20d3a3517..f6fbe7a8e 100644
--- a/docs/commandref_frame_DE.html
+++ b/docs/commandref_frame_DE.html
@@ -1151,10 +1151,12 @@ Die folgenden lokalen Attribute werden von mehreren Geräten verwendet:
Ab featurelevel 5.7 ersetzt das set und setreading Befehl
- - [device:reading] mit dem Wert des Readings für device, falls sowohl
- device, als auch Reading existiert, und nicht leer ist.
- - [device:reading:d] wie ohne :d, aber alles nicht-numerische wird
- entfernt, siehe ReadingsNum
+ - [device:name] mit dem Wert des Readings, Internals oder Attributes
+ für device, falls sowohl device, als auch Reading, Internal oder
+ Attribut existiert, und nicht leer ist. Man kann einen der Prefixe r:, i:
+ oder a: verwenden, um die Suche einzuschraenken, genau wie im devspec.
+ - [device:name:d] wie ohne :d, aber alles nicht-numerische wird
+ entfernt.
- {(perlExpression)} mit dem Ergebnis der perlExpression.
$DEV wird dabei mit dem Namen des vom set betroffenen Gerätes ersetzt.
@@ -1786,6 +1788,13 @@ Die folgenden lokalen Attribute werden von mehreren Geräten verwendet:
Wie ReadingsVal, löscht aber alles, was kein Zahl ist, um den Wert
bei Berechnungen verwenden zu können.
+ - ReadingsTimestamp(<devicename>)
+ gibt den Zeitstempel des Readings zurück.
+
+ - ReadingsAge(<devicename>,<reading>,<defaultvalue>)
+
+ gibt das Alter des Readings in Sekunden zurück.
+
-
AttrVal(<devicename>,<attribute>,<defaultvalue>)
Gibt die gesetzteb Attribute des Gerätes zurück
diff --git a/fhem.pl b/fhem.pl
index f9c94df8f..8f61576a7 100755
--- a/fhem.pl
+++ b/fhem.pl
@@ -1620,10 +1620,24 @@ ReplaceSetMagic($$@) # Forum #38276
my $a = join(" ", @_);
my $oa = $a;
- $a =~ s/\[([a-z0-9._]+):([a-z0-9._-]+)(:d)?\]/{
- my $x = $3 ? ReadingsNum($1,$2,"") : ReadingsVal($1,$2,"");
- $x eq "" ? "[$1:$2".($3?$3:"")."]" : $x
- }/egi;
+ sub
+ rsmVal($$$$$)
+ {
+ my ($all, $t, $d, $n, $s, $val) = @_;
+ my $hash = $defs{$d};
+ return $all if(!$hash);
+ if(!$t || $t eq "r:") {
+ my $r = $hash->{READINGS};
+ $val = $r->{$n}{VAL} if($r && $r->{$n});
+ }
+ $val = $hash->{$n} if(!defined($val) && (!$t || $t eq "i:"));
+ $val = $attr{$d}{$n} if(!defined($val) && (!$t || $t eq "a:") && $attr{$d});
+ return $all if(!defined($val));
+ $val =~ s/[^-\.\d]//g if($s);
+ return $val;
+ }
+
+ $a=~s/(\[(.:)?([a-z0-9._]+):([a-z0-9._-]+)(:d)?\])/rsmVal($1,$2,$3,$4,$5)/egi;
$evalSpecials->{'%DEV'} = $hash->{NAME};
$a =~ s/{\((.*?)\)}/AnalyzePerlCommand($hash->{CL},$1,1)/egs;