Piston will not work at sunset


Im trying to get this piston to work at sunsut or after and it will not
If I change the time to whats in the piston now it works when the time passes
Y will it not work at sunset


How was the other piston written? I guess we need to see what you had before.


It would be nice to see a log of it failing to see what is going on.

Can you confirm webCoRE actually knows when sunset is?


Since the piston is called GARAGE DOOR CLOSE SUNSET
I assume you want to create some sort of warning system.
Can you share your project with us?
Sometimes there are easier, simpler ways to approach to a project then we think.


Originaly the first line was
Time is between sunset and 11:55 p.m.

I will change piston back to what it was and save the logs after if fails tonight and post
As for ike2018
I have a zwave pushbutton switch connected to garage door with a zwave magnetic sensor on the door
So between sunset and midnight if the sinsor is open for 2 min then I want to activate the pushbutton
then flash the one light if its off allready


My recommendation would be something like this:

IF contact STAYS OPEN for 2 minutes (trigger)
IF time is between X and Y (condition)
Switch 15 
turn ON
Switch 19 
Do this do that

You might even want to add an SMS warning i fyou like…
Send SMS "garage door left open over two minutes. Time is : {time}

If you want to use WAIT instead of stays OPEN, take a look at this post:


@ike2018 has provided a pretty good solution. Let me just add that you will need something to check at time X in case the door has already been open for over two minutes at that time. If you turn it around, it will only check at that time so you need multiple conditions. Perhaps

If time is X
   {door stays open for 2 minutes
     Time is between X and Y
       Do stuff
End if


The pistion will work If I open the garage door after sunset but will not close if the door is open allready before sunset
These are the logs
1/19/2020, 3:42:50 PM +247ms
+2ms ╔Received event [Home].time = 1579466569454 with a delay of 791ms
+131ms ║RunTime Analysis CS > 29ms > PS > 32ms > PE > 71ms > CE
+134ms ║Runtime (38582 bytes) successfully initialized in 32ms (v0.3.10a.20190223) (129ms)
+136ms ║╔Execution stage started
+201ms ║║Cancelling condition #9’s schedules…
+203ms ║║Condition #9 evaluated true (3ms)
+258ms ║║Comparison (time) 56570452 is_between (time) 1579472220000 … (time) 86100000 = false (13ms)
+262ms ║║Condition #8 evaluated false (57ms)
+264ms ║║Condition group #1 evaluated false (state did not change) (65ms)
+302ms ║╚Execution stage complete. (167ms)
+304ms ╚Event processed successfully (304ms)
1/19/2020, 3:32:49 PM +354ms
+2ms ╔Received event [Garage Door Sensor].contact = open with a delay of 261ms
+87ms ║RunTime Analysis CS > 18ms > PS > 31ms > PE > 37ms > CE
+89ms ║Runtime (38591 bytes) successfully initialized in 31ms (v0.3.10a.20190223) (87ms)
+90ms ║╔Execution stage started
+98ms ║║Comparison (enum) open stays (string) open = true (2ms)
+100ms ║║Adding a timed trigger schedule for condition 9
+102ms ║║Condition #9 evaluated false (8ms)
+103ms ║║Condition group #1 evaluated false (state did not change) (9ms)
+105ms ║╚Execution stage complete. (15ms)
+106ms ║Setting up scheduled job for Sun, Jan 19 2020 @ 3:42:49 PM EST (in 599.995s)
+113ms ╚Event processed successfully (113ms)
1/19/2020, 1:43:28 PM +182ms
+0ms ╔Starting piston… (v0.3.10a.20190223)
+293ms ║╔Subscribing to devices…
+327ms ║║Subscribing to Garage Door Sensor.contact…
+475ms ║║Subscribing to Garage Door Virtual Switch…
+476ms ║║Subscribing to Garage Door…
+478ms ║║Subscribing to Ceiling Light…
+479ms ║╚Finished subscribing (198ms)
+507ms ║Comparison (enum) closed stays (string) open = false (2ms)
+551ms ║Comparison (time) 49408691 is_between (time) 1579472220000 … (time) 86100000 = false (10ms)
+553ms ║Cancelling condition #8’s schedules…
+574ms ╚Piston successfully started (574ms)
1/19/2020, 1:35:17 PM +753ms
+0ms ╔Received event [Home].test = 1579458917752 with a delay of 0ms
+82ms ║RunTime Analysis CS > 20ms > PS > 27ms > PE > 36ms > CE
+85ms ║Runtime (38580 bytes) successfully initialized in 27ms (v0.3.10a.20190223) (84ms)
+86ms ║╔Execution stage started
+99ms ║║Comparison (enum) closed stays (string) open = false (2ms)
+102ms ║║Cancelling any timed trigger schedules for condition 9
+103ms ║║Cancelling statement #9’s schedules…
+104ms ║║Condition #9 evaluated false (13ms)
+105ms ║║Condition group #1 evaluated false (state did not change) (14ms)
+110ms ║╚Execution stage complete. (23ms)
+111ms ╚Event processed successfully (111ms)


on top of my head,

a) You can put a timer on sunset and close the door.

Everyday at sunset
Garage door Turn OFF

b) You can use a timer for 10 minutes on selected hours…

Every 10 minutes but only during 6, 7, 8, 9, 10, 11, 12 hours
   IF the garage door is ON
   Garage door turn OFF

This one will turn it off immidiately. If you want that 10 minutes, just add a WAIT

Every 13 minutes but only during 6, 7, 8, 9, 10, 11, 12 hours
       IF the garage door is ON
       Then (TCP set to never)
       WAIT 10 minutes
       Garage door turn OFF


Those logs show the door being opened at just before 3:33 pm, it still being open at just before 3:43 pm, and so the ‘if’ returning false on a time restriction of between 5:17 pm and 11:55 pm and there being nothing to do.

If the door had been opened less than ten minutes before sunset (which seems to be around 5:17 pm if the logs match the piston), it looks to me like the ‘then’ block should be executed after the ten minutes. If the door was opened more than ten minutes before sunset, nothing would happen.

I must admit that I couldn’t see a lot wrong with your original piston (perhaps a question over what would happen at 11:55 pm). That should have fired at sunset, 11:55 pm and whenever the door sensor changed state, which would have meant the two minute timer starting at sunset if the door was open at the time.


Thanks for your posts guys
ike2018 I dont understand
a) you say Ican use a timer on sunset but dont show how
b) you say that I can use a timer not on sunset only on hours of the day
You say that if the door is open more than 10 min before sunset then nothing will happen
How do I change that

  • Add new statements (in your piston)
  • Click on TIMER

  • Choose the setup you want (choose every 10 minutes, use the scrool down list to chose hours) add 6 - 7 - 8 all the hours you want.

But here is the thing,
ST home technologies are still not 100% reliable. Signal issues, communication issues and tons of changes on company sides etc.
Until you get a good grip on Webcore, don’t trust your home’s security with automation…

I have a door lock that loks if unlocked for 3 minutes, I have 3 pistons to make sure it’s doing the job.

Once you are done with this piston, I would still add safety check piston to this (once this part is done let us know we can help with that) and more importantly I would still go to the garage and make sure the door is shut:)


it should look like this,


Ok but your way I would have to adjust for sunset
for instance now sunset is around 6pm and in the summer its around 9:30


or you can use VARIABLEs, expressions etc where your piston adjusts it self accordingly,
but I’d say that’s down the road…


or you can add sunset restriction to this piston

IF switch is ON
IF time is between $sunset and $sunrise (it will be adjusted)


OK but the logic escapes me
If I have if sensor stays open for 10 min
Time is after sunset
Y will that not work if the garage door is open at the time of sunset
For me the clock should start at sunset and close in 10 min
also for your second eg
should it not be
if contact stays closed for 10 min
if time is between $sunset and $sunrise


you are mixing the way you want go about and what I suggested.
As long as you want to stay on IF CONTACT STAYS CLOSED 10 min route
you will have timing problem (what happens if it was open before sunset etc)
or you need more comlpex coding with variables etc…


It’s all about what makes the piston fire. Your more recent piston fires in response to changes in the sensor contact state because it has an explicit trigger (stays open) that says that is what it is interested in. It does not fire at sunset.

The piston in your first post behaves differently because it doesn’t have any explicit triggers. So what it does instead is to look at the conditions it has in order to see when it would be useful to run, which turns out to be when the contact changes and at the beginning and end of your time period. The mystery to me is why it didn’t work at sunset as it did with a specific time.


I made a mistake saying it worked with a specific time. When testing and using contact stays open for 10 min. If the time expires 1 second after sunrise then it will work. In looking at the logs I noticed this. When I changed to a specific time I was within that period.
So Im still at a loss as to how to get it to work if the door has being open more than 10 min before sunset