Zigbee2MQTT

The adapter-zigbee2mqtt adapter connects HomeCmdr to Zigbee2MQTT over MQTT. It subscribes to device state topics and publishes commands back to the bridge.

Installation

# From your homecmdr-api workspace root
homecmdr pull adapter-zigbee2mqtt
cargo build

Then add to crates/adapters/src/lib.rs:

use adapter_zigbee2mqtt as _;

Configuration

[adapters.zigbee2mqtt]
enabled = true
server = "mqtt://127.0.0.1:1883"
base_topic = "zigbee2mqtt"
client_id = "homecmdr-zigbee2mqtt"
keepalive_secs = 30
command_timeout_secs = 5

Optional credentials:

username = "mqtt-user"
password = "mqtt-password"
FieldDescription
enabledEnable or disable the adapter
serverMQTT broker URL
base_topicZigbee2MQTT base topic (default zigbee2mqtt)
client_idMQTT client identifier
keepalive_secsMQTT keepalive interval
command_timeout_secsTimeout waiting for command acknowledgment
usernameOptional MQTT username
passwordOptional MQTT password

Device IDs

Device IDs use the Zigbee2MQTT friendly name:

  • zigbee2mqtt:bedside_left
  • zigbee2mqtt:kitchen_plug

Supported Device Classes

Bulbs

Supported state fields: state, brightness, color, color_mode, color_temp.

Supported commands:

CapabilityActions
poweron, off, toggle
brightnessset
color_xyset
color_temperatureset

Smart Plugs

Supported state fields: state, power, energy, energy_today, energy_yesterday, energy_month, voltage, current.

Supported commands:

CapabilityActions
poweron, off, toggle

Lua Examples

-- Turn off all bedroom lamps (assuming a group exists)
ctx:command_group("bedroom_lamps", {
  capability = "power",
  action = "off",
})

-- Set a specific bulb brightness
ctx:command("zigbee2mqtt:bedside_left", {
  capability = "brightness",
  action = "set",
  value = 40,
})

-- Read current power draw from a smart plug
local plug = ctx:get_device("zigbee2mqtt:kitchen_plug")
if plug then
  ctx:log("info", "kitchen plug power", { watts = plug.attributes.power })
end

Notes

This adapter is at V1 scope. Additional Zigbee device classes, device discovery details, and MQTT topic structure documentation will be expanded in a future release.