I'm having an issue. It seems Domoticz only runs scripts when something changes somewhere. This means LUA scripts with timer functions don't work!
I created a LUA script that gives an alarm if a door remains open for more then a minute. The script itself works fine! However - the alarm doesn't sound if no device in my Domoticz set-up changes after this minute is reached.
It does work again when a device changes status, doesn't matter which device - can be a totally different device used in an entirely different script. But if nothing changes in my set-up it seems Domoticz falls asleep and timer functions alone won't wake Domoticz up...
Anyone know why this is? Is there a way to solve this? Been browsing through the settings, but found nothing that makes Domoticz fall asleep almost immediately from the moment no device changes no more.
Timer scripts don't work if no devices change
Moderator: leecollings
- jvdz
- Posts: 2333
- Joined: Tuesday 30 December 2014 19:25
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.107
- Location: Netherlands
- Contact:
Re: Timer scripts don't work if no devices change
Is this an internal script created with the internal editor or a file in the script/lua directory?
Internal: What are the settings for the script at the right side of the window?
External file: What is the name of the script file?
Maybe you can show the script as well?
Jos
Internal: What are the settings for the script at the right side of the window?
External file: What is the name of the script file?
Maybe you can show the script as well?
Jos
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
-
- Posts: 331
- Joined: Monday 03 July 2017 19:58
- Target OS: NAS (Synology & others)
- Domoticz version:
- Contact:
Re: Timer scripts don't work if no devices change
Did you by any chance leave 'All' or 'Device' in your script settings? I believe it should be 'Time' in Events settings page in order to execute time scripts.
-
- Posts: 24
- Joined: Wednesday 20 September 2017 15:24
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Timer scripts don't work if no devices change
Code: Select all
t1 = os.time()
s = otherdevices_lastupdate['Koelkast']
-- returns a date time like 2013-07-11 17:23:12
year = string.sub(s, 1, 4)
month = string.sub(s, 6, 7)
day = string.sub(s, 9, 10)
hour = string.sub(s, 12, 13)
minutes = string.sub(s, 15, 16)
seconds = string.sub(s, 18, 19)
commandArray = {}
print (s)
t2 = os.time{year=year, month=month, day=day, hour=hour, min=minutes, sec=seconds}
difference = (os.difftime (t1, t2))
if (otherdevices['Koelkast'] == 'Open' and difference > 60 ) then
print ("Koelkast open!")
commandArray['MP3']='Set Level: 16'
end
return commandArray
With the setting 'All' it sortof works, except that the alarm triggers every millisecond and thus plays no sound at all.... :/
Update: With setting Time it does seem to work a bit - however this polls every minute. This means the alarm can have a delay of max. a minute.... Not really practical. But it does work. A bit....
- jvdz
- Posts: 2333
- Joined: Tuesday 30 December 2014 19:25
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.107
- Location: Netherlands
- Contact:
Re: Timer scripts don't work if no devices change
That is the idea for the Time scripts, which are run every minute on the minute.

Jos
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
Who is online
Users browsing this forum: No registered users and 1 guest