diff --git a/fhem/CHANGED b/fhem/CHANGED
index 67dadb14e..f4c3da852 100644
--- a/fhem/CHANGED
+++ b/fhem/CHANGED
@@ -1,5 +1,6 @@
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
# Do not insert empty lines here, update check depends on it.
+ - feature: 90_at: computeAfterInit attribute (Forum #56706)
- change: 93_DbRep: fit to new commandref style
- bugfix: 20_ROOMMATE,20_GUEST: Fixed wakeuptimer <> at-device sync
- feature 93_DbRep: current_year_begin, previous_year_begin,
diff --git a/fhem/FHEM/90_at.pm b/fhem/FHEM/90_at.pm
index 40223b270..8f81436f3 100755
--- a/fhem/FHEM/90_at.pm
+++ b/fhem/FHEM/90_at.pm
@@ -19,7 +19,7 @@ at_Initialize($)
$hash->{AttrFn} = "at_Attr";
$hash->{StateFn} = "at_State";
$hash->{AttrList} = "disable:0,1 disabledForIntervals ".
- "skip_next:0,1 alignTime";
+ "skip_next:0,1 alignTime computeAfterInit";
$hash->{FW_detailFn} = "at_fhemwebFn";
}
@@ -285,6 +285,17 @@ at_Attr(@)
my $hash = $defs{$name};
+ if($cmd eq "set" && $attrName eq "computeAfterInit" &&
+ $attrVal && !$init_done) {
+ InternalTimer(1, sub(){
+Log 1, "IT";
+ $hash->{OLDDEF} = $hash->{DEF};
+ at_Define($hash, "$name at $hash->{DEF}");
+ delete($hash->{OLDDEF});
+ }, $name, 0);
+ return undef;
+ }
+
if($cmd eq "set" && $attrName eq "alignTime") {
return "alignTime needs a list of timespec parameters" if(!$attrVal);
my $ret = at_adjustAlign($hash, $attrVal);
@@ -509,6 +520,28 @@ EOF
Attributes
+
+ - alignTime
+ Applies only to relative at definitions: adjust the time of the next
+ command execution so, that it will also be executed at the desired
+ alignTime. The argument is a timespec, see above for the
+ definition.
+ Example:
+
+ # Make sure that it chimes when the new hour begins
+ define at2 at +*01:00 set Chime on-for-timer 1
+ attr at2 alignTime 00:00
+
+
+
+
+ - computeAfterInit
+ If perlfunc() in the timespec relies on some other/dummy readings, then
+ it will return a wrong time upon FHEM start, as the at define is
+ processed before the readings are known. If computeAfterInit is set,
+ FHEM will recompute timespec after the initialization is finished.
+
+
- disable
Can be applied to at/watchdog/notify/FileLog devices.
@@ -532,20 +565,6 @@ EOF
Used for at commands: skip the execution of the command the next
time.
-
- - alignTime
- Applies only to relative at definitions: adjust the time of the next
- command execution so, that it will also be executed at the desired
- alignTime. The argument is a timespec, see above for the
- definition.
- Example:
-
- # Make sure that it chimes when the new hour begins
- define at2 at +*01:00 set Chime on-for-timer 1
- attr at2 alignTime 00:00
-
-
-
- perlSyntaxCheck
@@ -683,6 +702,30 @@ EOF
Attribute
+
+ - alignTime
+ Nur für relative Definitionen: Stellt den Zeitpunkt der
+ Ausführung des Befehls so, dass er auch zur alignTime
+ ausgeführt wird. Dieses Argument ist ein timespec. Siehe oben
+ fü die Definition
+
+ Beispiel:
+
+ # Stelle sicher das es gongt wenn eine neue Stunde beginnt.
+ define at2 at +*01:00 set Chime on-for-timer 1
+ attr at2 alignTime 00:00
+
+
+
+
+ - computeAfterInit
+ Falls perlfunc() im timespec Readings or Statusinformationen
+ benögt, dann wird sie eine falsche Zeit beim FHEM-Start
+ zurueckliefern, da zu diesem Zeitpunkt die Readings noch nicht aktiv
+ sind. Mit gesetztem computeAfterInit wird perlfunc nach Setzen aller
+ Readings erneut ausgefuehrt. (Siehe Forum #56706)
+
+
- disable
Deaktiviert das entsprechende Gerät.
@@ -708,21 +751,6 @@ EOF
Wird bei at Befehlen verwendet um die nächste Ausführung zu
überspringen
-
- - alignTime
- Nur für relative Definitionen: Stellt den Zeitpunkt der
- Ausführung des Befehls so, dass er auch zur alignTime
- ausgeführt wird. Dieses Argument ist ein timespec. Siehe oben
- fü die Definition
-
- Beispiel:
-
- # Stelle sicher das es gongt wenn eine neue Stunde beginnt.
- define at2 at +*01:00 set Chime on-for-timer 1
- attr at2 alignTime 00:00
-
-
-
- perlSyntaxCheck