Help with Bin reminder Piston


#1

1) Give a description of the problem
I have created a piston to remind me when the bins go out, the piston repeats remember to take the Bins out every 30 minutes but I want the all the pending tasks within the piston to be cancelled when a door contact sensor changes to opened, I have tried various methods to get this to work correctly, if I separate the if statement for the door opening into its own statement it does cancel the pending tasks but means every time the door is contact sensor is opened it logs that the bins have been taken out.

2) What is the expected behaviour?
Pending tasks should be cancelled which they are but any time the door is opened it logs the bins have been emptied.

3) What is happening/not happening?
I only want the logging to happen if the first part of the statement has executed, currently when the door opens any time it is logged as taking the bins out.

**4) Post a Green Snapshot of the piston

5) Attach logs after turning logging level to Full
I don’t have any logs but the piston is due to run tonight so I can capture the logs


#2

What I would suggest is to enable Advanced Statements under Options (while in Edit mode) and then use Repeat loop.

Something like this… add your message after the Repeat statement
image


#3

Thanks, will give it a try and let you know.


#4

I changed my piston to look similar to above but still have the same issue.

Here are the logs.
11/03/2021, 21:12:51 +822ms
+3ms ╔Received event [Hubitat Smart Home Hub].execute = [XXX.XXX.XXX.XXX, XXX.XXX.XXX.XXX] with a delay of 32ms,canQueue: true, calledMyself: false
+24ms ║RunTime initialize > 22 LockT > 0ms > rtDT > 1ms > pistonT > 0ms (first state access 21 3 19)
+27ms ║Runtime (7988 bytes) successfully initialized in 1ms (v0.3.113.20210211_HE)
+28ms ║╔Execution stage started
+34ms ║║Comparison (string) :7c76bcf13f4437d56396ddf04776b595: is (string) :7c76bcf13f4437d56396ddf04776b595: = true (1ms)
+35ms ║║Condition #9 evaluated true (5ms)
+45ms ║╚Execution stage complete. (17ms)
+75ms ║Setting up scheduled job for Thu, Mar 11 2021 @ 9:30:01 PM GMT (in 1029498ms),with 1 more job pending
+77ms ╚Event processed successfully (77ms)
11/03/2021, 21:00:00 +790ms
+5ms ╔Received event [Hubitat Smart Home Hub].time = 1615496400731 with a delay of 59ms,canQueue: true, calledMyself: false
+23ms ║RunTime initialize > 21 LockT > 1ms > rtDT > 1ms > pistonT > 0ms (first state access 19 6 15)
+27ms ║Runtime (7839 bytes) successfully initialized in 1ms (v0.3.113.20210211_HE)
+33ms ║╔Execution stage started
+55ms ║║Condition #35 evaluated false (10ms)
+56ms ║║Condition group #34 evaluated false (state did not change) (12ms)
+58ms ║║Cancelling statement #36’s schedules…
+534ms ║║Executed physical command [Echo - LR’s Echo Dot].playText(Remember to take the bins out) (465ms)
+535ms ║║Executed [Echo - LR’s Echo Dot].playText (466ms)
+545ms ║║Executed virtual command [Echo - LR’s Echo Dot].wait (0ms)
+547ms ║║Requesting a wake up for Thu, Mar 11 2021 @ 9:30:01 PM GMT (in 1800000ms)
+564ms ║╚Execution stage complete. (530ms)
+596ms ║Setting up scheduled job for Thu, Mar 11 2021 @ 9:30:01 PM GMT (in 1800010ms),with 1 more job pending
+598ms ╚Event processed successfully (597ms)
11/03/2021, 20:30:00 +54ms
+6ms ╔Received event [Hubitat Smart Home Hub].time = 1615494600000 with a delay of 54ms,canQueue: true, calledMyself: false
+77ms ║RunTime initialize > 76 LockT > 1ms > rtDT > 56ms > pistonT > 55ms (first state access 19 8 68)
+85ms ║Runtime (7923 bytes) successfully initialized in 56ms (v0.3.113.20210211_HE)
+91ms ║╔Execution stage started
+106ms ║║Cancelling statement #36’s schedules…
+664ms ║║Executed physical command [Echo - LR’s Echo Dot].playText(Remember to take the bins out) (545ms)
+665ms ║║Executed [Echo - LR’s Echo Dot].playText (547ms)
+674ms ║║Executed virtual command [Echo - LR’s Echo Dot].wait (1ms)
+677ms ║║Requesting a wake up for Thu, Mar 11 2021 @ 9:00:00 PM GMT (in 1800000ms)
+689ms ║╚Execution stage complete. (597ms)
+723ms ║Setting up scheduled job for Thu, Mar 11 2021 @ 9:00:00 PM GMT (in 1800013ms),with 1 more job pending
+725ms ╚Event processed successfully (724ms)
11/03/2021, 19:32:54 +738ms
+14ms ╔Subscribing to devices…
+234ms ║Device missing from piston. Loading all from parent (210ms)
+259ms ║Piston controls Kitchen Door Contact Sensor (Rear)…
+260ms ║Piston controls Echo - LR’s Echo Dot…
+291ms ╚Finished subscribing (280ms)
+310ms ║Comparison (string) :7c76bcf13f4437d56396ddf04776b595: is (string) :7c76bcf13f4437d56396ddf04776b595: = true (1ms)
+312ms ║Cancelling condition #9’s schedules…
+403ms ║Setting up scheduled job for Thu, Mar 11 2021 @ 8:30:00 PM GMT (in 3424923ms)
+408ms ╔Starting piston… (v0.3.113.20210211_HE)
+409ms ╚Piston successfully started (401ms)

have edited out the IP Details above and you can see my contact sensor was opened @ 21:06 and 21:09.

I think this isnt working as these statements are executed asynchronously
image


#5

Ah I just re-read your original post and now it makes more sense. I have a similar setup but I have a virtual ‘chore switch’ that is turned off after the trash bin is pulled to the curb. Let me see if I can get a pic of it.


#6

I think the piston may be getting confused by the timer (the every block) having a long wait inside it that causes the piston to exit. Timers are a bit out of the ordinary. They don’t operate in the normal flow of the piston, they operate as self-contained blocks. The piston probably doesn’t expect a wake up event inside a timer.

I’d be tempted to try anif time happens daily at ... condition instead of the timer.


#7

Will give it a try thanks!


#8

Ok, second attempt lol, edit the loop time as I tried to test it but just noticed that all my virtual devices in ST are all offline. :thinking:


#9

I built a new piston from scratch and it seems to be working to the point it reminds me to take the bin out, I open the door, it cancels the piston but the logging at the end of the piston didnt work.


#10

Let me try this one!


#11

@eibyer

I tried this but the piston timer is still not cancelled and continues to count, I think @orangebucket is correct around the timer, when I do if time happens daily @ it seems to be working bar the logging and message at the end, that is not working but I will spend some time trying to figure out why.
thank you both for your help\time and advice, I learned a little here.


#12

Got it working, I had to move the logging down a branch to end the current if statement before it would work.

Here is the finished piston just in case any one else is interested.