Hi all,
Two hours after a notify triggered, I want FHEM to do something else.
What is the neatest way to do that? Sleep is depreciated, isn't it?
BW,
Paul
Hello Paul, sleep is not deprecated, but it is not the prefered solution for your task.
Simply use an at-device which will be defined inside your notify:
define n1 notify <anyTrigger> doFhemTask1; define tempat at +02:00:00 doFhemTask2_after_two_hours
Another idea is to use a DOIF with a wait for 2 h ?
Zitat von: DL8EI Ralph am 07 September 2023, 12:30:09Another idea is to use a DOIF
"If I don't have any idea, how to solve it in an easy, simple and correct way, I can always try to use a damn DOIF and get crazy."
(Unknown FHEM user)BTW: There are no DOIF devices in any of my FHEM installations. Guess, why...
...sleep is not deprecated...
There is a FHEM command called sleep, which is not deprecated, and can be used to emulate the perl function sleep.
The perl function sleep remains deprecated, as FHEM is suspended for the duration of this sleep.
I got so many
1: WARNING: sleep without additional commands is deprecated and blocks FHEM
driving me crazy, as I couldn't trace them ...
That may be a topic in itself. Or even a Wiki entry.
Show your code pls
You're probably doing a sleep without a following FHEM command.
E.g.:
fhem("sleep 3");
fhem("...");
fhem("sleep 3");
...
This results in the message:
1: WARNING: sleep without additional commands is deprecated and blocks FHEM
Zitat von: commandrefsleep
[EN DE]
sleep <sec|timespec|regex> [<id>] [quiet]
sleep followed by another command is comparable to a nameless at or notify, it executes the following commands after waiting for the specified time or an event matching <regex>. The delay can be given
in seconds, with millisecond accuracy, as you can specify decimal places,
as a timespec (HH:MM or HH:MM:SS or {perlfunc})
or as a regex (devicename or devicename:event)
A sleep with an <id> will replace a sleep with the same <id> and can be canceled by cancel. When called in a notify/at/etc, then nonempty return values of the following commands are logged to the global logfile with loglevel 2.
If quiet is specified, then skip this logging.
Example:
define n3 notify btn3.* set lamp on;;sleep 1.5;;set lamp off
define a3 at +*00:05 set Windsensor 1w_measure;; sleep 2 quiet;; get Windsensor 1w_temp
Note: a sleep not followed by any command will block FHEM, is deprecated, and it issues a WARNING in the FHEM log.