Changing piston activation time according to Daylight Savings time


#1

1) Give a description of the problem

So, I finally created a smart doggy door and a piston to control it. But now I realize that it opens too early during DST (my dogs and cat ignore the change, lol). So, I’d like to adapt my piston to take advantage of another piston I borrowed that tells me when DST is active and saves it to a global variable (@DST = true or false).

2) What is the expected behaviour?
I want my piston to open an hour later during DST, but I’m not sure how to rewrite the “value” of my “Time happens daily at”. Can time be written as a variable, such {$time + (@DST == “true” ? 1 : 0)} ? I’m thinking maybe adding a line to the DST piston that creates another global variable (@PetDoorTime) that the Doggy Door can subscribe to to determine when to run, but don’t know how to write time as a variable.

Here’s the Doggy Door piston:


#2

I would suggest to use a time variable for line 40, for example openTime. In this variable you will put as an Expression the following: @DST == "true" ? "5:45AM" : "4:45AM"

This of course depends on that other piston you use that detects DST.


#3

That makes sense, and would appear to work…is it an issue that it shows the time in UTC? (Thanks for pointing out the time variable. Always saw it, but it never registered on me until now.)



#4

WC should convert that time to the correct value, check the next scheduled event if it’s the correct time.


#5

It works beautifully! Thanks!


#6

Sorry to bug, but I’m having a weird problem. It’s no longer reading @DST correctly.
(I changed OpenTime to dynamic just so I could see what it’s doing). I tried pausing/unpausing the piston, and even signing out and back in.

I was able to fix it by switching @DST to “on”/“off”, but don’t understand why it started acting this way with “true”/“false”

Before the fix, looking at @DST showed the correct setting:

But seeing if the statement is true shows that it’s false


#7

In Groovy true == "true" is false so unless webCoRE does its own thing in expressions your last results are what I would expect.