sleep/delaying actions

Easy to use, 100% Lua-based event scripting framework.

Moderator: leecollings

Post Reply
ricorico94
Posts: 94
Joined: Monday 26 October 2015 10:41
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

sleep/delaying actions

Post by ricorico94 »

Hi,

I'm trying to move from bash scripts to DZVents.. One of my bash script is opening a movie screen to a specific length, but the only way I have is to send a command (to a domoticz switch, type Venetian Blinds EU) for starting "opening" the screen and then send another command to stop the opening after 12.5 seconds (not 12s, not 13s...). It does work well in bash with a sleep(12.5) command.
How could I do that in DZvents ? I saw the command like "afterSec" , but can it use decimal values ?
If the name of my device is Screen, is the best way as follows ?

Code: Select all

domoticz.devices('Screen').open
domoticz.devices('Screen').stop.afterSec(12.5)

Also, another quick question about the repeatAfterSec(X,Y) command: is the Y the number of occurences after the initial one, or after ?
I ask that because when I used that in a script, I used this:

Code: Select all

domoticz.devices('MyButton').switchOn().repeatAfterSec(1, Number)
and if Number=1, the button seems activated twice.. laways one more. This doesn't seem in line with what I had understood from the documentation on wiki.

br,
Ricorico94
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: sleep/delaying actions

Post by waaren »

ricorico94 wrote: Wednesday 04 September 2019 12:33 If the name of my device is Screen, is the best way as follows ?

Code: Select all

domoticz.devices('Screen').open
domoticz.devices('Screen').stop.afterSec(12.5)
Yes that is the best way.
Also, another quick question about the repeatAfterSec(X,Y) command: is the Y the number of occurences after the initial one, or after ?
I ask that because when I used that in a script, I used this:

Code: Select all

domoticz.devices('MyButton').switchOn().repeatAfterSec(1, Number)
and if Number=1, the button seems activated twice.. laways one more. This doesn't seem in line with what I had understood from the documentation on wiki.
The repeatAfterXXX(1,1) repeats the action. So the switchOn is repeated once = 2 times a switchOn.
First one immediate and the repeat after 1 second
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest