Controlling timing of a sequence of commands


I’m up and running with OH3 using only GUI elements as I don’t write code at all. I want to understand better how to control the timing of commands in Rules or Blockly generated scripts.

My first project is setting up a HABpanel to control the launching of Roon playlists and controlling the audio equipment through Harmony, which is linked to Roon with the Deep Harmony extension. I have the Harmony binding installed. The objective is to simplify the user’s process of playback control. It’s almost there already, but it appears that there can be slightly inconsistent results caused by delays in the responsiveness of both Roon and Harmony.

I think I understand the issues caused with timing within OH3: I haven’t been able to find anything online about this, but there does seem to be a delay (as I’d expect) between sending a command to an Item and the Item reporting an update. Empirically it appears that sometimes the instructions in Rules/Scripts need to be split so that a second set of commands is triggered when the first command to an Item is confirmed with an updated status. If I’m mistaken on that, please let me know as I can’t find anything in the tutorials or community help about this. That’s my first question - am I correct in my understanding about there being a delay within OH3 between sending a command and the Item updating.

But of course there are delays in the real world outside OH3 where slow responsiveness may result in commands being missed. For example, I have a simple routine to send five button presses using a Blockly Loop to increase the volume of an amplifier. If these instructions are added in a Blockly script with other instructions, the physical equipment may receive only four, three or two presses, because the Harmony controller is still busy with preceding actions. I can’t see how to detect in OH3 that the Harmony has completed any prior tasks, so my second question is how can I pause or delay the progress of the script (using GUI only) to give the physical equipment time to complete any prior actions?

Thirdly and finally, the Blockly loop seems to operate quite slowly in simply sending a command to the Harmony Button Press Point. Is there any means of speeding this up?

Thanks for ploughing through this rather simplistic set of questions. Thanks for your help

Your analysis is correct.
Not directly obvious, but the first part of this explains (and you need to consider autoupdate’s effects anyway) -

Blockly is at the moment effectively useless for timing purposes, there’s no timing tools yet.
On the other hand, timing is not strictly necessary for sequencing.
“When this happens, do that” rules structure can allow multiple rules to set up a chain of events e.g. send command to X, when X changes state do Y.
Don’t be frightened of having many small rules.