Espex.DeviceConfig.Device (espex v0.1.1)

Copy Markdown View Source

Description of an ESPHome sub-device.

An ESPHome node can expose multiple logical devices. Each entity advertises which sub-device it belongs to via its device_id field. A top-level entity (attached to the node itself, not a sub-device) uses device_id: 0 — which is the default for protobuf uint32 and therefore also the default when the field is omitted.

Populate Espex.DeviceConfig's :devices field with a list of these structs to declare the sub-devices exposed by your server.

Summary

Functions

Build a %Device{} from keyword options.

Convert to the protobuf DeviceInfo message used inside DeviceInfoResponse.devices.

Types

t()

@type t() :: %Espex.DeviceConfig.Device{
  area_id: non_neg_integer(),
  id: pos_integer(),
  name: String.t()
}

Functions

new(opts)

@spec new(keyword()) :: t()

Build a %Device{} from keyword options.

to_proto(device)

@spec to_proto(t()) :: Espex.Proto.DeviceInfo.t()

Convert to the protobuf DeviceInfo message used inside DeviceInfoResponse.devices.