Piston that only executes on call from another piston


#1

1) Give a description of the problem
I have 2 pistons. One that is a timer, if the timer expires it calls a piston
The second piston does a thing, then when the followup condition happens the else statement does another thing. If i set the piston to not subscribe it also does not look for the Else condition. If i leave it subscribed it fires every time the timer runs bypassing the timer.

2) What is the expected behavior?
Run piston 1, if timer expires run piston 2. never run piston 2 on its own.

3) What is happening/not happening?
piston fireing along side of timer piston, or else condition ignored if unsubscribed.

4) Post a Green Snapshot of the pistonimage

5) Attach any logs (From ST IDE and by turning logging level to Full)
Not attaching logs since i understand why its happening, just need to know how to avoid it.


#2

Timer Piston below. I don;t think this matters, but to be complete.
Reason I don’t put timer in the one piston is because I don’t want the else to fire if the timer never fires on the If condition. I originally had the timer above the first action in the IF. but if the timer never finished expiring, and the contact closed, the else was still generated since the contact closing is its condition… therefore restoring random settings to my lifx bulbs.


#3


#4

2 things about this post.

  1. How do you add a wait w/o a dding a Do statement?

  2. yours is a more optimal way to do the timer, but my timer was working. It does not really solve the fact of having the 2nd piston which its calling being limited to not trigger on a condition.

Unless I am missing something. I am new to this after all.

Thank you for your reply


#5
  1. When you click on add an action, instead of choosing a device, use the default selection for Location.

  2. look at this piston setup for some answers :slight_smile:
    Door Left Open Reminder - Configurable by Individual Contact


#6

Ok cool. it seemed odd i had to pick a random device to use wait. this makes more sense. I was confused at first because when i do this it still says “with Location” . But once i save it and look at it in the read only pane that "with location is gone and it looks just like yours. Thank for this info.


#7

That post is above my skillset currently. I tried to follow it. I tried moving my actions to the root of the piston above IF. that went badly. I guess I am not sure what I am supposed to be pulling from that giant piston. Sorry.

Thanks for trying.


#8

I feel like this is one of those things where we’re trying to solve the issue that you’ve presented us with, but perhaps there might be a better way to achieve the ultimate goal you’re trying to get.

State what the desired outcome is… I’ll bet there is a way to do this all in one piston without as much complexity as this method potentially introduces. What are you really trying to do?


#9
  • I want my fridge door contact if open for say 45 seconds, to make an audible alert, and flash my island lights.
  • I want the speaker to stop the moment the contact closes, and the lights to return to their previous state, whether they were on and yellow or off.
  • I want nothing to happen if the door closes before the timer expires.

I got that to work with one hiccup. My else statement looks for the contact to close. So if the door closed before the timer finished it would still execute the else statement. The preferred behavior is if the door closes before the timer expires, cancel doing anything.

I solved that by calling my piston from a separate dedicated timer piston (therefore canceling the timer would not trigger my else statement) That’s where I am now. It will trigger along side the timer if its subscribed, or if its unsubscribed it fires correctly, but does not trigger on the else statement once the door closes.

Does this make sense?


#10

Yes, that helps.

So first, we can use stays open for 45 seconds as the Trigger to start the piston. If the door closes before that then nothing will ever happen. Then we can use a variable to store whether or not we want to do the warning notice. That way if the door just closes we don’t need to execute the bottom part of the piston. I’m not using an ELSE part here…as it’s really just a continuation of the same action which started things off.

The way you started out, this is relying on WC to cancel the tasks to keep flashing the lights when the condition changes…this example does the same. Obviously you don’t want the lights to flash 1000 times if the door is closed, say, 2 minutes later.

But anyway…this structure should do what you want.


#11

I just imported this and went through it line by line.
I leaned a lot from this, Thank you for your help. Ill try it when i get home.

Thanks for you help while i learn all this.


#12

It worked. No issues so far. after 5 tests. Thanks so much!


#13

Glad to hear that. :slight_smile: