afterSec(x)

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

Moderator: leecollings

bdormael
Posts: 82
Joined: Saturday 13 December 2014 21:20
Target OS: Linux
Domoticz version:
Contact:

afterSec(x)

Post by bdormael »

Maybe a stupid question:

for devices we have:
device.switchOn().afterSec(10)

Can't we have this also for variables like:
variable.set('my_value').afterSec(10)

In normal LUA you can do this for variables
dannybloe
Posts: 1355
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Ermelo
Contact:

Re: afterSec(x)

Post by dannybloe »

Oh I didn't know that. I'll add it.
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
bdormael
Posts: 82
Joined: Saturday 13 December 2014 21:20
Target OS: Linux
Domoticz version:
Contact:

Re: afterSec(x)

Post by bdormael »

dannybloe wrote:Oh I didn't know that. I'll add it.
Thx


Verzonden vanaf mijn iPad met Tapatalk
mikkel75
Posts: 39
Joined: Thursday 08 December 2016 20:50
Target OS: Linux
Domoticz version:
Contact:

Re: afterSec(x)

Post by mikkel75 »

I'm also looking for this feature - is it added now?

Thanks!
dannybloe
Posts: 1355
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Ermelo
Contact:

Re: afterSec(x)

Post by dannybloe »

Not yet.. just got back from vacation. Catching up here...
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
mikkel75
Posts: 39
Joined: Thursday 08 December 2016 20:50
Target OS: Linux
Domoticz version:
Contact:

Re: afterSec(x)

Post by mikkel75 »

OK...but pleaaaaaseeee implement this soon - I really need it for my alarm system :)

Thanks...
dannybloe
Posts: 1355
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Ermelo
Contact:

Re: afterSec(x)

Post by dannybloe »

I'm testing it right now on my production machine. I want to have it running for a little before we start creating Pull Requests.
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
mikkel75
Posts: 39
Joined: Thursday 08 December 2016 20:50
Target OS: Linux
Domoticz version:
Contact:

Re: afterSec(x)

Post by mikkel75 »

Sounds really good...thanks so much for doing this...
User avatar
DewGew
Posts: 581
Joined: Thursday 21 April 2016 12:01
Target OS: Raspberry Pi / ODroid
Domoticz version: V4.10618
Location: Sweden
Contact:

Re: afterSec(x)

Post by DewGew »

Is it possible to use time option to a function also? eg. " myfunction().afterSec(delay)"
Raspberry Pi 3 | domoticz | Aeon Labs Z-Stick GEN5 | RFlink gateway
NanoPi NEO-air | REGO6XX interface | Machinon theme | Homebridge | Domoticz Google Assistant | ideAlarm
dannybloe
Posts: 1355
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Ermelo
Contact:

Re: afterSec(x)

Post by dannybloe »

No, that's handled by the Lua interpreter. Calling a function has nothing to do with Domotic's scheduling support.
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
mikkel75
Posts: 39
Joined: Thursday 08 December 2016 20:50
Target OS: Linux
Domoticz version:
Contact:

Re: afterSec(x)

Post by mikkel75 »

dannybloe wrote: Wednesday 23 August 2017 9:51 I'm testing it right now on my production machine. I want to have it running for a little before we start creating Pull Requests.
How's the testing going? :)
dannybloe
Posts: 1355
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Ermelo
Contact:

Re: afterSec(x)

Post by dannybloe »

Taking longer than expected as quite some changes have to made in the Domoticz event systems. Still working on that.
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
mikkel75
Posts: 39
Joined: Thursday 08 December 2016 20:50
Target OS: Linux
Domoticz version:
Contact:

Re: afterSec(x)

Post by mikkel75 »

OK - thanks again for your effort!
mikkel75
Posts: 39
Joined: Thursday 08 December 2016 20:50
Target OS: Linux
Domoticz version:
Contact:

Re: afterSec(x)

Post by mikkel75 »

Any progress? ;)
mikkel75
Posts: 39
Joined: Thursday 08 December 2016 20:50
Target OS: Linux
Domoticz version:
Contact:

Re: afterSec(x)

Post by mikkel75 »

Are we getting closer to a solution? :)
dannybloe
Posts: 1355
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Ermelo
Contact:

Re: afterSec(x)

Post by dannybloe »

Eh.. it is released in 3.8551 so give it a try.
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
bdormael
Posts: 82
Joined: Saturday 13 December 2014 21:20
Target OS: Linux
Domoticz version:
Contact:

Re: afterSec(x)

Post by bdormael »

dannybloe wrote: Monday 09 October 2017 19:37 Eh.. it is released in 3.8551 so give it a try.
Working perfect, thx
mikkel75
Posts: 39
Joined: Thursday 08 December 2016 20:50
Target OS: Linux
Domoticz version:
Contact:

Re: afterSec(x)

Post by mikkel75 »

Question:

Is it possible to cancel an .afterSec() before it is activated (the time has passed)?

The use-case is for an alarm system, where I use afterSec to time from when the PIR is trigged to when the siren should start. I want to be able to cancel the siren if the alarm is disarmed.

Thanks,
Mikkel
dannybloe
Posts: 1355
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Ermelo
Contact:

Re: afterSec(x)

Post by dannybloe »

In the upcoming dzVents 2.4 you can do device.cancelQueuedCommands(). Until then you can try device.setState(device.state)).
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
mikkel75
Posts: 39
Joined: Thursday 08 December 2016 20:50
Target OS: Linux
Domoticz version:
Contact:

Re: afterSec(x)

Post by mikkel75 »

Hi,

Thanks for the quick reply.

I do it like this:

domoticz.variables('SoundSiren').set('0')

But that doesn't cancel the afterSec() - it's still called after the time-out.

Any other suggestions that might work?

Thanks.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest