Adding Delay

I am trying to get additional on events to extend the delay.
I can get the value of delay to change but only the initial delay is acted on.

What is the trick adding delay without recycling the device?

You might get a good response if you posted this in Rule Machine.

I've moved the post to the Rule Machine category (which many users, likely including @velvetfoot, can also do in this forum--though posting in the exact right spot is rarely worth spending a lot of time worrying about both because of this and the fact that the forum is really good at suggesting posts to you no matter where they're located, a bit unlike the 90s/00s forums that are still around).

It may also help if you explain what you actually want the rule to do, as there might be another way to implement this logic.

1 Like

It is an exhaust fan controlled by a Leviton ZW15S switch. The idea is to turn itself off after X time. That works great. What I have problems with is toggling the switch off to on to cause another on event to add more time to the delayed off event. I can get varialble values to accumulate. But what does not happen is extending the delay to match the set value until the fan turns off. No matter what I have tried the delay is always the first value set. That or off compleatly.

I will look for a rule machine catagory. Thanks

OK, so what you really want is to cancel the delay and start a new one. Something like this:

Trigger: Switch on

Actions:

Cancel Delayed Actions
Delay 0:15:00 (cancelable)
Off: Switch

The key ideas are to mark the delay as cancelable and add a "Cancel Delayed Actions" action. You don't really need to worry about turning off doing anything in the rule; sending an "off" command to a switch that is already off should have no effect, though if that really bothers you, you could surround the "off" action with an IF THEN that checks for this.

Alternatively, you can take advantage of the fact that waits are automatically cancelled by a re-trigger and do something like this in your actions instead:

Wait for events: elapsed time --> 0:15:00
Off: Switch

Why? Don't make duplicate posts, regardless of category; and you're already there:

1 Like

I think I see what you're going for here.

My guess is that you don't want the delay on the Cancel Delayed Action command at the top because you're delaying it for the same (variable) amount of time that the off command is delayed.

I don't think you need the Wait in the first part. And I don't think you need the CDA in the "off" if-block either, as that was your first command in the actions.

The code up top was recently added trying to solve why the call for 20 seconds resulted in 40 seconds. Like there was a bounce going on. So the 100ms wait to calm things down. The Top CDA was part of that. Originally the code was contained only in the two conditional statements. The enginma is how sticky a delay for turning a switch off. It can only be cancelled compleatly but not changed on the fly. I will explore using wait statements. Thanks.

I'm really at a loss when it comes to the cancelable area of RM.

Perhaps it's because you are trying to do this with a switch, which also physically controls the fan? Perhaps it can't "multitask", as it were. I don't know.

Before I started dabbling in RM, I did only Simple Automation. The GE/Jasco switches I have allow a possible 6 "buttons". I use the buttons, I ie toggle switch one up for 5 minutes, 2 for 10 minutes and 3 for 15 minutes. For laughs, I pasted all the stupid rules I have for it. It works though.

Can you use the Leviton as a button controller?
I have no idea, really.

Update
Rewriting the child App with wait statements instead of delay solved the issue.
Thanks to those who offered me a clue.

1 Like