Sleep or Delay statement?

Post Reply
manjh
Posts: 194
Joined: Saturday 27 February 2016 13:49
Target OS: Raspberry Pi
Domoticz version: 3.8153
Location: NL
Contact:

Sleep or Delay statement?

Post by manjh » Friday 10 March 2017 1:45

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...
Hans

User avatar
Egregius
Posts: 2416
Joined: Thursday 09 April 2015 12:19
Target OS: Raspberry Pi
Domoticz version: BetaRPi2
Location: Beitem, BE
Contact:

Re: Sleep or Delay statement?

Post by Egregius » Friday 10 March 2017 4:36

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:

manjh
Posts: 194
Joined: Saturday 27 February 2016 13:49
Target OS: Raspberry Pi
Domoticz version: 3.8153
Location: NL
Contact:

Re: Sleep or Delay statement?

Post by manjh » Monday 20 March 2017 23:44

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.
Hans

candrea77
Posts: 35
Joined: Saturday 25 February 2017 19:42
Target OS: Raspberry Pi
Domoticz version: 3.8153
Location: Milano, Italy
Contact:

Re: Sleep or Delay statement?

Post by candrea77 » Tuesday 21 March 2017 23:38

You can use this simple function ....

Code: Select all

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

Regards
Sorry for any spelling mistake, English is not my native language.

DomoticZ running on Raspberry PI 3 Model B , with Raspbian Jessie Lite ,Monit , Ramfs, and Persistent USB device

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests