Page 1 of 1

Blocky timer automatic off after xx minutes

Posted: Monday 30 October 2017 18:03
by rizzah
Hi,

I'm trying to create a script in blocky where it would turn on lights in a room when the motion sensor detects motion and automaticly turn off the lights after 1 minute of no activity. I cannot seem to get it working properly. Is there anyone who can paste me an example of how this is done?

Regards,
Peter

Re: Blocky timer automatic off after xx minutes

Posted: Monday 30 October 2017 20:18
by theolsen

Re: Blocky timer automatic off after xx minutes

Posted: Monday 30 October 2017 21:03
by desertdog
It depends what the state of your motion sensor is in Domoticz. If motion is 'on' and no motion is 'off' you can build something like this in blockly:

Code: Select all

if motion-sensor = on
set light/group = on
else if motion-sensor = off
set light/group = off After 60 seconds


Re: Blocky timer automatic off after xx minutes

Posted: Tuesday 31 October 2017 8:27
by rizzah
Thanks for your reactions. If i would use your idea @desertdog, would i have to set the timer-off setting of my Aeontec Multisensor to 1 second and work with dummy timers in domoticz?

Re: Blocky timer automatic off after xx minutes

Posted: Tuesday 31 October 2017 9:35
by Slinkos
What kind of motion sensor do you have? Because most of them have a parameter to determine after how many seconds after the motion, the motion sensor switches to off. That might also solve your problem. Then you can just turn off the light when the motion switch goes to off.

Re: Blocky timer automatic off after xx minutes

Posted: Tuesday 31 October 2017 9:54
by rizzah
@Slinkos, you are right, mine has one too (i got the Aeontec Multisensor). However you do want to remain flexable with your settings. For example, if i would have the light switch on between 07:00-08:00 for 15 minutes and 00:00-07:00 for only a minute. It kind of hard to think of a way which works with domoticz timers and the no-motion timer of the sensor.

Re: Blocky timer automatic off after xx minutes

Posted: Tuesday 31 October 2017 12:06
by Slinkos
I get your point. This is how I would do it in basic:

Code: Select all

If: Motion = 'On'
Set: Light = 'On'
Elseif: Motion = Of AND Light = 'On'
Set: Light = 'Off' AFTER 60 seconds
The big drawback of this blocky is that it wil turn your lights 'Off' after 60 seconds either way, also if there is motion detected in the meantime.
If you don't want to use LUA, then we can do it in Blocky by adding a dummy switch to it:

Code: Select all

If: Motion = 'On'
Set: Light = 'On'
Elseif: Motion' = Of AND Light = 'On'
Set: Dummy = 'On' AFTER 60 seconds
Elseif: Dummy = 'On' AND Motion = 'Off'
Set: Light = 'Off'
Elseif: Elseif: Dummy = 'On' AND Motion = 'On'
Set: Dummy = 'Off'
I did not test it, but I think that works.

Re: Blocky timer automatic off after xx minutes

Posted: Tuesday 31 October 2017 17:53
by StanHD
I use the Fibaro Motion / Multi Sensor.

All of the delay, blind time, sensitivity settings etc. are done in the Z-Wave settings for the sensor. Therefore it becomes a simple on-off device for Domoticz, and avoids the timer problems:-

Image

Bedroom PIR = Fibaro FGMS001
Bedroom Auto = Dummy switch to set the light to manual. Use the Domoticz switch timers here for setting the automation off before going to bed etc.
Bedroom Actual = Lux Level from FGMS001
Bedroom Centre Light = Controlled light

I don't know about your unit but hopefully you can do something similar.

All works for years for me. ;)