Running time script every 30 secs
Moderator: leecollings
-
- Posts: 26
- Joined: Wednesday 04 November 2015 10:26
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Running time script every 30 secs
Hi,
Anyone knows if it is possible to run the time based scripts more often?
For instance, twice per minute instead of 'only' one time?
I noticed my presence detection isn't fast enough.
Cheers.
Anyone knows if it is possible to run the time based scripts more often?
For instance, twice per minute instead of 'only' one time?
I noticed my presence detection isn't fast enough.
Cheers.
- Egregius
- Posts: 2589
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: Running time script every 30 secs
Run it by cron.
* * * * * /path/script
* * * * * sleep 30 && /path/script
* * * * * /path/script
* * * * * sleep 30 && /path/script
-
- Posts: 26
- Joined: Wednesday 04 November 2015 10:26
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Running time script every 30 secs
Oh can LUA scripts be started from the shell as well?
I thought it was an interal domoticz thingy.
I thought it was an interal domoticz thingy.
- Egregius
- Posts: 2589
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: Running time script every 30 secs
Don't know about lua, I don't use that
Php does everything I want

Php does everything I want

- jvdz
- Posts: 2266
- Joined: Tuesday 30 December 2014 19:25
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.107
- Location: Netherlands
- Contact:
Re: Running time script every 30 secs
Yes you can but won't have the event tables available so need to use JSON call to request information or send commands from/to Domoticz.void wrote:Oh can LUA scripts be started from the shell as well?
I thought it was an interal domoticz thingy.
Jos
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
-
- Posts: 26
- Joined: Wednesday 04 November 2015 10:26
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Running time script every 30 secs
Do you have an example Jos?
I thought it would be easyer to call a second bash script in the LUA that slept for x-seconds, but LUA is screaming in the logs that the script is running longer then 10 seconds.
Apparently that's a bad thing...
I thought it would be easyer to call a second bash script in the LUA that slept for x-seconds, but LUA is screaming in the logs that the script is running longer then 10 seconds.
Apparently that's a bad thing...
-
- Posts: 890
- Joined: Tuesday 30 September 2014 8:49
- Target OS: Linux
- Domoticz version: beta
- Location: The Netherlands
- Contact:
Re: Running time script every 30 secs
I don't know how your presence detection works, but maybe you can convert the script to a 'script_device_presence.lua' instead of a 'script_time_presence.lua' ?
A script_device is ran on EVERY device update, so much faster.
Then in the script, check for your device if it has changed:
if devicechanged(['switch1234']== 'On')
rest of your script...
A script_device is ran on EVERY device update, so much faster.
Then in the script, check for your device if it has changed:
if devicechanged(['switch1234']== 'On')
rest of your script...
I am not active on this forum anymore.
-
- Posts: 26
- Joined: Sunday 04 October 2015 11:25
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: France
- Contact:
Re: Running time script every 30 secs
Perhaps both
Having a shell script checking presence every xx s and, when happened, only setting on a domoticz dummy device so a domoticz lua script later make the rest of the job.

Having a shell script checking presence every xx s and, when happened, only setting on a domoticz dummy device so a domoticz lua script later make the rest of the job.
- jvdz
- Posts: 2266
- Joined: Tuesday 30 December 2014 19:25
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.107
- Location: Netherlands
- Contact:
Re: Running time script every 30 secs
You could look at the scripts that simon (and me for the menu extension) build for DTGBOT. ( https://www.domoticz.com/wiki/Remote_Co ... legram_Bot)void wrote:Do you have an example Jos?
I thought it would be easyer to call a second bash script in the LUA that slept for x-seconds, but LUA is screaming in the logs that the script is running longer then 10 seconds.
Apparently that's a bad thing...
There are several functions in there to retrieve device status and set devices.
Jos
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
-
- Posts: 26
- Joined: Wednesday 04 November 2015 10:26
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Running time script every 30 secs
It's this one viewtopic.php?f=23&t=5256ThinkPad wrote:I don't know how your presence detection works, but maybe you can convert the script to a 'script_device_presence.lua' instead of a 'script_time_presence.lua' ?
A script_device is ran on EVERY device update, so much faster.
Then in the script, check for your device if it has changed:
if devicechanged(['switch1234']== 'On')
rest of your script...
Every <time based, so 1 minute> the LUA runs arp-scan and updates the dummy switches.
Perhaps changing to a device script might work, I'll check it out.
Thanks!
-
- Posts: 26
- Joined: Wednesday 04 November 2015 10:26
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Running time script every 30 secs
It works in basic, but it's running multiple times simultainiously now.
This results in a double notification from the Telegram bot and other triggers such as turning off all the lights being executed two times right after eachother.
As you can see the detection of the phone (Device name is SGS6) gets triggered twice, with 200ms apart.Log:
2015-12-03 11:42:25.233 LUA: SGS6; now:2015-12-03 11:42:24; last seen: 2015-12-03 11:39:23
2015-12-03 11:42:25.235 EventSystem: Script event triggered: /home/pi/domoticz/scripts/lua/script_device_Presence.lua
2015-12-03 11:42:26.403 LUA: SGS6; now:2015-12-03 11:42:25; last seen: 2015-12-03 11:39:23
2015-12-03 11:42:26.405 EventSystem: Script event triggered: /home/pi/domoticz/scripts/lua/script_device_Presence.lua
2015-12-03 11:42:27.564 EventSystem: Script event triggered: /home/pi/domoticz/scripts/lua/script_device_Presence.lua
2015-12-03 11:42:27.572 LUA: *** No trusted phones connected to wireless, enabling alarm and turning off lights ***
2015-12-03 11:42:27.764 EventSystem: Script event triggered: /home/pi/domoticz/scripts/lua/script_device_Arm.lua
2015-12-03 11:42:26.414 (DUMMY) Lighting 1 (SGS6)
2015-12-03 11:42:28.934 EventSystem: Script event triggered: /home/pi/domoticz/scripts/lua/script_device_Presence.lua
2015-12-03 11:42:30.134 EventSystem: Script event triggered: /home/pi/domoticz/scripts/lua/script_device_Presence.lua
2015-12-03 11:42:30.142 LUA: *** No trusted phones connected to wireless, enabling alarm and turning off lights ***
2015-12-03 11:42:30.289 EventSystem: Script event triggered: /home/pi/domoticz/scripts/lua/script_device_Arm.lua
2015-12-03 11:42:28.942 (DUMMY) Lighting 1 (SGS6)
This results in a double notification from the Telegram bot and other triggers such as turning off all the lights being executed two times right after eachother.
Who is online
Users browsing this forum: No registered users and 1 guest