kotlin-homie / org.homieiot / Device / node

node

fun node(id: String, type: String, name: String = id, init: Node.() -> Unit): Node

Add a org.homieiot.Node to this device

Parameters

id - Each node must have a unique device ID which adheres to the homie id convention

name - Friendly name of the node

type - Description of the node type, for example if the node was a car engine, the type may be "V8"

init - Function that supplies this node to enable adding properties to the node

fun node(id: String, type: String, name: String = id, range: IntRange, init: Node.(index: Int) -> Unit): Unit

Add a range of org.homieiot.Node to this device

Parameters

id - Each node must have a unique device ID which adheres to the homie id convention.

name - Friendly name of the node

type - Description of the node type, for example if the node was a car engine, the type may be "V8"

range - Creates multiple nodes, automatically incrementing the id of each with "-" and a number in the range. For example, if the id is "foo" and range is 1..3 nodes with ids "foo-1", "foo-2" and "foo-3" will be created.

init - Function that takes the index of an node and this node itself to enable adding properties to the node