Outdoor Sunset to Sunrise


#1

This seems like it should be pretty straightforward and I’m not sure what isn’t working with this piston, but I’m also super new to Smartthings/Webcore and home automation in general so I don’t really know what I’m doing. Also, could someone answer what the true/false means by each piston? Thanks

1) Give a description of the problem
Lights not responding properly.

2) What is the expected behavior?
Christmas outdoor light turns on at sunset and off at sunrise. Switches between green and red depending on the day.

3) What is happening/not happening?
Outdoor lights didn’t turn off at sunrise this morning and didn’t turn on at sunset today.

4) Post a Green Snapshot of the pistonimage

5) Attach any logs (From ST IDE and by turning logging level to Full)
|+0ms|╔Received event [Home].test = 1513645229255 with a delay of 1ms| |---|---| |+99ms|║RunTime Analysis CS > 14ms > PS > 65ms > PE > 20ms > CE| |+101ms|║Runtime (38054 bytes) successfully initialized in 65ms (v0.2.100.20171211) (100ms)| |+102ms|║╔Execution stage started| |+124ms|║║Comparison (time) 72029363 happens_daily_at (time) 1513634940000 = false (0ms)| |+126ms|║║Condition #5 evaluated false (19ms)| |+129ms|║║Cancelling statement #5's schedules...| |+138ms|║║Requesting time schedule wake up at Tue, Dec 19 2017 @ 5:09:00 PM EST| |+143ms|║║Condition group #1 evaluated false (state did not change) (36ms)| |+147ms|║║Comparison (time) 72029401 happens_daily_at (time) 1513634940000 = false (1ms)| |+148ms|║║Condition #10 evaluated false (4ms)| |+149ms|║║Cancelling statement #10's schedules...| |+153ms|║║Requesting time schedule wake up at Tue, Dec 19 2017 @ 5:09:00 PM EST| |+156ms|║║Condition group #6 evaluated false (state did not change) (11ms)| |+158ms|║║Condition group #17 evaluated true (state did not change) (0ms)| |+168ms|║╚Execution stage complete. (65ms)| |+172ms|║Setting up scheduled job for Tue, Dec 19 2017 @ 5:09:00 PM EST (in 76110.573s), with 1 more job pending| |+181ms|╚Event processed successfully (181ms)|


#2

have you defined your lights anywhere? what is {@OutdoorLights}?


#3

I believe I have. I made it a global variable. device @OutdoorLights = Front Porch. I only have the one outside for right now, but I figured it would be easier long term if I just added to the global variable later.

The piston seemed to work fine at Sunset Saturday, Sunrise Sunday, Sunset Sunday, but then it didn’t turn off this morning and didn’t turn back on at sunset tonight.


#4

I imported your piston but there was no variable


#5

I don’t think your if/then/else_if is going to evaluate properly for sunrise. For a more reliable result, I would try using timers instead of if/then statements. For example

example

In this case, you would have four timers within the piston - two for sunset on the days and month of your choice, and two for sunrise on the days and month of your choice.

Since your lights turned on, I don’t think your use of a global variable is an issue here.


#6

Is there some reason why it wouldn’t evaluate for sunrise? Is it just possibly not going back to look at the piston once it gets to sunrise?

I seemed to have the same problem with the initial piston I tried where I had “If time happens daily between sunset and sunrise…” It would turn on but then it wouldn’t turn off. I assumed with that one, there was no trigger to turn it back off at sunrise which is why I changed it to what it currently is.


#7

I think your piston might work if instead of using the “else if” you used two separate if/then statements. My thought is that burying the second portion of this piston in the “else if” means it isn’t getting evaluated independently.

I tend to like timers because I can see in the piston status on the dashboard exactly when the piston will execute again. :grinning:


#8


#9

That looks good.


#10

Thanks. Still seems like the piston should work, but I can also see how the turn off could be “hidden”.

I haven’t tried using timers in a piston yet, but I think I agree that I would prefer those since before the timer was always showing the next sunset and nothing about when the sunrise action was happening.

Would I just change the times to a specific time to try out the piston instead of waiting until the next sunset/sunrise to see if it worked or is there some other way to see what the light does?


#11

Yes, I frequently adjust timer schedules, waits and even triggers to test the behavior of a piston. Depending on the complexity of the intended behavior, I may build the piston without triggers or conditions whatsoever and execute the piston using the test button. Once I’m sure it’s working, then I’ll add in the subscribed events.