private@homelab: ~/latest
local-first guides · privacy-aware · no noisy tracking
private@homelab:~$ cat guides/article.md
· ·
6–10 minutes
read

Aqara Smart Plug ZNCZ12LM: Zigbee2MQTT + Home Assistant Setup

Set up the Aqara ZNCZ12LM smart plug with Zigbee2MQTT and Home Assistant — pairing, energy monitoring, known broken features, and what to use instead.

The Aqara ZNCZ12LM is one of the more capable plugs you can run through Zigbee2MQTT — energy monitoring, power-outage memory, consumer detection, calibration offsets. It pairs cleanly, acts as a Zigbee router, and adds meaningful entities to Home Assistant.

There’s also a known problem: three of its documented features — auto_off, led_disabled_night, and overload_protection — appear in the Z2M interface but don’t actually work. The device silently ignores the commands, or throws a UNSUPPORTED_ATTRIBUTE error. This has been open on the Z2M GitHub tracker since at least 2022 and is still unfixed as of mid-2026.

This guide covers setup, the full entity list, how to get energy data into the HA Energy Dashboard, and what to do instead of relying on those broken features.

What the ZNCZ12LM Is

The ZNCZ12LM is the wall-socket form-factor version of Aqara’s CN-market smart plug. It fits the recessed Type A two-pin sockets common in mainland China and some other markets. It is not the same as:

All three are supported by Zigbee2MQTT, but they’re different products with different entity sets and slightly different quirks. If your plug doesn’t match the wall-socket form factor, check the ZNCZ02LM or ZNCZ04LM guides instead — the round barrel plugs cover the other common CN form factor.

One practical advantage of the ZNCZ12LM: because it’s mains-powered, it acts as a Zigbee router. It extends mesh coverage for battery-powered end devices (sensors, remotes) nearby. If you have a corner of your home where sensors drop off, a plug in that area can be a cheap way to extend range.

What You Need

  • A Zigbee coordinator (e.g., SONOFF Zigbee 3.0 USB dongle, Conbee II, or similar)
  • Zigbee2MQTT installed and running
  • Home Assistant — any recent version works
  • The ZNCZ12LM itself
  • No Aqara hub. No Aqara Home app. No cloud account.

If you’re starting from scratch with the full local-only stack, the Aqara E1 hub setup guide has a good walkthrough of the coordinator-to-Z2M-to-HA pipeline, though for this plug you don’t need the hub at all.

Pairing the ZNCZ12LM

  1. In the Zigbee2MQTT frontend, click Permit join (or set permit_join: true in your Z2M config temporarily).
  2. Plug the ZNCZ12LM into the wall socket.
  3. Press and hold the small reset button on the side or bottom of the plug until the LED starts blinking. On my unit this took about 5 seconds.
  4. The LED will blink a few times, then the device should appear in the Z2M Devices list as ZNCZ12LM with its IEEE address.
  5. Give it a friendly name in Z2M. I use room-based naming (kitchen_plug_1, desk_charger, etc.) — makes automation targeting cleaner later.
  6. Disable Permit join once it’s paired.

The device shows up immediately with its full entity set. No firmware update required to get basic functionality working.

Entities in Home Assistant

Once paired, Z2M exposes the following entities via MQTT discovery:

Entity Type Unit Notes
switch Switch on/off Main relay control
power Sensor W Real-time power draw
energy Sensor kWh Cumulative energy — resets if device loses power briefly
voltage Sensor V Line voltage
current Sensor A Draw in amps
device_temperature Sensor °C Internal temp of the plug
consumer_connected Binary sensor true/false Detects physical plug in socket
power_outage_memory Select on/off/restore Behavior after power cut
auto_off Number minutes Does not work — see below
led_disabled_night Switch on/off Does not work — see below
overload_protection Number W Does not work — see below

The consumer_connected entity is worth calling out. When set, it reflects whether a physical device is plugged into the socket the relay controls. If someone unplugs the appliance while the relay is on, consumer_connected goes false. You can use this in an automation to detect unexpected disconnections — useful for things like aquarium pumps where an unplug matters.

power_outage_memory works correctly. The restore option tells the plug to return to whatever state it was in before the outage — useful if you want a lamp to come back on automatically without building an automation for it.

Setting Up the Home Assistant Energy Dashboard

The energy entity (kWh) feeds directly into HA’s Energy Dashboard, which gives you historical consumption graphs and cost tracking.

To add it:

  1. Go to Settings > Dashboards > Energy.
  2. Under Individual devices, click Add device.
  3. Search for your plug’s energy entity (it’ll be named something like sensor.kitchen_plug_1_energy).
  4. Select it and save.

One thing that caught me the first time: the Energy Dashboard won’t show data for a newly-added device until at least a few minutes of readings have accumulated. If you add the entity and the graph is empty, wait 10 minutes and refresh. It’s not broken — the dashboard just needs a baseline before it can draw anything meaningful.

The power (W) sensor is separate from the energy (kWh) sensor. power is instantaneous draw; energy is the running cumulative total. For the Energy Dashboard, you want the energy (kWh) entity. The power entity is more useful for live monitoring dashboards or automation triggers.

What Works and What Doesn’t

This is the part the Z2M device reference doesn’t tell you clearly.

Three entities appear in the Z2M interface for this device and look like they should work: auto_off, led_disabled_night, and overload_protection. In practice, sending commands to any of these either does nothing or returns a ZCL command failed (Status 'UNSUPPORTED_ATTRIBUTE') error in the Z2M logs. The device firmware doesn’t implement these ZCL attributes, despite the hardware being listed as supporting them.

This has been tracked in Z2M GitHub issues #25969 and #20430 since at least 2022 and is still open as of mid-2026. No firmware update from Aqara has addressed it for the ZNCZ12LM specifically.

What this means practically:

For timed shutoff (replacing auto_off): Build an HA automation instead. A simple one: trigger on the switch turning on, wait a set duration, then turn it off. For something more useful, trigger on the power entity — if the plug drops below 2W for more than 5 minutes, it probably means the device has finished charging or is in standby, and you can turn the relay off automatically.

For overload protection: Your best option is an HA automation that monitors the power sensor and turns the plug off if it exceeds a threshold you set. It’s not hardware-level protection (the plug won’t cut power before HA processes the reading), but for most home use cases the few-seconds lag is acceptable.

For LED night mode: There’s no workaround via Z2M as of now. If the LED is bothering you at night, covering it physically is the only option.

Honestly, I think Aqara should either fix the firmware or remove these from the Z2M exposes list entirely — having broken controls in the UI without any indication they don’t work is a worse experience than just not having them.

Calibration

If your ZNCZ12LM reads consistently high or low compared to a known-good reference energy meter, you can apply percentage offsets in Z2M. The following are adjustable:

  • power_calibration — percentage offset for watt readings
  • energy_calibration — percentage offset for kWh readings
  • voltage_calibration — percentage offset for voltage
  • current_calibration — percentage offset for current

There are also precision settings for each measurement (number of decimal places reported). These are in the Z2M device config, not the HA entity settings. For most home monitoring use, the uncalibrated readings are close enough — within a few percent of a reference meter. Calibration is worth doing if you’re tracking energy costs seriously or comparing across multiple plugs.

ZNCZ12LM vs ZNCZ02LM vs ZNCZ04LM

All three are CN-market Aqara/Xiaomi smart plugs supported by Zigbee2MQTT. The differences that matter:

ZNCZ12LM ZNCZ02LM ZNCZ04LM
Form factor Wall socket (flat, CN Type A) Round barrel plug Round barrel plug
Energy monitoring Yes Yes Yes
consumer_connected Yes No No
auto_off Listed, broken Listed, broken Listed, broken
Zigbee router Yes Yes Yes
Calibration Yes Yes Yes

The auto_off attribute is exposed in Z2M for all three models, but the same UNSUPPORTED_ATTRIBUTE failure shows up across the Aqara plug line — don’t count on the native timer on any of them. Use an HA automation for timed shutoff regardless of which plug you have.

If you’re outside mainland China and using EU sockets, the SP-EUC01 is the right one — different form factor, same Z2M support path.

The ZNCZ12LM’s main advantage over its siblings is consumer_connected. If you want to detect whether a device is physically plugged in, this is the one to choose.

Keeping an Eye on OTA Updates

The ZNCZ12LM supports OTA firmware updates via Z2M’s OTA tab. As of mid-2026, no Aqara OTA update has resolved the broken auto_off, led_disabled_night, or overload_protection issues — but it’s worth checking periodically. If a firmware fix ever ships, it’ll show up in the OTA tab before anything else.

To check: go to Z2M frontend > your device > OTA tab > click Check for update. If an update is available, Z2M will prompt you to apply it. The plug stays paired through the process.

Whether Aqara actually ships a fix for these attributes is an open question — the GitHub issues have been sitting for a couple of years without any response from their side.


No hub required. No cloud account. The ZNCZ12LM talks directly to your Zigbee coordinator.

local-firstHome Assistantno-cloud