Xiaomi Mi Smart Plug (New Model) Device Handler

Does the device also work with the new Smartthings app? Does it register history or only current power usage?

It works with the new Smartthings app.

Regarding history, I’m not sure if this is what you mean but I can see historical power readings in the “History” tab for the device:

I can also see it as a graph on the “Controls” tab.

Yes, that’s exactly what I meant, thank you! I’ll be getting a couple of these. It seems like they are the only cheaper alternative for Samsung’s own plugs that actually show energy usage.

I just bought three of these and edited the device handle according to the thread (it was included from my previous sensors through Github, so I only had to change the two lines.

It’s only been a couple of minutes (15? EDIT: 2 hours) but it’s not showing energy usage on any of them. How often does it update?

Edit. Hmm, I don’t seem to have the “Power meter” statistic like you have in your screenshots. I only have “Energy consumption” which is at 0W so far (though it hasn’t been long since I added them). The same goes for both Classic and the new Smartthings app.

I must be missing something of course, I wonder what it is.

Just double checking, but did you edit the device and change the Type field to use your DTH? Can you include a screenshot of yours?

Hmm, no I did not. That might be what I am missing. I might have glared over it, as I mostly checked your reply that was marked as “solved”.

Since I already had bspranger from Github (because of my Xiaomi sensors) I only added the device handler for my Xiaomi outlets and then changed the corresponding lines to match yours (changing to 15 and 16 respectively on line 165 and 172).

I’ll go back and double check and report back.

Edit: It was set as “Zigbee Switch Power” as default. When I switched to “Xiaomi Zigbee Outlet” it does indeed show current wattage usage as intended. That did the trick! Thank you @johnconstantelo! You just made my weekend!



After changing type to “Xiaomi Zigbee Outlet” two of the three outlets do show current wattage, while the third does not. It has the same settings and has been changed to the same type. It’s been on for at least a couple of hours now, shows temperature (which I ignore since it’s at 130 Celsius) but does not show wattage. I have a “dumb” meter connected to that same outlet which shows just below 600W being used, yet the Xiaomi outlet doesn’t show any wattage usage.

Here’s a screenshot of that device (it’s a large screenshot, so I’ll host it at Imgur): https://imgur.com/a/b7W5OeZ

Here’s a comparison to one of the working ones: https://imgur.com/a/NqFu0fm

Any ideas?

Edit: Another sigh because it now works after unplugging it and back again. Problem solved, I hope!

Edit 2: While I’m here, does anyone know if it’s possible to somehow show the wattage usage as “default” among the tiles instead of it showing as a outlet that I can turn on and off?

While not optimal of course, I am using these as “smart energy meters” and they will always be on, so I don’t need it to show up as an actual outlet that I switch on and off from the tiles.

Good that you got it working! Also, nice surprise to see Swedish on your screenshots :slight_smile:

I’m using it for the exact same purpose and would also like to do that.

So I have researched this before because I also have some Aqara temperature/humidity sensors that display humidity by default and I would instead want to show temperature on the app tile. I couldn’t find a way to do it in the new app and I am trying to stick to that as much as possible so it doesn’t hurt as much when Samsung cuts the Classic app, whenever that happens.

However, there seems to be a way to edit the default tile metric on the Classic app but I haven’t tried it myself. Maybe you are OK with using the Classic app so here’s the link to what I found, if you’re interested:

Hope it helps. Lycka till!

Always fun to se fellow Swedes doing this!

Honestly, I don’t like the Classic app at all and only ever use it when I’m adding new devices since it seems to work better. I also have several Xiaomi sensors and two Aqara. At the moment I’m not using the Aqara sensors, but I’m pretty sure they worked as intended when I did use them.

I had another issue with the Xiaomi sensors not reporting temperature on the tiles and was forced to change phone language to English instead of Swedish. Not a good solution, but it worked. Perhaps it could be something similar for you (or not of course).

If you ever happen to stumble upon a solution to showing energy usage on tiles as default with the new app, please let us know!

Can you please send a link to Github where I can find your edited DTH that you are using?
I don’t want to change DTH code, I might damage something…


My code is for the Aqara double rocker w/neutral wire, but I did not edit that or create a new one for this smart plug. It will not work for this plug.

The change I recommended above seems to work, so make another copy of your DTH and make those changes. Switch to your new code and it should work, or just edit your existing code. Those changes won’t break anything important, and you can always change it back.

Thanks. I’ve done what you suggested it works. I can control my

I’ve changed the DHT according to the instruction of @johnconstantelo if someone wants this is the handler that I’ve created:



Thank you so much for this DHT!! It works like a charm!
I thought I purchased this outlet for nothing.You saved me!


Hi @robertash !

So, did this DHT also reports Energy, maybe I haven’t used it enough?

Thank you,

Yes it does. You just have to make some minor changes as outlined in the comment marked as “solution” above.

Already done that, I see only Power, not energy.

Meanwhile I’ve created a webcore piston that calculates the energy used since I don’t understand how these DHT work

Hi guy, before i jump into buying these plugs, I would like to know a couple more things:
-does it act as a zigbee repeater like Ikea plugs. It should be showing in IDE under the zigbeeNodeType?
-does it register the Energy consumption over a period of time, monthly lets say?

Meanwhile I’ve created a webcore piston that calculates the energy
Also, @Sterian_Vlad, can you share that webore piston, please, I really wonder how you did it.

Thank you,

Salut @LucianC

Here are the main functions of my webcore piston:

  • Measure the power input of a Power Plug on which I’ve connected a clothes dryer (but could work very fine for any other appliance)
  • automatically calculates the cycle, weekly and monthly energy (the DHT of the plug cannot read it)
  • based on the used energy, it calculates the cost of a cycle usage, alongside with weekly and monthly usage.
  • it sends a notification after each cycle, week, month with the usage and costs
  • opens a virtual contact that triggers an Alexa Routine -> for voice announcements (RIP EchoSpeaks :frowning:)

I think it can be improved in terms of avg power consumption, so I am open to suggestions.My way works but it does not look so good.( lines 70-75)

And the greenshot:


  1. It does not act like a zigbee repeater

  2. If you use it with the official Xiaomi app most probably you can get those statistics, but just as I was saying earlier the DHT for this plug doesn’t record energy used, therefore statistics are not possible. You can use the piston from above for that.

Hi All, Is it possible to set the default state after a power outage?
I mean to have it default ON when power came back or start with the last state (ON or OFF) which was active when outage happened.