Omni Pro II - Delay inside codeblock

madas

Member
Hello,
 
I have seen the other posts about using flags to create delays prior to code blocks.  Is there anyway to create a delay inside a code block?
 
When Flag Off
THEN DO1
THEN DO2
THEN DO3
WAIT
THEN DO4
 
I have somfy blinds with a RTS repeater and I find that the HAI sends the commands to quickly for the blinds to actually register if I put more than one in the same code block.  If there is no delay function (which there doesn't appear to be) if there some random other function that I can run in the block that'll hold the HAI up for a few seconds?
 
Thank you
 
M
 
I'm not sure how much of a delay you are looking for.  Two thoughts:
 
If you need a very short delay (milliseconds), you could try inserting some "dummy" serial messages between your other commands.  If you have an unused serial port, just send the dummy commands to that unused port, and they won't bother anything.
 
If you need a longer delay (seconds), you can use another flag (or series of flags) to delay the messages.  On the start condition, send the first message and then set one flag for a second, the next one for two seconds, and so on.  When each flag returns to the off state (and the initial condition is still set), then send the next message,
 
There are probably a few more ways to do it, but those are my initial thoughts.  I'd like to know what ends up working the best for you, if you don't mind posting feedback.
 
Madas said:
Hello,
 
I have seen the other posts about using flags to create delays prior to code blocks.  Is there anyway to create a delay inside a code block?
 
When Flag Off
THEN DO1
THEN DO2
THEN DO3
WAIT
THEN DO4
 
I have somfy blinds with a RTS repeater and I find that the HAI sends the commands to quickly for the blinds to actually register if I put more than one in the same code block.  If there is no delay function (which there doesn't appear to be) if there some random other function that I can run in the block that'll hold the HAI up for a few seconds?
 
Thank you
 
M
The simple solution is just to space commands out at 1 minute intervals.  Does it really matter much if one shade opens 23 minutes after sunrise and another opens at 24 minutes after?   If you need then to all go together, put them in a group.  Each one can hold many commands so you can control them in multiple groups or individuality.  Save one code for the one blind, another for all the ones in a room and another for them all the blinds in the house.
 
I think sending some garbage out an unused serial port seems to do the trick.  I played a bit last night and it seemed to work.  I think all i need if a few extra ms.  I actually have Homeseer running and connect to my Omni so i might start to move the non-critical codeblocks over to that as its a bit more flexible.
 
Madas said:
I think sending some garbage out an unused serial port seems to do the trick.  I played a bit last night and it seemed to work.  I think all i need if a few extra ms.  I actually have Homeseer running and connect to my Omni so i might start to move the non-critical codeblocks over to that as its a bit more flexible.
 
I'm glad it worked.  It's a shame that you need to sacrifice a serial port for this, though.  If I can think of any other (hopefully cleaner) ideas, I'll reply back here.
 
It's a bit convoluted, but you can do this with flags.  You need to use one flag as a step counter and another as a timer.  You setup your code block with IF statements to check which step you're at and fire off each one, then set a flag as a delay timer, then have it increment the first flag and come back and process the next line.
 
Back
Top