Hi guys,
I'm working on an alarm system based on LUA scripting.
I want to include a delay that will allow me to exit the house and close the frontdoor before the alarm is enabled.
Similarly when entering, i want to have the time to enter the security code for disarming the alarm, before the sirens are triggered.
Both functions already work quite well, but i'm limited by the fact domoticz calls the time_ scripts only every minute.
I would like to change this to every 10 seconds, such that the delay times i programmed can be set more accurately.
Is there any way to do so?
I already thought of making a cron job for periodically updating a Domoticz user variable through the JSON API, and have my LUA script called upon change of this variable.
However this seems like quite a dirty workaround to me, perhaps not the best practice.
Any thoughts?
Changing interval of LUA time scripts
Moderator: leecollings
-
- Posts: 15
- Joined: Tuesday 05 April 2016 22:22
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Changing interval of LUA time scripts
Domoticz on RPi3 + mochad + razberry + RFXCom.
Devices: lamps / blinds / curtains / alarm.
Controls: iOS app / RF remote.
TBD: ir TV remote control, presence detection.
Devices: lamps / blinds / curtains / alarm.
Controls: iOS app / RF remote.
TBD: ir TV remote control, presence detection.
- Egregius
- Posts: 2589
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: Changing interval of LUA time scripts
I would do it that way, update a dummy device that triggers the script.
-
- Posts: 15
- Joined: Tuesday 05 April 2016 22:22
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Changing interval of LUA time scripts
I ended up making a node.js web server running in the background.
This web server implements the setTimeout() and setInterval() methods for time based triggering.
The web server makes use of the JSON API for updating and requesting domoticz devices.
A huge advantage that all timer/interval objects can be stored as global variables, and can be cancelled using clearTimeout() and clearInterval().
In my case, when i enter my house while the alarm is on, the door sensor enables a timer which triggers the siren after 30 secs.
If i disarm the alarm before the 30 secs, the clearTimeout is called such that the siren will not go off.
This web server implements the setTimeout() and setInterval() methods for time based triggering.
The web server makes use of the JSON API for updating and requesting domoticz devices.
A huge advantage that all timer/interval objects can be stored as global variables, and can be cancelled using clearTimeout() and clearInterval().
In my case, when i enter my house while the alarm is on, the door sensor enables a timer which triggers the siren after 30 secs.
If i disarm the alarm before the 30 secs, the clearTimeout is called such that the siren will not go off.
Domoticz on RPi3 + mochad + razberry + RFXCom.
Devices: lamps / blinds / curtains / alarm.
Controls: iOS app / RF remote.
TBD: ir TV remote control, presence detection.
Devices: lamps / blinds / curtains / alarm.
Controls: iOS app / RF remote.
TBD: ir TV remote control, presence detection.
Who is online
Users browsing this forum: No registered users and 1 guest