more G-Labs products

Author Topic: Schedule motion sensor at night  (Read 1266 times)

February 24, 2015, 11:57:53 PM
Read 1266 times

domotica86

  • *
  • Information
  • Newbie
  • Posts: 22
Hi,

I trie to accomplish that my motion sensor turns the lights on downstairs, but only at night. I can't seem to figure out how to use the schedule.datehour or schedule.time value. Should it work as I did it in the screenshot?

April 06, 2015, 02:46:50 PM
Reply #1

Ossi_Jr

  • *
  • Information
  • Newbie
  • Posts: 8
Looking at your logical expression, I'd say it can never be true. If you translate it to be a little more speaking it says
If x>23 and x<6

This impossible to be reached.
You need it to be
If x<6 or x>23

Also keep in mind that Scheduler.DateHour does not consider minutes.
Hour>23 can only be 24. Therefore your expression would only be true when the hour is 24 or higher. Considering a 24h clock which starts at 0:00 this again would fail to ever be true. In order to have an action for example to be triggered when time is after 22:30 you need two statements:
DateHour > 21
DateMinute > 29

I hope this helps.

April 22, 2015, 02:53:02 PM
Reply #2

NickP

  • *
  • Information
  • Newbie
  • Posts: 24
it looks like your using an X10 motion sensor. These have a light dark sensor as well. For what it is worth,  I found it more useful to switch lights on if the sensor sensed motion and believed it was dark rather than an absolute time.

April 22, 2015, 04:57:03 PM
Reply #3

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
Agreed.  If you are using a single X10 motion sensor to control a single or multiple lights and you don't want to use manual light controls (other than for a backup override), then I would recommend using the built-in light detector to determine whether the light should turn on based on motion.

I use a pair of X10 sensors to control a single light and since they are not linked in any way, I have to decouple the sensor from the light.  I use another X10 motion sensor for a different light that has no manual local control and just let the motion sensor work as it's designed.  That light is far more reliable and quicker than the decoupled light.  The only caveat is that sometimes an OFF command is missed so the coupled light could potentially stay on.  To negate this issue, I use both a timeout (automatically turn light off if no motion or OFF command seen in xx minutes) and a CRON event (turn off lights at dawn) as a backup.