Delay on location change


#1

1) Give a description of the problem
I want a delay so when I return home and my ST is in away mode, i have 30 seconds to change my location once I’ve opened the door.

2) What is the expected behavior?
When a door sensor opens in Away mode, I want a 30 second delay. At the end of the 30 seconds I want a notification sent to me. If the mode changes to Home within the 30 seconds, I want it to do nothing and cancel the notification request.

3) What is happening/not happening?
The first time I tried it, i was it Away mode opened the door. I could see a countdown in the dashboard next to the piston name counting down from 30. It then stoped at 19 seconds and did nothing.

**4) Post a Green Snapshot of the piston!mage|45x37]

Thanks in advance for any help given. I’m new to this so still learning. What I’ve done seems quite simplistic and I have something similar working with motion sensors which is why it has me stumped.


#2

It is because you are using changes to.
When the contact opens, the piston becomes true.
After around 10 seconds, because you are using changes to, the piston will become false as it wants to look for a ‘changes to’ again.
You could try setting TCP (task Cancellation Policy) for your second IF to never and see if that does the trick.


#3

Thanks for the quick response and the advice. Much appricaited . I’ll give this a go now and let you know how I got on.

Regards


#4

May I ask what method you are using to change your Location Mode?


#5

sure. currently just the ST app.


#6

I changed both ‘changed to’ statements to ‘is’ e.g contact sensor IS open and Location mode IS home but still counting down to 19 seconds then stops.


#7

And TCP?


#8

I haven’t figured out how to enable that bit yet. I couldn’t see anything called when fishing around.


#9

but I currently can’t get that far as it times out before I get to change the location. i was first trying to get the notification come through


#10

I tried this too thinking that if it’s only limited to away mode, the it would automatically cancel if location mode changes, but it still does the same thing as before. Counts down to 20 seconds that stops.


#11

import this and try


#12

thanks, I’ll give this a try in the morning now as off to bed :sleeping_bed: At first glace, the one you’ve asked me to import and previous one I sent look the same. Am I missing something? The only difference I can see are the greyed out letters and numbers after each line of code?

Thanks for the help so far.


#13

actually there are differences. when I imported yours, I noticed you had two separate do blocks so I combined them to one do block. I also enabled tcp to never cancel since you kept reporting it kept stopping the countdown (But I imagine it was due to the two separate do blocks you had). when you open both, you will be able to notice the differences.


#14

Thanks again. Much appreciated!! New to all this so still learning the correct syntax and correct way of doing things but it’s all part of the fun


#15

thanks jkp. this seemed to solved the problem i was having. i am going to try and play with it to extend its capabilities and hopefully this sollution will help me going forward.