Hunter Douglas LUUP Code delay

Forgive me if this is a duplicate posting, I put the question to the Blinds & Window covering topic first, but got no response. Here’s my original post-

I’m trying to consolidate my control of my Hunter Douglas shades ( 8 ) into one scene. Currently I have 8 scenes to open the shades, 8 to close the shades, all in a specific sequence. For example, open shade 1 at sunrise, open shade 2 at sunrise + 10 minutes, etc. etc. The same idea when closing the shades (not in the same order though)

So my thought is to put all the shade open or closing commands into one scene, with a specific delay between shades. This will facilitate seasonal changes that require the window shades to act differently and I suspect reduce the consumption of digital storage on my VeraPlus.

I’ve got the scenes working properly individually.
For example, the following code (which I found here in the forum) runs at 30 minutes after sunrise:

local timeout = 5

local status, result = luup.inet.wget(“”, timeout)

This calls a scene on my HD hub that opens a shade

What I want to do is, once that scene on the HD runs, in the same code package, I want to add a delay of say about 20 minutes, then run another scene on my HD to open another shade. I’ve tried inserting a luup.sleep () and luup.delay () commands but it does not seem to work.

Clearly I’m missing something, but I don’t know the minimum of Luup coding to figure it out.

I’d appreciate any help thanks

luup.sleep is NEVER to be used more than a few seconds !!! Otherwise It will destabilize your Vera and cause your Vera to restart.
If you want delays you should use delayed commands (actions) in your scene.
The problem with this is that if Vera restarts during that timing, the delayed commands will not happen. If you want this to be reliable, you will need separate scenes each scheduled at a different time.

Another solution that can be used is to put these in PLEG. In that case you can use delayed actions, because delayed actions in PLEG will survive a Vera restart.

I saw the original posting, but thought that it was too difficult to post a concise response! However, since you’re desperate, I’m willing to help.

The simple answer is “don’t do that”. Whilst scenes have the ability to execute delayed actions, they don’t give you the option of delayed arbitrary Lua code… there’s just one which runs at the start of the scene.

Re. your attempts so far:

[ul][li]luup.sleep() - never, never use this. It has the capability to block a thread and possibly timeout. I’ve no idea why they provided this in the first place.[/li]
[li]luup.delay() - does not exist, perhaps you meant luup.call_delay() which is a possible route.[/li][/ul]

There are, however, myriad ways in which you could accomplish this. You will need appropriate data structures to sequence both the timing and order of your opening/closing. It might also be useful if your Hunter Douglas API provides a call to retrieve the state of the shades. The danger you face is that Vera has the habit of reloading at arbitrary times so that long sequences of delayed calls will be lost. Plenty of ways around this, though. I’m sure the third-party plugin PLEG could provide a solution, but if you don’t want to go that way, let’s explore the Lua option.


Ah! I see that whilst I was replying, Richard posted a response with a similar message!

Thanks guys, The warning about the sleep command rings true, there were lots of weird things going on when I used it, shades needing rebooting, sometimes they worked, sometimes not, etc. etc. Since I’ve been away from the project for a week the shade commands as written have worked perfectly, I attribute the lack of problems to my lack of stumbling around in the code.

I’ll look into the PLEG option. thanks again