Blockly wait: variable amount of ms possible?

Hi

Is it possible to wait in a Blockly script for an amount of time which is calculated before and stored within a variable?

Thanks,
Bernd

No, but you should probably be using a timer anyway.

The question is “how long” you intend to wait. If you want to want for a few milliseconds you can use “wait for” but it was never implemented to take a variable.

As Rich mentioned rather use Rules Blockly - Timers & Delays | openHAB which can take a computed value.

Unfortunately, all my Z-Wave things for rollershutter don’t support sending a position in percent. So I have to do something like send DOWN, wait a few seconds, send STOP. This works okay so far… Now I’m currently improving my rule with a more “dynamic” behaviour: I’m calculating some correction_factor and multiplying the default waiting in seconds with this factor; e.g. default is 20 s and so I get 20 s in winter and 24 s in summer. Now my workaround is to use an “not pretty” if - else if - else if - else to be able to use different wait times.

If we talk about seconds, then definitely use timers.

You would probably benefit from using the Gatekeeper block from openHAB Rules Tools [4.1.0.0;4.9.9.9].

You can calculate the amount of time put into a variable and use that to time the gatekeeper.

The gatekeeper will manage the timers for you.

It’s way easier: Use the rollershutters position emulation profile from the add-ons:

This does all the calculation for you and even keeps the position when you stop the shutter. It works absolutely great.
But you have to define the item file-based as the up- and downtime cannot be specified in the UI (unless @Rich knows how).

I have no rollershutters so have no rollershutter Channels I can link to an Item to try it out handy.

All I can say is it should be possible to specify everything the profile supports through the UI. If something is missing or broken an issue should be filed.