Wait Until
Purpose: read repeatedly until the value meets a condition, the device starts responding, or the device stops responding. Typically used to wait for a device to boot or for an action to finish.

Wait Until has the same read fields as Read, plus:
| Field | What it sets |
|---|---|
| Compare | = equals, ≠ not equal, In range, and two communication-only choices: Any answer (met when the device responds) and No response (met when the device stops responding) |
| Give up after | The longest to wait. 0 means no limit |
| Check every | How often to read |
JSON
json
{ "wait_until": { "address": "0x0200", "expected": 5, "timeout_ms": 2000, "interval_ms": 100 } }
{ "wait_until": { "address": "0x0200", "compare": false, "timeout_ms": 0 } }
{ "wait_until": { "channel": "B", "address": "0x0000", "no_response": true, "timeout_ms": 3000 } }| Field | Required | Meaning |
|---|---|---|
| Read and compare fields | — | Same as Read (address, expected, compare_op, range, tolerance, store…) |
timeout_ms | No | Default 3000. 0 means no limit. At most 3600000 (1 hour) |
interval_ms | No | Default 100. At least 10 |
compare | No | false = Any answer: met when the device responds |
no_response | No | true = No response: met when the device stops responding |
Result
| Result | When |
|---|---|
| PASS | The condition is met in time |
| FAIL | Time runs out while the device responds but the value never matches; or, with No response, the device keeps responding |
| DISCONNECT | Time runs out and the device never responded at all |
No response while waiting is not a failure: the step keeps waiting, because the device may still be booting.
Example
About the example: channel B deliberately points at 127.0.0.1:1503, where there is no device, and on_error is continue.
| Case | What it does | Result |
|---|---|---|
| Met at once | Writes 5, then waits for 0x0200 == 5, which holds on the first read | PASS |
| Times out | Waits for 0x0200 == 6, which does not happen within 1 second | FAIL |
| Any answer | Waits only for the device to respond | PASS |
| No response | Waits for channel B to stop responding (there is no device there) | PASS |

In Times out, the Actual column shows the last value read and timed out after 1000 ms.
Notes
timeout_ms: 0waits forever, so make sure the condition will be met, or be ready to click Stop.- Full power-cycle tests are covered in the Script examples and in the sample library's
Power cycle.json.
Download the sample script
Sample script
Before running it, start a Slave window on 127.0.0.1:502 and click Listen, then open the script with Open JSON in Script mode and click Run. See How to use the examples.
