[OBSOLETE] Xiaomi Zigbee Smart Outlet device handler


The SP-EUC01 supposedly has the following attributes:
switch (state), power, energy, temperature, voltage, current, linkquality

(source: Xiaomi SP-EUC01 control via MQTT | zigbee2mqtt.io)

But based on the fromZigbee.js from herdsman (zigbee2mqtt), I cant find a custom code for it, so I’m guessing its using standard zigbee nodes.

Go into the hub events, and try and find the registration event, which should tell me which clusters of zigbee are available and adjust the code for the SP-EUC1,

This is the event I’m looking for:

zbjoin: {“dni”:“A123”,“d”:“0012345678ABCDEF”,“capabilities”:“8E”,“endpoints”:[{“simple”:“01 0104 0051 01 09 0000 0004 0003 0006 0010 0005 000A 0001 0002 02 0019 000A”,“application”:“01”,“manufacturer”:“LUMI”,“model”:“lumi.plug”},{“simple”:“02 0104 0009 01 01 000C 02 000C 0004”,“application”:"",“manufacturer”:"",“model”:""},{“simple”:“03 0104 0053 01 01 000C 01 000C”,“application”:"",“manufacturer”:"",“model”:""}]

A bit more info if you’re interested:
[Tutorial] How to understand Zigbee to develop a device handler - Wiki / How-To - SmartThings Community

OK this is weird… i tried at least 6 times pairing and it always works OK but i cant see in live logging or hub events any zbjoin event… actually hub events stay completely empty… there should be zbjoin event normally yes ?

This is the only event i can see related to SP-EUC01 outlet:

  • Configuring Reporting and Bindings, setting schedule and forcing first report

Maybe i am doing something wrong ?

----- UPDATE! -----
Hub events started working :slight_smile:

zbjoin: {“dni”:“003C”,“d”:“04CF8CDF3C821500”,“capabilities”:“8E”,“endpoints”:[{“simple”:“01 0104 0051 01 09 0000 0002 0003 0004 0005 0006 0009 0702 0B04 02 000A 0019”,“application”:“20”,“manufacturer”:“LUMI”,“model”:“lumi.plug.maeu01”},{“simple”:“F2 A1E0 0061 00 00 01 0021”,“application”:"",“manufacturer”:"",“model”:""}],“parent”:“0000”,“joinType”:1,“joinDurationMs”:760,“joinAttempts”:1}

Did the zbjoin event info help in any way ? (sorry dont mean to rush things just making sure since i only updated my earlier msg and did not create new reply) :wink:


Didn’t had time until today to read up, just updated the handler to reflect the required clusters (use the same link provided in the first post).

It uses standard power/energy, which is 0B04 and 0702,

As I don’t know the magnitude of power/energy, the values may be off by an X factor either divided or multiplied probably by 1000.

Edit: Slightly modified (V1.7.1) due to bad documentation from SmartThings related to Power/Energy cluster zigbee.x methods.

1 Like
  • The obvious one: power outage memory.
  • turn off the led between 9PM to 9AM! (this is great, it was annoying me like crazy when close to it in the dark)
  • charging protection! (if power is less than 2W for 30m, turn off) (it seems its a zigbee command setting on its own and not a automation)

I had to connect to AQARA Hub and re-pair to ST to use these functions…
Any chance to get lower refresh rate time? I use the Plug to tell if my TV is on or off for other automations and stuff like this is really important
Awesome work on the DTH, Thank you!

PS what does the momentary button doing?

Hi @BaRaD5,

For the extra functionality, I haven’t had time to do the research required to enable the functions on ST (Also, every Xiaomi Zigbee plug has a different code/behaviour, and was only aware of the ZNCZ02LM one).

If you’re asking for the refresh of the ZNCZ02LM, unfortunately that’s a custom Xiaomi refresh message, so it cannot be changed.

As for forcing the refresh interval for any model try the following:

1.- remove the following from line 120:

runLocally: true, executeCommandsLocally: true

2.- add the following after line 157:

rates << [“1” : “Refresh data every 1 minute”]

3.- then, over the options, change the refresh to the newly added 1 minute option :slight_smile:

I’m not entirely sure if it’ll work, as SmartThings from memory has a limit of zigbee/refresh messages a device can handle every X minutes/seconds.

Let me know of that is what you want and it works :slight_smile:

As for your question:

What momentary button? Do bear in mind the only physical outlet I had to test around was the ZNCZ02LM.

Thanks for responding!
We have the exact same model number (ZNCZ02LM) and i seem to have a momentary button (could be from the previous DTH because I just switched and not re-pair)

When theres a “huge” surge in power (1 to 80) the plug will immediately update this info but when turning off the plug will take a minute or so I also did as you instructed.

Hmm yes, that’s probably from an old DTH, normally in those situations you delete the device, close the app, force stop in android, and clear cache, re-add the device, and the problem’s gone.

For the updates, yes its because of the Xiaomi custom refresh message, took me quite a while to understand and parse it’s logic as it’s very complicated and against the zigbee standard.

1 Like

So yes i am now at least seeing power values… for example now laptop charger shows value 198 which should mean 19.8w to my understanding (value / 10)… unfortunately i am not seeing any energy values (debug is ON - no other than power related messages)


Aqara Zigbee EU Smart Outlet: Zigbee event extracted from description: [name:power, value:238]

debug Aqara Zigbee EU Smart Outlet: Incoming Zigbee description message: ‘read attr - raw: 003C010B040A0B0529EE00, dni: 003C, endpoint: 01, cluster: 0B04, size: 10, attrId: 050b, result: success, encoding: 29, value: 00ee’

Also for temperature… what is the reporting interval (1 hour?) as it doesnt change after initial report

Looking at live logging it seems my SP-EUC01 (lumi.plug.maeu01) energy and power are other way around… 0702 is energy and 0B04 is power


13:26:56: debug Aqara Zigbee EU Smart Outlet: Incoming Zigbee description message: ‘read attr - raw: 34F9010702120000250C0000000000, dni: 34F9, endpoint: 01, cluster: 0702, size: 18, attrId: 0000, result: success, encoding: 25, value: 00000000000c’
13:30:23: debug Aqara Zigbee EU Smart Outlet: Incoming Zigbee description message: ‘read attr - raw: 34F9010702120000250D0000000000, dni: 34F9, endpoint: 01, cluster: 0702, size: 18, attrId: 0000, result: success, encoding: 25, value: 00000000000d’


13:29:07: debug Aqara Zigbee EU Smart Outlet: Incoming Zigbee description message: ‘read attr - raw: 34F9010B040A0B05298000, dni: 34F9, endpoint: 01, cluster: 0B04, size: 10, attrId: 050b, result: success, encoding: 29, value: 0080’

FYI, i also noticed SmartthingEDGE drivers are now previewing

Hi there,

Are you using the latest 1.7.2 from August? There was a fix for 0702 vs 0B04 that I did back then. did you clear the app cache after installing the new DTH version?

I’ve attempted to understand the lua code development but I decided to stop and throw it in a can until SmartThings can come up with better and more streamlined tutorials on how to understand how to code an edge driver, as the examples/reference docs I saw back then were ugly, badly commented, badly explained.

you can look into my implementation, I have several Xiomi outlets and they work fine for a month already

veonua, I took a look at the sources… can you implement new fingerprint for SP-EUC01 (lumi.plug.maeu01) ?

Yes i am using 1.7.2

This is the problematic part

else if (descMap.cluster == "0702") {
	def power_value = zigbee.convertHexToInt(eventDescMap.value)
	sendEvent(name: "power", value: power_value, unit: "W")

    // Enable debug to see the parsed energy consumption zigbee message
	displayTraceLog("Power consumption zigbee event reported as ${energy_value} W")
else if (descMap.cluster == "0B04") {
	def energy_value = zigbee.convertHexToInt(eventDescMap.value)
	sendEvent(name: "energy", value: energy_value, unit: "kWh")

    // Enable debug to see the parsed energy consumption zigbee message
	displayTraceLog("Energy consumption zigbee event reported as ${power_value} kWh")

@userx, SP-EUC01 is already part of the Groovy DTH (lumi.plug.maeu01),

If you’re talking about @veonua’s implementation, I couldn’t find his code here, but suggest you write on his post.

Argh, fingerprint post was meant for veonua… i need more coffee since its morning… sorry :wink:


0702 is power and 0B04 is energy based on the standard Zigbee clusters, unless SP-EUC01 has a problem with the standard clusters (or I switched them back wrong in 1.7.1),

You can bypass this by switching the sendEvent parts in that part of the code you mentioned:

so switch the:
sendEvent(name: “power”, value: xxxxxxxxx, unit: “W”)
sendEvent(name: “energy”, value: xxxxxxxxxxxx, unit: “kWh”)

Edit 1: where xxxxxxxxx is the variables

Edit 2: and ofc change the debug log parts if you wish.

If you take a look at ZigBee Cluster Library (for ZigBee 3.0) User Guide it states

0B04 = Electrical Measurement Cluster
0702 = Simple Metering Cluster

I havent checked but maybe it was different prior Zigbee 3.0 ? SP-EUC01 = Zigbee 3.0

Yes, I’ve read the cluster library,

for me electrical measurement mean being able to measure, Watts, Amps, Volts,

also to me Simple metering means being able to meter, Wh, consumption calculated in two dimensions.

Edit 1: Note - Since the cluster library doesnt provide examples, and I’m not a native English speaker, and I keep finding people confusing Electrical measurement vs metering (and not a clear, example driven differentiation, and seeing multiple zigbee implementations reversing both, I have not a single source of truth that can tell me which one is which).

done, preferences might not work as my device does not support these extra features