Sunset and Sunrise executing after sunrise


#1

I have this code I wrote for my arlo cams. It worked well in testing and then this morning well after sun rise i notice it was still marked as true in web core and the lights turned on when i went outside. After I played around a bit it went back to false. I am a noob to all of this and this is the first code i have ever written.
sun rise here should have been around 7am

Here is the logs

8/29/2017, 9:58:28 AM +574ms
+1ms ╔Received event [Home].test = 1504018708568 with a delay of 5ms
+170ms ║Runtime (36044 bytes) successfully initialized in 45ms (v0.2.0e5.20170812) (169ms)
+171ms ║╔Execution stage started
+246ms ║╚Execution stage complete. (75ms)
+255ms ╚Event processed successfully (254ms)
8/29/2017, 9:58:00 AM +137ms
+1ms ╔Received event [Home].test = 1504018680125 with a delay of 12ms
+213ms ║Runtime (36042 bytes) successfully initialized in 60ms (v0.2.0e5.20170812) (211ms)
+215ms ║╔Execution stage started
+324ms ║╚Execution stage complete. (110ms)
+344ms ╚Event processed successfully (344ms)
8/29/2017, 9:47:41 AM +206ms
+1ms ╔Received event [Home].time = 1504018062752 with a delay of -1547ms
+216ms ║Runtime (36045 bytes) successfully initialized in 74ms (v0.2.0e5.20170812) (213ms)
+217ms ║╔Execution stage started
+219ms ║╚Execution stage complete. (2ms)
+226ms ╚Event processed successfully (227ms)
8/29/2017, 9:47:38 AM +916ms
+8ms ╔Starting piston… (v0.2.0e5.20170812)
+509ms ║╔Subscribing to devices…
+614ms ║║Subscribing to Back yard.motion…
+725ms ║║Subscribing to Backyard Soffit…
+727ms ║╚Finished subscribing (225ms)
+989ms ╚Piston successfully started (984ms)
8/29/2017, 9:45:42 AM +446ms
+2ms ╔Received event [Back yard].motion = inactive with a delay of 111ms
+192ms ║Runtime (36044 bytes) successfully initialized in 58ms (v0.2.0e5.20170812) (189ms)
+193ms ║╔Execution stage started
+304ms ║║Executed virtual command [Backyard Soffit].wait (1ms)
+306ms ║║Requesting a wake up for Tue, Aug 29 2017 @ 9:47:42 AM CDT (in 120.0s)
+315ms ║╚Execution stage complete. (121ms)
+317ms ║Setting up scheduled job for Tue, Aug 29 2017 @ 9:47:42 AM CDT (in 119.99s)
+334ms ╚Event processed successfully (334ms)
8/29/2017, 9:44:51 AM +615ms
+2ms ╔Received event [Back yard].motion = active with a delay of 83ms
+175ms ║Runtime (36040 bytes) successfully initialized in 46ms (v0.2.0e5.20170812) (172ms)
+176ms ║╔Execution stage started
+841ms ║║Executed [Backyard Soffit].on (571ms)
+862ms ║╚Execution stage complete. (687ms)
+870ms ╚Event processed successfully (870ms)


#2

Try using the presets in your TIME statement.
Instead of selecting variable in the value field select presets.
Also put the time and the motion in the first 2 statements into one statement.
I.e.
IF
Time is between
AND
Motion is active

THEN
Turn on
etc.


#3

Or just import this using the code provided.
If you do put in your devices when prompted.


#4

Ok thanks! I imported yours looks much cleaner then the one I spent hours on :joy: I guess I could have asked here first but theres no fun in that. Still learning


#5

I think it’s all about trial and error in the early days.
If you’re like me you will keep trying and trying and then ask as a last resort. :wink:


#6

To comment on why yours failed. If you look at the first IF statement for time between. You will see that IF does not encompass anything else. So that is why it was executing outside the time.