Disable piston for fixed time period while running


#1

Hi

I’d appreciate a nudge in the right direction please. I have an open/close sensor on my cat flap and a virtual presence sensor for the cat. I use cat flap opening to toggle whether the cat is at home or not.

The problem I have is that sometimes the flap swings right throughout ugh when closing (ie open -> closed -> open -> closed) and so the cat presence would change to away and then home straight away. Sometimes he paws at it as well before going through so there might be a number of activations.

What I think I want is:
If cat flap changes to open then

  • toggle cat presence status
  • time period of 30s during which opening cat flap does not trigger piston

I’ve tried using wait 30s after changing the presence status but opening th cat flap during that time still changes presence status.

I tried pausing the piston, then having a wait 30s, then resume piston. That prevents a second toggle but the piston never reactivates, presumably because it’s paused so can’t set itself to resume.

Is there an elegant way to do this without having two pistons.

Thanks for any advice
Andrew


#2

May not be elegant. But create a second piston to turn on the first after pausing

First piston:

Do Stuff
Execute second piston
Pause piston

Finish stuff

Second piston:
Wait 30 seconds
Resume first piston


#3

What about adding a restriction where the piston doesn’t activate unless the contact remains unchanged (or closed) for some number of seconds or milliseconds. Or teach the cat to not let the door swing.


#4

Easy enough to cause the pause:

If contact changes to open
and
previousAge([contact name : contact]) is more than 30000
then
Toggle status

But if cat paws at the flap, and doesent go through, the presence status toggles and you’ll still be out of sync…


#5

Perhaps use some pressure mats inside and out…

If cat is away
And
contact changes to open
followed by
Inside pressure mat activated
Then
cat is home

If cat is home
And
contact changes to open
followed by
Outside pressure mat activated
Then
cat is away

But then, cats being cats, the little fluff ball will probably go half through the flap, activate the mat, and then reverse back through the flap lol


#6

Thanks for all the replies - I could probably mark them all as solutions (apart from changing his behaviour because I have no clue how to do that - I’ve spent the past three months trying fruitlessly to teach him to high-5!).

I hadn’t thought of using pressure mats - I’m never sure what devices I can buy that would work with ST. Should I just buy any European z-wave device?


#7

You can buy Zwave pressure mats off the shelf, you have to buy (or make) regular pressure mats and hook them up to a Zwave dry contact sensor (a contact sensor that takes wired inputs).

If you search the ST forum for pressure mats you’ll get some pointers… people are using for all sorts, under sofa cushions, stair treads, door thresholds etc.