Hauptmenü

sleep

Begonnen von -user-, 03 Oktober 2020, 16:27:34

Vorheriges Thema - Nächstes Thema

MadMax-FHEM

Ja, da du wohl mit diesem "Konstrukt" ein fhem-sleep "erzwingst" ;)

Ist nur "gefährlich", da es bei anderer "Anwendung" (mit Sub-Aufruf) eben blockiert...
...und da kann dann ein "Anfänger" drüber stolpern und dann blockiert es eben...

Gruß, Joachim
FHEM PI3B+ Bullseye: HM-CFG-USB, 40x HM, ZWave-USB, 13x ZWave, EnOcean-PI, 15x EnOcean, HUE/deCONZ, CO2, ESP-Multisensor, Shelly, alexa-fhem, ...
FHEM PI2 Buster: HM-CFG-USB, 25x HM, ZWave-USB, 4x ZWave, EnOcean-PI, 3x EnOcean, Shelly, ha-bridge, ...
FHEM PI3 Buster (Test)

Jamo

#16
Jetzt das ganze mit einem 'named sleep':
sub meineErsteSub () {
..
fhem("sleep 300 myFhemSleepName;{mySecodSub();;dothisandthat()}")}
..
}


Das sleep kann man auch vorher abbrechen, mit
fhem ("cancel myFhemSleepName quiet");
Bullseye auf iNUC, Homematic + HMIP(UART/HMUSB), Debmatic, HUEBridge, Zigbee/ConbeeII, FB, Alexa (fhem-lazy), Livetracking, LaCrosse JeeLink, LoRaWan / TTN / Chirpstack

Jamo

Hier nochmal zur Erläuterung:
Zitatsleep

sleep <sec> [<id>] [quiet]

sleep followed by another command is comparable to a nameless at, it executes the following commands after waiting the specified time. The unit is seconds, with millisecond accuracy, as you can specify decimal places.

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.
Bullseye auf iNUC, Homematic + HMIP(UART/HMUSB), Debmatic, HUEBridge, Zigbee/ConbeeII, FB, Alexa (fhem-lazy), Livetracking, LaCrosse JeeLink, LoRaWan / TTN / Chirpstack