Xiaomi Smart Plug ZNCZ04LM: Zigbee2MQTT + Home Assistant Setup Guide
Affiliate disclosure: This article contains affiliate links to products mentioned. If you buy through these links, I may earn a small commission at no extra cost to you. I only link to products I’d actually recommend.
The Xiaomi Smart Plug ZNCZ04LM adds local switching and energy monitoring to Home Assistant through Zigbee2MQTT. It uses Zigbee rather than Wi-Fi, so it does not need a Xiaomi account or cloud connection once paired to your coordinator.
Below are the pairing steps, the available entities, and the Energy Dashboard setup. The troubleshooting section covers connection dropouts, energy-reading problems, and the extra button press needed to enable power outage memory.
Which Xiaomi plug is this?
The ZNCZ04LM is Xiaomi’s EU Schuko/Type-F format smart plug. Internally, Zigbee2MQTT identifies it as lumi.plug.mmeu01. It’s a mains-powered device, which means it acts as a Zigbee router — helpful for mesh stability in larger setups.
It’s not an Aqara device, despite often being sold alongside Aqara kits. The Aqara-branded equivalent for EU users is the SP-EUC01, which has its own dedicated setup guide. The ZNCZ04LM is the Xiaomi Mi Home line — same underlying Zigbee, different branding. In practice, the capabilities are similar but the known bugs differ.
Check the model number on the plug before following the setup steps. The comparison below distinguishes the ZNCZ04LM from the ZNCZ02LM and ZNCZ03LM.
What You Get After Pairing
Alongside on/off control, Zigbee2MQTT exposes the following settings and measurements:
Core controls:
– Switch (on/off/toggle)
– LED night mode indicator (on/off)
– Auto-off (enable/disable): turns the plug off when consumption stays below 2 W for 20 minutes; the documented threshold and duration are fixed
– Overload protection threshold (configurable, 100–2300W range)
– Power outage memory (retain last on/off state after power cut)
Energy monitoring:
– Power (W) — real-time
– Energy (kWh) — cumulative
– Voltage (V)
– Current (A)
– Device temperature (°C) — the plug’s own operating temperature, not room temp
Diagnostic / calibration:
– Consumer connected (boolean — whether the plug detects a load)
– Calibration offsets for power, energy, voltage, and current
The power sensor shows the current draw, while the cumulative energy sensor is the one to use for consumption tracking. Both need some care around firmware updates and Z2M restarts, as described below.
Prerequisites
You need Zigbee2MQTT running with a USB coordinator. If you’re starting from scratch, the Aqara Zigbee devices without a hub guide covers coordinator selection and Z2M setup.
Check the exact Sonoff model name when choosing a coordinator. Both versions are sold as the Zigbee 3.0 USB Dongle Plus: the ZBDongle-P uses a CC2652P chip, while the ZBDongle-E uses an EFR32MG21. Sonoff’s model comparison explains the distinction. A historical report, Z2M issue #14299, describes null energy-monitoring readings with a Dongle-E on Z2M 1.28.0-1. The issue was closed as not planned; that does not establish that every current Dongle-E setup has the same problem.
The CC2652P-based ZBDongle-P is an option for a new Z2M setup. If buying through Amazon — affiliate link — check the full model number rather than relying on the shared Dongle Plus name.
Pairing the ZNCZ04LM
Start with the plug close to the coordinator for its first pairing.
- Open Z2M → Zigbee Devices → “Permit join” (all or to a specific coordinator/router)
- On the plug: hold the button until the indicator light blinks blue rapidly, then release
- The plug should appear in Z2M within 30–60 seconds
If the join times out, try pressing the button once every second to keep the plug in pairing mode. Xiaomi Zigbee devices can stop trying before the interview completes. Once joined, move the plug to its intended location and check that it stays connected.
After joining, give Z2M about 30 seconds to interview the device and populate all entities. You’ll see the full entity list appear in the Z2M frontend. In Home Assistant, the entities appear under the MQTT integration automatically if you have the Z2M ↔ HA integration configured.
Setting Up Energy Monitoring
The plug’s power and energy entities map directly to Home Assistant’s Energy Dashboard, but you need to configure them explicitly.
In Home Assistant:
1. Go to Settings → Energy
2. Under “Individual devices,” add the ZNCZ04LM’s energy sensor (the kWh entity, not the power entity)
3. If the entity doesn’t appear in the dropdown, check that it’s enabled in Z2M (some Z2M versions disable diagnostic/calibration entities by default — enable them in the Z2M device settings tab)
Power vs. energy entities: The power entity (W) gives you real-time draw. The energy entity (kWh) is the cumulative counter that HA’s Energy Dashboard uses. They’re separate entities and both are exposed after pairing. The Energy Dashboard wants the energy entity specifically.
Calibration: Z2M documents percentage offsets for power, energy, voltage, and current on the ZNCZ04LM device page. Compare with a suitable reference meter before changing them. The device-temperature offset is different: it is an absolute temperature adjustment. These fields do not all use the same units.
Known Bugs and Caveats
Check these behaviours if the plug turns off unexpectedly, loses energy readings, or fails to restore its state after a power cut. Some reports refer to older Z2M versions, so compare the reported version with your own setup before assuming the same cause.
Auto-Off on Weak Coordinator Signal
If the plug loses its Zigbee connection to the coordinator — not just a brief delay, but an actual dropped link — it may turn itself off. This is a firmware-level safety behavior: the plug interprets a lost coordinator as a network fault and defaults to off.
A periodic turn-on command can work around a dropout, but it does not repair the connection. First check mesh coverage: add a Zigbee router between the plug and coordinator, or move the coordinator closer. The plug should stay connected reliably at its installed location.
Energy Counter Resets After OTA Firmware Update
Applying an OTA firmware update can reset the ZNCZ04LM’s cumulative energy counter to zero, as reported in Z2M issue #13463. This matters if you use the counter for monthly or annual consumption records: the device’s total starts again after the update.
Record the counter before an update and check the readings afterwards. A genuine counter reset does not require deleting your consumption history: HA’s total-increasing state class is intended for meters that can reset. Check the energy entity’s state class and statistics before changing anything. An incorrect spike is a separate problem; inspect and correct that anomaly rather than clearing all statistics.
Energy Spike After Z2M Restart
When Z2M restarts, the ZNCZ04LM sometimes reports a wrong energy value for the first several polling cycles before settling to the correct reading (Z2M issue #23594, closed not-planned). If your HA Energy Dashboard shows a suspicious jump or dip in consumption on the days you restart Z2M, this is the cause.
The practical workaround is to use HA’s Statistics entities and flag or exclude the anomalous readings manually. You can also add a filter integration in HA’s sensor configuration to discard readings that deviate sharply from the previous value, though that adds complexity. For most users, acknowledging the glitch and using the long-term statistics outlier handling is enough.
Energy Monitoring Null with Sonoff Dongle-E
If all energy-monitoring entities show unavailable or null, check your coordinator model and software versions. Z2M issue #14299 reports this with a Sonoff Dongle-E on Z2M 1.28.0-1. It was closed as not planned. Compare that older report with your own logs before replacing hardware; the CC2652P-based ZBDongle-P is a different adapter from the EFR32MG21-based Dongle-E.
Power Outage Memory Requires a Physical Button Press
After changing power_outage_memory in Z2M or Home Assistant, toggle the plug once using its physical button. The setting needs that button press before it takes effect, as described in the Z2M device documentation. Do this each time you change the setting, then test whether the plug restores the expected state after a power cut.
Privacy and Network Notes
The ZNCZ04LM is Zigbee-only. There is no Wi-Fi radio in this device. Once it’s paired to a Z2M coordinator, its only communication path is via Zigbee to the coordinator — and from there, Z2M communicates to HA over MQTT on your local network.
The plug itself has no IP connection to Xiaomi’s servers. In this setup, commands and readings pass between the plug, your Zigbee coordinator, and Home Assistant over the local Zigbee and MQTT links.
If you want to verify this on your own network, a quick tcpdump on your IoT VLAN for DNS queries to *.mi.com or *.xiaomi.com while the plug is operating will show nothing. Compare this to devices with Wi-Fi radios, where you need VLAN segmentation and firewall rules to achieve the same result.
ZNCZ02LM vs ZNCZ03LM vs ZNCZ04LM
If you landed here with a different model number, here’s the quick disambiguation:
- ZNCZ02LM — CN/AU variant, Type-I (Australian) or Type-A two-pin plug. Same core functionality as the ZNCZ04LM, different physical form factor.
- ZNCZ03LM — newer CN-market variant. Schuko-incompatible. Same Zigbee capability set.
- ZNCZ04LM — EU Schuko/Type-F plug. This guide.
These are not physically interchangeable. The Z2M device pages are separate, and some firmware quirks differ between them. If you have a ZNCZ02LM or ZNCZ03LM, the entity list and integration approach are similar, but check the model-specific Z2M docs page for any differences in the known issues list.
Automation Example: Energy Alerting
One practical use for the energy monitoring beyond the Energy Dashboard: alerting when a device is consuming above a threshold for longer than expected. This works well for appliances that should be idle — a printer, a gaming console, a TV — that you want to flag if they’re drawing standby power.
alias: "ZNCZ04LM: High draw alert"
trigger:
- platform: numeric_state
entity_id: sensor.xiaomi_plug_power
above: 50
for:
minutes: 10
action:
- service: notify.mobile_app_your_phone
data:
title: "Plug drawing high power"
message: >
{{ states('sensor.xiaomi_plug_power') }} W for 10+ minutes on xiaomi_plug.
Paste this into one automation’s YAML editor. Replace both occurrences of the power entity and use your phone’s actual notification service. Adjust the 50 W threshold for the appliance. The ten-minute delay ignores brief startup spikes; it is not a safety cutoff. If using automations.yaml instead, add this mapping as a list item alongside your other automations.
For a complementary automation: trigger a monthly energy report by reading the energy entity on the first of each month and logging it to a helper or sending a notification. The cumulative counter approach is more reliable than relying on HA’s statistics alone for custom reporting intervals.
Verdict
For an EU socket, the ZNCZ04LM provides local control and the power, energy, voltage, and current readings needed for everyday monitoring. Its connection and counter quirks are the main things to account for before relying on it for long-term records.
Before putting it into regular use, confirm that your coordinator receives the energy readings, plan for counter resets around OTA updates, and check for temporary incorrect readings after Z2M restarts. Remember to press the physical button after changing power outage memory.
If you have the Aqara SP-EUC01 instead, there’s a dedicated guide for that device — similar setup, different entity set and bugs. For in-wall switching without a plug, the Aqara Single Switch Module T1 is worth considering.
If you choose the Sonoff adapter mentioned above, look for ZBDongle-P on the listing. The shared Dongle Plus name alone does not distinguish it from the Dongle-E. It is available on Amazon — affiliate link.
