Blocky timer automatic off after xx minutes

Moderator: leecollings

Post Reply
rizzah
Posts: 75
Joined: Monday 17 October 2016 16:11
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Groningen
Contact:

Blocky timer automatic off after xx minutes

Post 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
theolsen
Posts: 46
Joined: Wednesday 31 July 2013 11:15
Target OS: -
Domoticz version:
Contact:

Re: Blocky timer automatic off after xx minutes

Post by theolsen »

desertdog
Posts: 84
Joined: Sunday 14 August 2016 13:45
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.1
Location: Netherlands
Contact:

Re: Blocky timer automatic off after xx minutes

Post 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

rizzah
Posts: 75
Joined: Monday 17 October 2016 16:11
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Groningen
Contact:

Re: Blocky timer automatic off after xx minutes

Post 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?
Slinkos
Posts: 81
Joined: Thursday 10 December 2015 0:21
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.4834
Location: Netherlands
Contact:

Re: Blocky timer automatic off after xx minutes

Post 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.
rizzah
Posts: 75
Joined: Monday 17 October 2016 16:11
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Groningen
Contact:

Re: Blocky timer automatic off after xx minutes

Post 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.
Slinkos
Posts: 81
Joined: Thursday 10 December 2015 0:21
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.4834
Location: Netherlands
Contact:

Re: Blocky timer automatic off after xx minutes

Post 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.
User avatar
StanHD
Posts: 347
Joined: Friday 12 July 2013 16:09
Target OS: Windows
Domoticz version:
Location: East Sussex, UK
Contact:

Re: Blocky timer automatic off after xx minutes

Post 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. ;)
Domoticz Main - Intel nuc, Windows, RFXTRX433E. Lan Relay Boards, Aeon Z-Stick Gen 5, Evohome HGI80, Milight WiFi, MySensors Ethernet Gateway, Harmony Hub
Python:- Broadlink RM2, Sonos
HA-Bridge - Amazon Echo / Alexa
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests