1) Give a description of the problem
I am not sure how to code this piston in the simplest way. I could make a lot of if/then statements to do it, but I feel like there is likely a clean way that I am not familiar with.
2) What is the expected behavior?
I would like the Christmas tree lights to be on when we 1) we are home and 2) it is between 6 PM and 10 PM. Ideally, I would like the lights to turn on and off within this window if we leave the house and return. For example, if we are home at 5 PM, leave at 6:30 PM, and return at 8:00 PM, the lights should turn on at 6:00 PM, turn off at 6:30 PM, turn on at 8:00 PM, and turn off at 10 PM.
3) What is happening/not happening?
This piston works fine when we are home for the entire night, but it obviously does not work in many other situations. if we are not home at 6 PM but come home at 7 PM, they won’t turn on, and lots of combinations will not work either. Do I need to make a bunch of additional triggers/actions that execute on each arrival/departure action, or is there a cleaner way to do it?
4) Post a Green Snapshot of the piston!
5) Attach any logs (From ST IDE and by turning logging level to Full)
12/1/2018, 5:59:59 PM +121ms
+1ms ╔Received event [Home].time = 1543705200000 with a delay of -880ms
+122ms ║RunTime Analysis CS > 35ms > PS > 62ms > PE > 26ms > CE
+126ms ║Runtime (36747 bytes) successfully initialized in 62ms (v0.3.108.20180906) (124ms)
+128ms ║╔Execution stage started
+161ms ║║Comparison (time) 64799259 is_between (time) 64800000 .. (time) 79200000 = true (17ms)
+163ms ║║Time restriction check passed
+167ms ║║Cancelling condition #3's schedules...
+168ms ║║Condition #3 evaluated true (30ms)
+171ms ║║Cancelling statement #3's schedules...
+182ms ║║Requesting time schedule wake up at Sat, Dec 1 2018 @ 10:00:00 PM EST
+187ms ║║Cancelling condition #1's schedules...
+189ms ║║Condition group #1 evaluated true (state changed) (51ms)
+193ms ║║Cancelling statement #6's schedules...
+203ms ║║Skipped execution of physical command [Christmas Tree Lights].on([]) because it would make no change to the device. (3ms)
+205ms ║║Executed [Christmas Tree Lights].on (6ms)
+214ms ║║Executed virtual command [Christmas Tree Lights].waitForTime (4ms)
+216ms ║║Requesting a wake up for Sat, Dec 1 2018 @ 10:00:00 PM EST (in 14400.666s)
+225ms ║╚Execution stage complete. (98ms)
+229ms ║Setting up scheduled job for Sat, Dec 1 2018 @ 10:00:00 PM EST (in 14400.652s), with 1 more job pending
+238ms ╚Event processed successfully (238ms)