Need help with aeon labs door sensor on garage door

I am new to vera and have an aeon labs door sensor on my garage door. I would like to know how to setup it up so between 6:00pm and 10:00pm when the garage door is opened it will turn on an interior light. If someone knows how to do this and could provide instructions that someone new could follow I would greatly appreciate it.

This is what I would do:
Create a scene
Add the commands to turn on the lights you want.
Add an event to the scene based on the aeon door signal.
Add the following Luup code to the Scene.

local Hr = tonumber(os.date("%H"))
if (luup.is_night())then
  if (HR < 22) then
     return true
  end
end
return false

If this code returns true … the commands are executed.
Instead of 6:00 PM I used night time. The value of HR is in the range 0 - 23

@sdittoc,

Welcome!

Also, this wiki page may have some useful snippets.

oTi@ thanks for the wiki…

This is what I would do: Create a scene Add the commands to turn on the lights you want. Add an event to the scene based on the aeon door signal. Add the following Luup code to the Scene.

Code: [Select]
local Hr = tonumber(os.date(“%H”))
if (luup.is_night())then
if (HR < 22) then
return true
end
end
return false
If this code returns true … the commands are executed.
Instead of 6:00 PM I used night time. The value of HR is in the range 0 - 23

I am not home so i can not test this right now. This is what I did. Please tell me if I followed your directions correctly:

  1. I created a scene “Kitchen Lights on”
  2. I added the light to turn on to the scene
  3. I created a trigger for aeon labs door sensor when armed sensor is tripped.
  4. I added luup event code you gave me to the above trigger event.

Thanks again for the help.

When I got home from work tonight garage door opened and turned on the kitchen lights. Thanks “RichardTSchaefer” Just to test it again i turned off the lights and opened and closed the door a few more times but the lights did not come on. It seems after 15 - 20 minutes (have to test more) the lights would turn on again when i opened the door. Is there a setting I missed somewhere??

Thanks,

Some sensors have a setting on how often they send an event.
This is usually to save battery power.

I do not think there is one for the Aeon door sensor.

I just checked mine … it triggers every time … I had a 30 second interval.
I have a notification (using VeraAlert) every time my garage door is opened.

Yes, thanks I was able to spend more time this evening and everytime i open the door the lights would turn on. I then closed the door and turned the lights off. I repeated this 5 times at about 30 sec intervals Thanks again for the help.

Can someone tell me how to edit this code so the event only turns the lights on between 18:00 and 23:00? Sometimes I leave for work early and when i open the garage door the lights in the house are turning on.

Code: [Select] local Hr = tonumber(os.date("%H")) if (luup.is_night())then if (HR < 22) then return true end end return false If this code returns true ... the commands are executed

Have you tried the code from the wiki page?

not that hard as it looks ::slight_smile:


local Hr = tonumber(os.date("%H"))
if (luup.is_night())then
  if 
(HR < 23) then
     return true
  
end
end
return false

What happens after midnight and before the sun is up? (Going by the spirit of the code.)


local Hr = tonumber(os.date("%H"))
if (luup.is_night())then
  if 

(HR < 23) then
     if

 
(HR >18)

 
return true

end
end
return false

?

Thanks, oTi@
I missed this when i searched the wiki before. I have tested this and it is working great. By the way the other code worked but night time is considered dark as far as i can tell. So if I left the house at 6am it would turn the lights on in the house.

Do something between 16:00 and 21:15:

local t = os.date(‘*t’)
local current_second = t.hour * 3600 + t.min * 60 + t.sec – number of seconds since midnight
local min_time_in_seconds = 16 * 3600 + 0 * 60 – 16:00
local max_time_in_seconds = 21 * 3600 + 15 * 60 – 21:15

if (current_second > min_time_in_seconds) and (current_second < max_time_in_seconds) then
– do something
else
return false
end

i favor your approach sdittoc, as one can set any timeframe in a day that way :slight_smile:

Exactly; that’s why my initial response was a link to the wiki page that has a more flexible implementation. (You can click on the ‘wiki page’ bit in that post; and in this one. :slight_smile: )