IfFlow

class IfFlow : Node


A Node that conditionally executes one of its branches based on evaluating conditions in order. This represents a complete if-elseif-else structure.

It operates similar to traditional if-elseif-else construct:

The node in ifThen is executed if its condition is true. If not, the conditions in elseIfThens are evaluated in order sequentially, and the node of the first IfThen with a true condition is executed. If all conditions are false, the elseThen node is executed, if provided. If no condition is met and no elseThen is provided, then no Node within this IfFlow executes, and execution continues to the Node following this IfFlow in the parent SequentialFlow.

This class is the final representation of a conditional flow, often built using the IfChain builder within the IfFlowDsl.

Summary

Public constructors

IfFlow(ifThen: IfThen, elseIfThens: List<IfThen>, elseThen: Node?)

Create an IfFlow instance.

Public properties

List<IfThen>

Optional subsequent conditional clauses in the IfFlow.

Node?

An optional else clause of the IfFlow.

IfThen

The primary IfThen in the IfFlow.

Inherited properties

From com.google.home.automation.Node
String?

String identifier of this node.

Public constructors

IfFlow

IfFlow(
    ifThen: IfThen,
    elseIfThens: List<IfThen> = emptyList(),
    elseThen: Node? = null
)

Create an IfFlow instance.

Parameters
ifThen: IfThen

The first IfThen clause of the IfFlow.

elseIfThens: List<IfThen> = emptyList()

Optional subsequent conditional clauses in the IfFlow.

elseThen: Node? = null

The else clause of the IfFlow represented as an executable Node.

Public properties

elseIfThens

val elseIfThensList<IfThen>

Optional subsequent conditional clauses in the IfFlow. These will execute in order if the primary IfThen is false. If any IfThen condition defined in this list is true, its associated node is executed, and the rest of the conditions are not evaluated.

elseThen

val elseThenNode?

An optional else clause of the IfFlow. If provided, this will execute if none of the previous IfThen clauses execute.

ifThen

val ifThenIfThen

The primary IfThen in the IfFlow. This is the first condition that is evaluated.