Xiaomi Smart Plug

So I purchased a couple of these:
https://www.ebay.com.au/itm/Original-Xiaomi-Mi-Smart-Socket-APP-Remote-Control-Timer-Power-Plug-White/
I can get it to work in my iPhone app - same app as I used for the Yeelights.

Tried to add this as an Xiaomi Plug and was re-directed to Xiaomi Gateway (Aqara) which in turn says I need to:
From here you will be able to retrieve the key (password) from within the app following this tutorial.
Unfortunately the tutorial does not seem to apply.

I’m thinking this is not the zigbee version? (It’s working fine in my mi home app)

1 Like

The Xiaomi zigbee after being paired with your app and the Gateway linked in Hass should appear automatically.

As I said, I don’t think it’s a Zigbee - I don’t have a gateway. It’s the WiFi version I believe.

You will need to follow this guide @DavidFW1960. You have the Xiaomi_miio (WiFi) plug, not the Xiaomi_aqara (Zigbee) version.

2 Likes

Thanks! Seems to be exactly what I was looking for… I’ll give it a try.

2 Likes

OK! Woot!

This worked. Pretty geeky and I had to follow my nose a bit but it worked! Thanks kanga_who!

I had to do some changes in my network and because of that my Plug was reset … so new token :frowning:

I followed all this steps (which actually i did some time ago when I started with this) and the token is no longer showing for any of my plugs. The tool is reporting no Token, the SQLite DB is not storing anything.

Anyone else having the same issue?

thanks!

1 Like

I nly did it last week and it was working. Mind you 0.62.0 has broken it. Should be back in 0.62.1 I think.

hmm, I’ll update but actually the issue is before even starting to configure on HASS.

It’s like if the tool no longer works as I can’t get the token for the device (nor any other).

thanks sir!!

You need to use older version of the mi home app. 5.0.29 I believe. I have it on my spare phone just for the token retrieval :slight_smile:

Latest iPhone app is 4.7.1 - Pretty sure token retrieval works in that but I’m going to confirm that.

Yeah, that made it.

I had another phone with the v5.0.19. Just tested it there and directly saw the token.
reading other forums looks like the latest update, the gateway is no longer looking at that in the database (so the field is empty) but is checking onver internet.

Not very fan of that :face_with_raised_eyebrow:

Confirmed. The current iOS app still shows the token as per the docs.

Thank you so much!
My tokens were empty on android app v5.1.5, couldn’t understand why.

For those struggling with the android version:

  • Download an old version of the .apk here

  • Install the app and configure your device

  • Using a file explorer, find the sqlite file at apps/com.xiaomi.smarthome/db/miio2.db or /data/data/com.xiaomi.smarthome/databases/miio2.db (root needed) and move it to your computer

  • Read the file with sqliteonline.com with the following command: SELECT name,token FROM devicerecord;

I’ve done every step for adding wi-fi smart plug and I only get this:
image

I have an EU version.
Any help?

I am just trying to do also.

I have

  • Xiaomi app running v5.8.7 with aqara 2 hub firmware 1.4.1_176.0220 with 29 devices connected.
  • I have 4 new wifi switches which haven’t been connected yet.
  • Installed the apk which installs as version v5.0.18 from @bokub on another phone.
  • After sign in to china location from my existing setup only my temp sensors show up none of my other sensor types or mi hub.
  • I have put wifi switch into pairing mode and tried to add to the mi app v5.0.18 using the scan function with bluetooth and location enabled but nothing is found.

At a guess I would say the aqara hub which is using the latest firmware is not backwards compatible with the older version of the app.

I think I am just going to bin the plugs, my trouble than they are worth.

I am having difficulty getting this working. I got further than I ever have before too…!!! :frowning: :frowning:

I have successfully run
“python3 token_extractor.py”
and obtained the following:

NAME: 5
ID: 65980239
IP: 192.168.0.119
TOKEN: 064a19d271f114ff5ef23dc2096ZZZZZZ (edited)
MODEL: chuangmi.plug.m1

Then I went into integrations and add an integration.
I’ve added xiaomi_miio and when I type the IP and token it adds it (I even tested, by changing the token delieberately incorrect and it fails)

So once I’ve successfully added the the miio integration it forces me to add it as a gateway (??) not a switch? This makes no sense to me.

So home assistant sees the IP sees the token, recognises both but it doesn’t show a ‘switch entity’
What am I doing wrong?

I can even turn the switch on and off in the Xiaomi Mi Home app (Which I hate having installed, but I digress)
What do Ineed to change?

Oh and the part# is ZNCZ02CM
I also have the aquara gateway, I’m wondering if the 2 are conflicting with one and other?
Has anyone got this wifi only plug working? OP?

“2021-02-06 08:36:13 ERROR (SyncWorker_0) [homeassistant.util.yaml.loader] while scanning for the next token
found character ‘\t’ that cannot start any token
in “/config/configuration.yaml”, line 23, column 1
2021-02-06 08:36:13 ERROR (MainThread) [homeassistant.bootstrap] Failed to parse configuration.yaml: while scanning for the next token
found character ‘\t’ that cannot start any token
in “/config/configuration.yaml”, line 23, column 1. Activating safe mode”

I don’t understand, I followed these instructions.

Right near the bottom of the page.

CONFIGURATION

To add a plug to your installation, add the following to your configuration.yaml file:

# Example configuration.yaml entries
switch:
  - platform: xiaomi_miio
    host: MIIO_IP_ADDRESS
    token: YOUR_TOKEN

? I followed that verbatim

UPDATE to help others
That fault is due to using a TAB not spaces in the YAML file.
However, my switch still isn’t working, even though it reboots with no errors.
Any idea how to add switch

What does the log show?