To contribute to this page, edit the following file

Xiaomi ZNCZ02LM #

Model ZNCZ02LM
Vendor Xiaomi
Description Mi power plug ZigBee
Supports on/off, power measurement
Picture Xiaomi ZNCZ02LM

Notes #

Pairing #

Press and hold the button on the device for +- 10 seconds (until the blue light starts blinking and stops blinking), release and wait.

You may have to unpair the switch from an existing coordinator before the pairing process will start.

Power outage memory #

This option allows the device to restore the last on/off state when it’s reconnected to power. To set this option publish to zigbee2mqtt/[FRIENDLY_NAME]/set payload {"power_outage_memory": true} (or false). Now toggle the plug/switch once with the button on it, from now on it will restore its state when reconnecting to power.

Voltage #

Some versions of the plug provide voltage. This depends on the firmware on the device. Confirmed working are the ones with dateCode 02-28-2017 (can be checked in data/database.db). Note that Xiaomi doesn’t provide firmware files, so the software cannot be downgraded/upgraded.

Manual Home Assistant configuration #

Although Home Assistant integration through MQTT discovery is preferred, manual integration is possible with the following configuration:

switch:
  - platform: "mqtt"
    state_topic: "zigbee2mqtt/<FRIENDLY_NAME>"
    availability_topic: "zigbee2mqtt/bridge/state"
    payload_off: "OFF"
    payload_on: "ON"
    value_template: "{{ value_json.state }}"
    command_topic: "zigbee2mqtt/<FRIENDLY_NAME>/set"

sensor:
  - platform: "mqtt"
    state_topic: "zigbee2mqtt/<FRIENDLY_NAME>"
    availability_topic: "zigbee2mqtt/bridge/state"
    unit_of_measurement: "W"
    icon: "mdi:flash"
    value_template: "{{ value_json.power }}"

sensor:
  - platform: "mqtt"
    state_topic: "zigbee2mqtt/<FRIENDLY_NAME>"
    availability_topic: "zigbee2mqtt/bridge/state"
    unit_of_measurement: "°C"
    device_class: "temperature"
    value_template: "{{ value_json.temperature }}"

sensor:
  - platform: "mqtt"
    state_topic: "zigbee2mqtt/<FRIENDLY_NAME>"
    availability_topic: "zigbee2mqtt/bridge/state"
    unit_of_measurement: "kWh"
    value_template: "{{ value_json.consumption }}"
    icon: "mdi:flash"

sensor:
  - platform: "mqtt"
    state_topic: "zigbee2mqtt/<FRIENDLY_NAME>"
    availability_topic: "zigbee2mqtt/bridge/state"
    unit_of_measurement: "V"
    icon: "mdi:alpha-v"
    value_template: "{{ value_json.voltage }}"

sensor:
  - platform: "mqtt"
    state_topic: "zigbee2mqtt/<FRIENDLY_NAME>"
    availability_topic: "zigbee2mqtt/bridge/state"
    icon: "mdi:signal"
    unit_of_measurement: "lqi"
    value_template: "{{ value_json.linkquality }}"