Page 1 of 1

Sleep or Delay statement?

Posted: Friday 10 March 2017 0:45
by manjh
I use several PIR sensors to switch on lights. With a recent Domoticz update I suddenly find that the lights donot switch on any more. After a lot of searching, I am beginning to suspect that the PIR sensors send multiple signals. Domoticz recognizes the first and starts my script, where a KAKU switch is activated to switch the lights on. I think this happens while the PIR sensor is still putting out signals.

I have two questions.
1. is there a logical explanaition why this has worked OK, and now suddenly not? Has Domoticz become faster in the last update?
2. what can I do to delay the processing? I was looking for a "sleep" or "delay", but cannot find anything. Ideally I would want to specify a sleeptime in milliseconds.

Thanks in advance...

Re: Sleep or Delay statement?

Posted: Friday 10 March 2017 3:36
by Egregius
In PHP you have sleep() for seconds and usleep() for microseconds, but hey, this is the lua section so I didn't say anything :lol:

Re: Sleep or Delay statement?

Posted: Monday 20 March 2017 22:44
by manjh
Egregius wrote:In PHP you have sleep() for seconds and usleep() for microseconds, but hey, this is the lua section so I didn't say anything :lol:
Yeah, well... if we had an easy way to insert Assembler into Domoticz.... but I want to stick to LUA here.

Re: Sleep or Delay statement?

Posted: Tuesday 21 March 2017 22:38
by candrea77
You can use this simple function ....

Code: Select all

function sleep(n)
    os.execute("sleep " .. tonumber(n))
end

Regards