Delayed actions only run when manually triggered?

I’m having an issue with a basic scene I set up. When a certain device is “opened” (a z-wave relay), it is supposed to wait two seconds, then close it. Basically equivalent to “when switch is turned on, wait two seconds then turn it back off”. Nothing fancy. The problem is that even though the scene is triggered properly (according to the last run timestamp at least), the relay device is never closed.

The really weird part, though, is that if I then click the run button on the scene to manually run it (while the relay is still “open”), it does properly close the relay after the set delay. It’s only when it is triggered by the relay opening that it does not.

So, to recap:

  1. Scene is properly triggered by device “opening”
  2. Scene does not properly “close” device after triggering
  3. Manually triggering the scene with the device opened DOES properly “close” the device.

Note that I don’t care about the exact delay, as long as the relay is “closed” again shortly (within a few seconds) after being opened. Essentially the relay is pushing a button, and I need it to not hold it down.

How might I fix this?

HI,

Are you using any LUA code in the trigger? If so make sure it explicitly returns true or else the scene action will indeed not be run.

Cheers Rene

No. Like I said, it’s a very basic scene - when triggered by the relay going “open”, it has a 2 second delayed reaction of setting the relay to “closed”. Nothing more. The only way the scene could be simpler would be if there was no delay.

Also, note that it does work properly if I run it manually at a time the relay is currently “open” - the relay gets set to “closed” after the set delay. So the scene itself seems to work, it’s only that when triggered by the relay opening that the delayed action of closing the relay doesn’t work.

Could there be a timing issue? Maybe vera doesn’t want to send other signal to the relay that quickly/thinks it is still trying to communicate with the relay to “open”?

What’s opening the relay?

C

Vera. Either it is triggered directly via a URL call to my controller telling the relay to open (setTarget 1), or it’s triggered by a scene on the controller that does the same.

For what it’s worth, if I add a delayed action in the scene(s) that trigger it to open, telling it to close again, that seems to work, however that doesn’t handle the case where the URL call triggers the device directly - or the case (although I don’t work it this way, it could) where the relay is physically triggered via button-press.

At the end of the day, all I’m trying to accomplish here is to make this relay work like a momentary push button when triggered. On, off. Should be simple, right? :smiley:

Should be, yes.

Have you tried extending the 2 seconds? It might break your use case, but I suspect it’s simply hitting some kind of race condition.

Or Reactor can probably do it natively i.e. detect the relay is open and close it for you under all circumstances. It would also let you repeat to make sure the thing closed.

C

I did try extending it to 3 seconds, with no joy, and even putting in multiple delays of 1 second, 2 seconds, and 3 seconds. Could still be that it just “needs” longer - when I run it manually and it works, it has probably been at least 10 seconds or more.

I may have to give reactor a try. Haven’t used it before, but I keep seeing things about it, so this might be a good relatively simple first case to try it out on.

1 Like

Try setting it to more like 30 seconds, just to test

C

Are you sure the scene is actually triggering at all? Does your Relay have instant status? If not, Vera needs to poll the relay to see the change status, that is going to be closer to 30 seconds on average (if you left polling to 60 sec default). Unless Vera is the one doing the status change on the Relay in the first place, it likely won’t see the trigger for some time.

Vera is the one doing the status change, so that shouldn’t be an issue, and I’m going off the “last run” timestamp on the scenes page to indicate that the scene is triggering. So the timestamp shows that the scene has run, but the relay does not change state.

Hit run on the scene, however, and then, after the set delay, the relay changes state properly.

I still need to try pushing the delay out to something like 30 seconds, just to see if that helps. I’m also looking into using reactor instead, see if there is any improvement there.

Even setting to 30 seconds didn’t make the scene work. On the other hand, the reactor sensor worked perfectly, even with only a 1 second delay. So I guess that works. Bit of a mystery to me still, but a solution is a solution, so I guess I’ll call it good.

1 Like

Yeah, that’s a curious one indeed.

Be interesting to see what the logs say, but, as you say, a solution is :slight_smile:

C

I believe delayed scene actions will fail if there is a LUUP reload during the delay. Maybe something you are doing is consistently causing a crash/reload as the scene is triggered (VERA doesn’t know to go re-evaluate the scene after a reload). Things like Reactor and PLEG use a different method for keeping track of time delays and will -recalculate and react even if a crash occurred between the trigger event and the action.