FHEM Forum

FHEM => Automatisierung => Thema gestartet von: grappa24 am 13 Juni 2024, 10:51:38

Titel: at mit Value(dummy) liefert "must return a timespec"
Beitrag von: grappa24 am 13 Juni 2024, 10:51:38
Hallo,

ich habe ein at, welches in Abhängigkeit eines dummys schaltet

Zwei Dinge:
- the function "Value("SimStopTime")" must return a timespec and not ??
- der Wert des dummy ist nach einem Neustart immer 21:15:00 egal wie ich ihn setze  :(

*{Value("SimStopTime")} set Licht off

define SimStopTime dummy
attr SimStopTime readingList state
attr SimStopTime setList setList state:20:00:00,20:15:00,20:30:00,20:45:00,21:00:00,21:15:00,21:30:00,21:45:00,22:00:00,22:15:00,22:30:00
attr SimStopTime webCmd state
#   FUUID      646ddc84-f33f-b5ae-950e-43416d88a352bc83
#   NAME       SimStopTime
#   NR         665
#   STATE      22:15:00
#   TYPE       dummy
#   eventCount 2
#   READINGS:
#     2024-06-13 09:43:59   state           22:15:00
#
setstate SimStopTime 22:15:00
setstate SimStopTime 2024-06-13 09:43:59 state 22:15:00

Titel: Aw: at mit Value(dummy) liefert "must return a timespec"
Beitrag von: frank am 13 Juni 2024, 11:54:39
probiere den hinweis aus der cref:
ZitatValue(<devicename>)
Returns the STATE of the device (the string you see in parenthesis in the output of the list command). Note: STATE is meant for display purposes, and can be customized by the user via the stateFormat attribute. Use ReadingsVal(<devicename>, 'state', '') instead for computational purposes.
Titel: Aw: at mit Value(dummy) liefert "must return a timespec"
Beitrag von: rudolfkoenig am 13 Juni 2024, 12:07:54
Auch wenn frank recht hat, hier ist mAn eher was anderes das Problem:
https://fhem.de/commandref_modular.html#at-attr-computeAfterInit
ZitatcomputeAfterInit
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.
Titel: Aw: at mit Value(dummy) liefert "must return a timespec"
Beitrag von: grappa24 am 17 Juni 2024, 23:38:28
Zitat von: frank am 13 Juni 2024, 11:54:39probiere den hinweis aus der cref:
ZitatValue(<devicename>)
Returns the STATE of the device (the string you see in parenthesis in the output of the list command). Note: STATE is meant for display purposes, and can be customized by the user via the stateFormat attribute. Use ReadingsVal(<devicename>, 'state', '') instead for computational purposes.

@frank, das Problem ging dann noch wesentlich tiefer, dein Tipp war Gold wert:
https://forum.fhem.de/index.php?msg=1315353
Titel: Aw: at mit Value(dummy) liefert "must return a timespec"
Beitrag von: betateilchen am 22 Juni 2024, 09:28:27
Nicht ohne Grund rate ich immer wieder von der Verwendung von Value() ab und verstehe nicht, warum man diese Funktion nicht längst auf "deprecated" gesetzt hat.