Hoppa till huvudinnehåll

Flow control

Flow control decides how execution moves through the graph, rather than what it senses or does.

BlockWhat it does
DelayPauses the branch before continuing
Redundancy checkWaits, re-reads a device, and runs the branch again if the device has not confirmed
For each device in groupRuns the rest of the rule once per device in one or more groups, spaced apart

Delay​

The Settings panel for the Delay block, with Delay mode set to Debounce, and Duration and Unit

Put a delay between two blocks and everything after it waits.

SettingWhat it does
ModeFixed or Debounce
DurationA number and a unit: seconds, minutes, hours or days

The longest wait is 30 days, however you express it.

Fixed​

Waits the full duration, then continues. Every event that reaches the node starts its own timer, so five events arriving a minute apart produce five separate continuations.

Use it for a deliberate pause: switch a light on, wait ten minutes, switch it off again.

Because each event gets its own timer, a fast trigger behind a fixed delay piles up pending waits and then releases them in a burst. For anything chatty, use Debounce.

Debounce​

Each new event that reaches the node restarts the timer. The branch continues only once the duration has passed with nothing new arriving.

Use it to wait for things to settle. A door sensor that flaps as somebody works in the doorway should produce one message after the movement stops, not one per swing.

Debounce is also the answer to a sensor that reports every few seconds while a value hovers on a threshold.

A delay in front of an action​

An action set to Only when it becomes true or Only when it stops being true still works behind a delay. The condition's transition is carried across the wait, so the action that fires after the pause is the one the condition asked for.

That is what lets you build "if it is still too warm ten minutes later, tell somebody" without the alert repeating on every report in between.

Redundancy check​

Use this when an action is not certain to take effect. A LoRaWAN downlink reaches the device on the first attempt about four times in five, so a rule that switches a streetlight needs a way to notice and re-send.

SettingWhat it does
Target deviceSelected device, the triggering device, or a device group
DeviceThe device to re-read, when the target is a selected device
Device groupThe group whose devices are re-read, when the target is a device group
Device field, operator, expected valueThe check, written like a value threshold
Retry intervalHow long to wait before each check. At least 5 seconds, at most 30 days
Max retriesHow many times the blocks after it may run again. At most 20, and 10 if left alone

How it runs​

An incoming connection arms the block, and nothing after it runs at that moment. When the interval has passed the device is read again and the check is tested against its current values.

  • The value matches: the effect landed, and the branch stops.
  • It does not match: everything connected after the block runs again and the timer restarts, up to the retry limit. After that the rule gives up.
  • The device carries nothing at that field: this counts as not matching, so the rule keeps retrying. A field the device has never reported looks exactly like an effect that has not landed. Check the field name in the run history, which records the value read on each attempt.

How to wire it​

Because arming runs nothing immediately, connect the trigger to both the action and the redundancy check, and point the redundancy check back at that same action.

Wired in line instead - trigger, then check, then action - the first attempt is delayed by a whole interval. The rule then reads as "wait, then start sending" rather than "send, verify, re-send".

Keep the interval longer than the device's own reporting interval. A device cannot confirm anything before it next reports, so a shorter interval spends the retry budget sending into the gap.

A time-based trigger carries no device, so choose Selected device or Device group there. Set to the triggering device it resolves to nothing and every check is dropped; the editor flags this before you save.

Checking a device group​

With Device group, every device in the group is read when the interval has passed. Devices that confirm drop out; the connected blocks run again once for the ones that did not, and only those are read again next time. A LoRaWAN downlink set to the same device group is then sent only to the devices being retried, not to the whole group again. So one sun-event rule can switch a whole street of lights and keep re-sending to just the lamps that missed it.

Saving the check needs read access to the group and to every device in it. The group's devices are looked up when the check is armed, up to 500. The retry limit counts rounds, and each round is one entry in the run history: how many devices were read, and which did not confirm with the value read off each. A report from any device in the group counts as the group confirming, so it never restarts the retry limit.

When the rule fires again mid-check​

A check holds one retry budget at a time.

Reports from the device being checked do not disturb it. The device usually reports as a result of the very command being retried. Restarting the count on each of those would mean the retry limit is never reached.

Any other trigger - a scheduled run, or a different device - cannot be the checked device confirming. It therefore starts a new run: the pending check is replaced and the budget starts over. A streetlight rule that gave up last night is retried in full at tonight's sunset.

The retried blocks act on the device that triggered the rule, not the device the check reads. An action addressed to the triggering device goes back to the same device on every attempt.

For each device in group​

Runs everything after the block once for each device in the chosen groups (up to 10), with that device as the triggering device. Its current values are read when its turn comes, so a condition can look at each device on its own, and an action set to the triggering device goes to that device only. Each device's run is its own entry in the run history.

SettingWhat it does
Device groupsThe groups to go through. A device in several of them runs once
Delay between devices (ms)The wait before the next device starts. 0 runs every device at once

The editor shows how long going through every device takes. One run may take at most an hour; a rule that would take longer cannot be saved.

Example - street lighting with a manual override: Sun event -> For each device in group (2000 ms) -> Condition relay2State = true -> Send LoRaWAN downlink (triggering device). A relay switched off by hand is skipped, and the rest are switched 2 seconds apart, so their confirmations do not collide.

  • Send downlinks to the triggering device after this block. A downlink to a device group would go to every device in the group once per device; the editor flags it.
  • If the rule runs again before every device has had its turn, the devices still waiting start over from the new run, so two runs never interleave.
  • Disabling the rule stops the devices that have not had their turn yet.
  • A device that has been deleted, or cannot be read when its turn comes, still gets an entry in the run history, marked as stopped, so you can see why it did nothing.
  • Put a redundancy check after this block on the triggering device, not on a device group, so each device gets its own retries. The editor flags a device group there, and a second For each device in group inside the first.