Trigger a piston only when external URL is executed and based on time in between


#1

Hello, i’m having a bit of an issue regarding this piston. Any help would be appreciated! Thanks for your time.

Update: the piston image i uploaded is from a new piston i made. instead of having the time as an “if” i set the time to “Only when” but its not triggering the lights anyway.

1) Give a description of the problem
it does not trigger when time is between 6 pm and 6 am instead it triggers at 5:59 pm and 5:59 am “AUTOMATICALLY”(Not only when external URL has been executed)

2) What is the expected behavior?
The piston should trigger ONLY when external URL has been executed. it should look like this:

“the http external url executes”
make a web request (to turn on my ac via an automation with ifttt and Nexia)
Turn on Plug 1 (a z wave wall plug where i have a fan attached to)
BUT if time is between 6 pm and 6 am (only when its dark)
then
make a web request (to turn on my ac via an automation with ifttt and Nexia)
Turn on Plug 1 (a z wave wall plug where i have a fan attached to)
Turn on Switch chandelier.

3) What is happening/not happening?
without the Time everything works fine but if i add the time it triggers automatically without even accessing the external url.

4) Post a Green Snapshot of the pistonimage

5) Attach any logs (From ST IDE and by turning logging level to Full)
+1ms ╔Received event [XXXXX].execute = 177.xxx.xxx.xxx with a delay of 63ms +117ms ║RunTime Analysis CS > 11ms > PS > 35ms > PE > 70ms > CE +127ms ║Runtime (37723 bytes) successfully initialized in 35ms (v0.2.0fb.20171026) (126ms) +128ms ║╔Execution stage started +133ms ║║Cancelling statement #1's schedules... +138ms ║║Error executing virtual command [].httpRequest: (1ms) java.lang.NullPointerException: Cannot invoke method replace() on null object +143ms ║║Cancelling statement #3's schedules... +162ms ║║Executed physical command [Plug 1].on() (15ms) +162ms ║║Executed [Plug 1].on (17ms) +171ms ║║Comparison (time) 81804924 is_between (time) 84660000 .. (time) 85440000 = false (4ms) +172ms ║║Condition #7 evaluated false (7ms) +173ms ║║Condition group #5 evaluated false (state did not change) (9ms) +174ms ║╚Execution stage complete. (46ms) +184ms ╚Event processed successfully (184ms)

Best regards.
-Federico.


#2

You can leave it as in if statement. But you need to remove the subscription to the time events.

You can do this for the entire piston by clicking on the name of the piston in the editor window at the top. Then select the cog and change subscription from automatic to never.

Or you can do this for just the time condition. Select the condition and click the cog. Then change subscription from automatic to never.

In this instance both accomplish the same thing. But in the future you might not want to kill all subscriptions only some.


#3

Hello, thanks for the reply!, i did change the subscription to “Never” however i’m not able to make it happen. it seems like it just doesn’t work with small amounts of time. Just for testing I am setting a difference of 10 minutes between of 4:20 pm and 4:30 pm. I triggered the piston at 4:28 pm but it didn’t turn on the light. In the logs i can see this:

“+157ms ║║Comparison (time) 55742789 is_between (time) 58800000 … (time) 59400000 = false (4ms)
+159ms ║║Condition #8 evaluated false (8ms)
+160ms ║║Condition group #5 evaluated false (state did not change) (9ms)
+161ms ║╚Execution stage complete. (36ms)”

I’m sure im missing something. Sorry for the ignorance. My time is gmt -5 could it be possible that i should be matching the piston’s time to other time region?

Thanks.


#4

Never mind i just realized that indeed it was a problem with my time zone. Webcore’s time is one hour before mine. (here is 5:22 pm and webcore’s time is 4:22 pm) its funny i think it should be specified that the time you have to set has to be the same that webcore is based on. When i execute the piston i get “trace started on (my time zone)” i got confused. Anyway you helped me with the subscription thing cause that was messing with my piston too. Thank you!


#5

Is your hubs location properly set? Or by chance are you outside the US?


#6

yes, i live outside the US. That was it :see_no_evil: my bad.

Regards.
Federico.


#7

Your location wasn’t set?

Also I have seen a lot of people across the ocean complain of a 1 hour time issue which was believed to be DST ending.

At any rate glad you got it figured out.