Does anyone have a recommendation on how to create an event based automation that also checks the time (or date)?
For example.
If Motion is detected and time is between 8pm and 8am (8am next day), then turn on a light.
Alternately if motion is detected and time is NOT between 8am and 8pm of the same day, then turn on the light.
The reason I want to use event based is because the cron checks minute by minute and would be "laggy" for something like motion detection.
You can use gw.requestTime(receiveTime) in your sketch to get the time from the server. So in this case as soon as an event has been triggered (your motion detector) your sketch will handle the switching of the light depending on the received time. Let me know if you need more information.
The light relay and Motion detector are different sensors. It would be preferable to keep the sketches simple and use automation to be complex. Also, the light relay's are inside the wall and not easily updated.
I guess i'm asking if its possible to use the real time inside the server automation.
I have not tried it yet, but could a Cron expression do that?
en.m.wikipedia.org/wiki/Cron
EDIT:
Does anyone know if this Cron setting would cause the automation to run only between 8am and 8 pm every day?
* 8-20 * * *