Set for X minutes, but I want light when motion is still ON
Moderator: leecollings
-
- Posts: 4
- Joined: Monday 07 April 2014 12:13
- Target OS: Linux
- Domoticz version:
- Contact:
Set for X minutes, but I want light when motion is still ON
Hi all,
I am using Blocky; When I detect motion, I want to set the light on for 1 minutes. No problem sofar.
But after 1 minute, the light is switched off, even when I'm still in the room. That's just the way the [Set for X minutes] works.
What I want is the light to be on for let's say 1 minute, until motion is no longer detected. Only then should the light switch off after 1 minute.
For example; I have Garden lights which switch on when I am in the garden. I don't want them to switch off every minute, and then me waving at the PIR .
So what I am looking for is;
When I detect motion, I want to set the light on for 1 minutes.
When motion is detected again (PIR is still giving the ON status) the timer should reset to 0 and start counting again.
Is this even possible in Blocky???
I am using Blocky; When I detect motion, I want to set the light on for 1 minutes. No problem sofar.
But after 1 minute, the light is switched off, even when I'm still in the room. That's just the way the [Set for X minutes] works.
What I want is the light to be on for let's say 1 minute, until motion is no longer detected. Only then should the light switch off after 1 minute.
For example; I have Garden lights which switch on when I am in the garden. I don't want them to switch off every minute, and then me waving at the PIR .
So what I am looking for is;
When I detect motion, I want to set the light on for 1 minutes.
When motion is detected again (PIR is still giving the ON status) the timer should reset to 0 and start counting again.
Is this even possible in Blocky???
-
- Posts: 329
- Joined: Tuesday 16 July 2013 22:54
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 3.8807
- Location: North East England
- Contact:
Re: Set for X minutes, but I want light when motion is still
I don't believe you can do what you want with Blockly, as if the light is on then you can't turn it on again, so the light has to go off, before you can turn it on again.
Using Lua it is possible to script exactly this action, by having one script which turns the light on and a seperate timer script which turns the light off after the motion sensor has not been activated for a set number of minutes. Have a look at this wiki page for details - http://www.domoticz.com/wiki/Smart_Lua_Scripts.
Using Lua it is possible to script exactly this action, by having one script which turns the light on and a seperate timer script which turns the light off after the motion sensor has not been activated for a set number of minutes. Have a look at this wiki page for details - http://www.domoticz.com/wiki/Smart_Lua_Scripts.
Raspberry Pi 2 B - 2A@5V PSU - Raspbian + Domoticz + RFXtrx(89), LightwaveRF House(dimmers, sockets, wireless/mood switches), Owl CM113, 4 LaCross Temp / Humidity Sensors, 4 Siemens PIR, Smappee, Solaredge, ESP8266
- bizziebis
- Posts: 182
- Joined: Saturday 19 October 2013 14:00
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 3.8805
- Location: The Netherlands
- Contact:
Re: Set for X minutes, but I want light when motion is still
It's possible with blocky. Just add another (dummy) switch witch will switch off after 1 minute (it's a setting of the switch) and call it for example 1 Min Timer (in my example)
(sorry for the big image, my tablet has a high dpi setting)
Every time the PIR detects motion the timer will be activated again and starts counting down from 60 seconds. Until the last movement is detected, then the light will go off.'
You can do a lot of nice stuff with blocky, just think a little further than the standard blocks
(sorry for the big image, my tablet has a high dpi setting)
Every time the PIR detects motion the timer will be activated again and starts counting down from 60 seconds. Until the last movement is detected, then the light will go off.'
You can do a lot of nice stuff with blocky, just think a little further than the standard blocks
- Keptenkurk
- Posts: 103
- Joined: Wednesday 21 August 2013 17:24
- Target OS: -
- Domoticz version:
- Location: Waalre, The Netherlands
- Contact:
Re: Set for X minutes, but I want light when motion is still
Smart Lua Scripts now under Domoticz concepts in the Wiki...
/paul
/paul
-
- Posts: 329
- Joined: Tuesday 16 July 2013 22:54
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 3.8807
- Location: North East England
- Contact:
Re: Set for X minutes, but I want light when motion is still
Neat piece of Blockly, takes quite some reading, nice logic -
It appears that "dummy" switches are treated differently to "physical" switches, as you are relying on switching your "1 minute timer on" while it is already on, which is inconsistent with not being able to skip the dummy switch and just do it for the light with 1 minute to off and multiple ons -
Or am I missing something obvious
It appears that "dummy" switches are treated differently to "physical" switches, as you are relying on switching your "1 minute timer on" while it is already on, which is inconsistent with not being able to skip the dummy switch and just do it for the light with 1 minute to off and multiple ons -
Or am I missing something obvious
Raspberry Pi 2 B - 2A@5V PSU - Raspbian + Domoticz + RFXtrx(89), LightwaveRF House(dimmers, sockets, wireless/mood switches), Owl CM113, 4 LaCross Temp / Humidity Sensors, 4 Siemens PIR, Smappee, Solaredge, ESP8266
-
- Posts: 4
- Joined: Monday 07 April 2014 12:13
- Target OS: Linux
- Domoticz version:
- Contact:
Re: Set for X minutes, but I want light when motion is still
Thanks all for the input.
I have installed the extended Smart Lua Script, and I am still testing the enviroment.
A question about the script_device_pirs :
I have a dummy switch in Domoticz for a nighttime, which starts 1,5 hours earlier than the actual sundown time. Now I want the x in PIRxrzSwitchName also to accept a check on the switch, instead of the custom timer, so I have added:
-- x specifies when the PIR controls - a=all day, n=nighttime, d=daytime,
-- 1=custom timer 1 set to 22:00 to 07:30
-- s=Dummy-Nightime (Dummy switch set in Domoticz which controls manual set day-nighttime)
In the script I have added:
function timetest(opertime)
if opertime == "a" then
return true
end
if opertime == "n" then
if timeofday['Nighttime'] then
return true
else
return false
end
end
if opertime == "d" then
if timeofday['Daytime'] then
return true
else
return false
end
end
if opertime == "s" then
if (otherdevices['Dummy-Nightime'] == "On") then
return true
else
return false
end
end
if opertime == "1" then
time = os.date("*t")
return customtest(time.hour, time.min, 22, 0, 7, 30)
end
return false
end
My question, (as I am completely new to lua), is the opertime="s" if...then... part correct??
I have installed the extended Smart Lua Script, and I am still testing the enviroment.
A question about the script_device_pirs :
I have a dummy switch in Domoticz for a nighttime, which starts 1,5 hours earlier than the actual sundown time. Now I want the x in PIRxrzSwitchName also to accept a check on the switch, instead of the custom timer, so I have added:
-- x specifies when the PIR controls - a=all day, n=nighttime, d=daytime,
-- 1=custom timer 1 set to 22:00 to 07:30
-- s=Dummy-Nightime (Dummy switch set in Domoticz which controls manual set day-nighttime)
In the script I have added:
function timetest(opertime)
if opertime == "a" then
return true
end
if opertime == "n" then
if timeofday['Nighttime'] then
return true
else
return false
end
end
if opertime == "d" then
if timeofday['Daytime'] then
return true
else
return false
end
end
if opertime == "s" then
if (otherdevices['Dummy-Nightime'] == "On") then
return true
else
return false
end
end
if opertime == "1" then
time = os.date("*t")
return customtest(time.hour, time.min, 22, 0, 7, 30)
end
return false
end
My question, (as I am completely new to lua), is the opertime="s" if...then... part correct??
-
- Posts: 329
- Joined: Tuesday 16 July 2013 22:54
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 3.8807
- Location: North East England
- Contact:
Re: Set for X minutes, but I want light when motion is still
Your code is fine, it should work, I will add it as extension to the wiki page I created - http://www.domoticz.com/wiki/Smart_Lua_Scripts
Nice idea of a way to extend the script and a good example of the flexibility of Domoticz. My only thought is that you could end up with lots of dummy switches and forget what they are, but this is not likely as you won't want many. My other thought is encode something in the Dummy switches name, not sure what.
In general the ultimate test is does it work? If you don't see any errors in the log and it does what it should then it is right.
Simon
Nice idea of a way to extend the script and a good example of the flexibility of Domoticz. My only thought is that you could end up with lots of dummy switches and forget what they are, but this is not likely as you won't want many. My other thought is encode something in the Dummy switches name, not sure what.
In general the ultimate test is does it work? If you don't see any errors in the log and it does what it should then it is right.
Simon
Raspberry Pi 2 B - 2A@5V PSU - Raspbian + Domoticz + RFXtrx(89), LightwaveRF House(dimmers, sockets, wireless/mood switches), Owl CM113, 4 LaCross Temp / Humidity Sensors, 4 Siemens PIR, Smappee, Solaredge, ESP8266
-
- Posts: 4
- Joined: Monday 07 April 2014 12:13
- Target OS: Linux
- Domoticz version:
- Contact:
Re: Set for X minutes, but I want light when motion is still
Thank you for your reply.
The obvious disadvantage using the dummy switch of course, is the 'hard coded' switch name. It's name in the script will not change when you change the name in Domoticz causing errors. And also, for every switch you want to include, you will need an additional IF THEN code with its correct switch name.
But for me, it is working. (I only have 1 dummy switch at this moment, to overcome the sundown time. It's already almost dark in my house at sundown time, so this is my workaround.
The obvious disadvantage using the dummy switch of course, is the 'hard coded' switch name. It's name in the script will not change when you change the name in Domoticz causing errors. And also, for every switch you want to include, you will need an additional IF THEN code with its correct switch name.
But for me, it is working. (I only have 1 dummy switch at this moment, to overcome the sundown time. It's already almost dark in my house at sundown time, so this is my workaround.
-
- Posts: 329
- Joined: Tuesday 16 July 2013 22:54
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 3.8807
- Location: North East England
- Contact:
Re: Set for X minutes, but I want light when motion is still
Your code looks good.
I am warming to the dummy switch idea and it needn't require recoding for each new switch.
Thinking out loud for groups:
I am warming to the dummy switch idea and it needn't require recoding for each new switch.
Thinking out loud for groups:
- PIRsg4Sundown would activate group Sundown only if DummySundown was on.
PIRsg2CatInHouse would activate group CatInHouse only if DummyCatInHouse was on.
PIRsg0GarageDoorClosed would activate group GarageDoorClosed only if DummyGarageDoorClosed was on.
Raspberry Pi 2 B - 2A@5V PSU - Raspbian + Domoticz + RFXtrx(89), LightwaveRF House(dimmers, sockets, wireless/mood switches), Owl CM113, 4 LaCross Temp / Humidity Sensors, 4 Siemens PIR, Smappee, Solaredge, ESP8266
-
- Posts: 329
- Joined: Tuesday 16 July 2013 22:54
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 3.8807
- Location: North East England
- Contact:
Re: Set for X minutes, but I want light when motion is still
Actually using dummy switches makes life a lot simpler, so I have taken out the custom timing options and replaced it with the general version of your dummy switch idea.
The modified script is now on the wiki - http://www.domoticz.com/wiki/Smart_Lua_ ... ied_Coding
The modified script is now on the wiki - http://www.domoticz.com/wiki/Smart_Lua_ ... ied_Coding
Raspberry Pi 2 B - 2A@5V PSU - Raspbian + Domoticz + RFXtrx(89), LightwaveRF House(dimmers, sockets, wireless/mood switches), Owl CM113, 4 LaCross Temp / Humidity Sensors, 4 Siemens PIR, Smappee, Solaredge, ESP8266
-
- Posts: 4
- Joined: Monday 07 April 2014 12:13
- Target OS: Linux
- Domoticz version:
- Contact:
Re: Set for X minutes, but I want light when motion is still
Even better! Great going Simon.
-
- Posts: 86
- Joined: Sunday 01 May 2016 0:34
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: NL
- Contact:
Re: Set for X minutes, but I want light when motion is still ON
did you ever get this to work? I'm looking to do the same thing
-
- Posts: 86
- Joined: Sunday 01 May 2016 0:34
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: NL
- Contact:
Re: Set for X minutes, but I want light when motion is still ON
So with the blocky below the lights turn on when the amount of lux < 15 and motion is detected on one of the motion sensors (works). The 2 minute timer has a 120 sec delay on 'off' and even though a new motion is detected and the '2 minute timer' switch gets updated, all lights still turn off after the initial 120 seconds.
Any suggestions/ideas?
Any suggestions/ideas?
-
- Posts: 1601
- Joined: Friday 18 October 2013 23:33
- Target OS: Raspberry Pi / ODroid
- Domoticz version: BETA
- Location: Arnhem/Nijmegen Nederland
- Contact:
Re: Set for X minutes, but I want light when motion is still ON
try to remove the 3 event.
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
-
- Posts: 86
- Joined: Sunday 01 May 2016 0:34
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: NL
- Contact:
Re: Set for X minutes, but I want light when motion is still ON
Got it to work!
-
- Posts: 1
- Joined: Wednesday 09 November 2016 1:03
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Set for X minutes, but I want light when motion is still ON
Hi.
This simple Blockly code is working
This simple Blockly code is working
- Attachments
-
- Domoticz Motion.JPG (25.04 KiB) Viewed 12360 times
Re: Set for X minutes, but I want light when motion is still ON
Thanks for the tip! Will try it. I was doing something complicated where I had a separate blocky script that would turn off after x seconds of motion but it would always trigger and not get reset if there motion in between the interval.Tjenko wrote:Hi.
This simple Blockly code is working
Re: Set for X minutes, but I want light when motion is still
Sorry to revive an old topic, but using this method every time the timer is set to on, it will detect the second blockly row, see that the timer is set on, and set it on again:bizziebis wrote: ↑Friday 18 April 2014 18:25 It's possible with blocky. Just add another (dummy) switch witch will switch off after 1 minute (it's a setting of the switch) and call it for example 1 Min Timer (in my example)
blocky.jpg
(sorry for the big image, my tablet has a high dpi setting)
Every time the PIR detects motion the timer will be activated again and starts counting down from 60 seconds. Until the last movement is detected, then the light will go off.'
You can do a lot of nice stuff with blocky, just think a little further than the standard blocks
Code: Select all
2017-09-20 20:38:11.735 EventSystem: Event triggered: Moodlight voortuin_2
2017-09-20 20:38:11.737 (Dummy) Lighting 2 (Timer 1 minuut voortuin)
2017-09-20 20:38:11.974 EventSystem: Event triggered: Moodlight voortuin_2
2017-09-20 20:38:11.984 (Dummy) Lighting 2 (Timer 1 minuut voortuin)
2017-09-20 20:38:12.209 EventSystem: Event triggered: Moodlight voortuin_2
2017-09-20 20:38:12.222 (Dummy) Lighting 2 (Timer 1 minuut voortuin)
2017-09-20 20:38:12.230 (RFXCOM) Temp (Unknown)
2017-09-20 20:38:12.415 EventSystem: Event triggered: Moodlight voortuin_2
2017-09-20 20:38:12.417 (Dummy) Lighting 2 (Timer 1 minuut voortuin)
2017-09-20 20:38:12.606 EventSystem: Event triggered: Moodlight voortuin_2
2017-09-20 20:38:12.608 (Dummy) Lighting 2 (Timer 1 minuut voortuin)
2017-09-20 20:38:12.806 EventSystem: Event triggered: Moodlight voortuin_2
2017-09-20 20:38:12.808 (Dummy) Lighting 2 (Timer 1 minuut voortuin)
2017-09-20 20:38:13.017 EventSystem: Event triggered: Moodlight voortuin_2
2017-09-20 20:38:13.020 (Dummy) Lighting 2 (Timer 1 minuut voortuin)
2017-09-20 20:38:13.227 EventSystem: Event triggered: Moodlight voortuin_2
2017-09-20 20:38:13.229 (Dummy) Lighting 2 (Timer 1 minuut voortuin)
2017-09-20 20:38:13.438 EventSystem: Event triggered: Moodlight voortuin_2
2017-09-20 20:38:13.441 (Dummy) Lighting 2 (Timer 1 minuut voortuin)
2017-09-20 20:38:13.650 EventSystem: Event triggered: Moodlight voortuin_2
2017-09-20 20:38:13.652 (Dummy) Lighting 2 (Timer 1 minuut voortuin)
2017-09-20 20:38:13.863 EventSystem: Event triggered: Moodlight voortuin_2
2017-09-20 20:38:13.866 (Dummy) Lighting 2 (Timer 1 minuut voortuin)
2017-09-20 20:38:14.075 EventSystem: Event triggered: Moodlight voortuin_2
2017-09-20 20:38:14.077 (Dummy) Lighting 2 (Timer 1 minuut voortuin)
2017-09-20 20:38:14.286 EventSystem: Event triggered: Moodlight voortuin_2
2017-09-20 20:38:14.295 (Dummy) Lighting 2 (Timer 1 minuut voortuin)
2017-09-20 20:38:14.528 EventSystem: Event triggered: Moodlight voortuin_2
2017-09-20 20:38:14.532 (Dummy) Lighting 2 (Timer 1 minuut voortuin)
2017-09-20 20:38:14.723 EventSystem: Event triggered: Moodlight voortuin_2
2017-09-20 20:38:14.725 (Dummy) Lighting 2 (Timer 1 minuut voortuin)
2017-09-20 20:38:14.933 EventSystem: Event triggered: Moodlight voortuin_2
2017-09-20 20:38:14.943 (Dummy) Lighting 2 (Timer 1 minuut voortuin)
2017-09-20 20:38:15.072 Hardware Monitor: Fetching data (System sensors)
2017-09-20 20:38:15.152 EventSystem: Event triggered: Moodlight voortuin_2
2017-09-20 20:38:15.156 (Dummy) Lighting 2 (Timer 1 minuut voortuin)
2017-09-20 20:38:16.235 EventSystem: Event triggered: Moodlight voortuin_2
2017-09-20 20:38:16.238 (Dummy) Lighting 2 (Timer 1 minuut voortuin)
*Edit, changed the off timer of the sensor
-
- Posts: 1
- Joined: Saturday 12 May 2018 0:19
- Target OS: NAS (Synology & others)
- Domoticz version:
- Contact:
Re: Set for X minutes, but I want light when motion is still
Sorry for getting back to this..but I'm new here, and I'm digging everything ehehehbizziebis wrote: ↑Friday 18 April 2014 18:25 It's possible with blocky. Just add another (dummy) switch witch will switch off after 1 minute (it's a setting of the switch) and call it for example 1 Min Timer (in my example)
blocky.jpg
(sorry for the big image, my tablet has a high dpi setting)
Every time the PIR detects motion the timer will be activated again and starts counting down from 60 seconds. Until the last movement is detected, then the light will go off.'
You can do a lot of nice stuff with blocky, just think a little further than the standard blocks
I tried the sequence you posted and everything worked fine. The only problem i have is that when i try to turn on the light manually, I can't. I think is because when turned on automatically I get "sensor off + timer off + light on"...what makes the light go off.
Thanks for any help.
Who is online
Users browsing this forum: No registered users and 1 guest