kotlin-homie / org.homieiot / Device

Device

class Device

A device represents a physical piece of hardware. For example, an Arduino/ESP8266 or a coffee machine.

A device is composed of one or more org.homieiot.Node objects. Nodes are independent or logically separable parts of a device.

Nodes are themselves composed by org.homieiot.Property objects. Properties represent basic characteristics of the node/device, often given as numbers or finite states.

Types

State

enum class State

The current state of the device.

Functions

node

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

Add a org.homieiot.Node to this device

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

state

fun state(state: State): Unit

Set the state based on the state of the physical or virtual device.