Integrate MI Smart LED Bulb (Warm White) XMBGDP01YLK

Hi there,

Since I didn’t see any guide which outlined every single step I needed to take in order to get these bulbs in HA, I thought I’d compile them here:

  1. Add bulb to Mi Home app
  2. Reserve the bulb’s DHCP IP in your router UI so that it will always receive the same IP
  3. Get the bulb’s token via the handy tool: GitHub - Maxmudjon/Get_MiHome_devices_token: Get Mi Home devices token Windows/MacOS app.
  4. Download and install Python 3.9.13 (it must be Python 3.9!) and make sure you select “Add to PATH” when installing it
  5. Download and install “Build Tools for Visual Studio 2019” (it must be for Visual Studio 2019!)
  6. You will need to restart the PC after you install the Build Tools
  7. Open Command Prompt and run “pip3 install python-miio”
  8. Run in Command Prompt "miiocli yeelight --ip YOURBULBIP --token YOURBULBTOKEN set_developer_mode 1
  9. Make sure the output finishes with “Setting developer mode to True - [‘ok’]”
  10. Add Yeelight integration to HA & put your bulb’s IP address in there
  11. Enjoy!

P.S. As mentioned in the alert at Alerts | Home Assistant Alerts, Xiaomi seems to be step by step locking down their ecosystem, so it would probably be wise after going thru these steps to also go to your router and block the bulb’s IP from the Internet. While this will make it go offline in the MI app, in HA it should work fine forever without the fear of a firmware upgrade that will make it operable from the MI app only.

P.S. 2: If Step 3 to get the token no longer works for some reason, here’s the classic way to get it:

  1. Obtain and install old MI Home app via .apk on Android or Bluestacks (I always use version 5.4.54)
  2. Login with Xiaomi account
  3. Reset bulb by turning on/off 5 times
  4. Give Location permission to MI Home app
  5. Scan for new devices in app
  6. Connect to bulb & add it to the WiFi network
  7. Ignore the fact that it ends with “Connection error, check network and retry” and click on Back button, Stop adding device, OK
  8. Go back from Add Device
  9. Pull down to refresh main device screen, you will see the bulb added and marked New
  10. If you don’t have an on/off button on the device’s image, just long-press to rename the device (which you should anyway), save the new name, exit the MI Home app and enter it again after a few seconds, the switch button should appear
  11. Use a proper Android file manager like Total Commander to go to /storage/emulated/0/SmartHome/logs/plug_DeviceManager & send the file there named TODAY’SDATE.txt to somewhere more easily searchable/editable like a PC via e-mail
  12. Open the file and search for the bulb’s name that you created in Step 10 - the token is in the text right behind it, like: “token”:“YOURTOKENID”,“longitude”:“0.00000000”,“latitude”:“0.00000000”,“name”:“Master Bedroom Window Light”

Bless your heart kind sir! My very first integration in HA with the MI bulbs and couldn’t have done it without your guide. Thank you!!!


Glad you found it useful :slight_smile:

To be honest, I had no idea what I was getting myself into when I bought these bulbs, as my 2 (theoretically similar) Yeelight lamps just needed a couple of clicks in the Yeelight app in order to enable Developer Mode.

I’ll amend the guide to also mention blocking the bulbs from the Internet, as the problem mentioned here might pop up: Alerts – Home Assistant

1 Like

Hello John,

Thank you for the tutorial. Very detailed.

I am having some trouble with the step 18. When I run the command it returns the following message:

miiocli : The term ‘miiocli’ is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1

  • miiocli yeelight --ip --token 29xxxxxxxxxxxxxff175bcd …
  •   + CategoryInfo          : ObjectNotFound: (miiocli:String) [], CommandNotFoundException
      + FullyQualifiedErrorId : CommandNotFoundException 

Doy you have any clue of what is going wrong?

Thank you!


Hmm, it looks like step 17 didn’t work for you, can you try it again and let us know what the output was? Maybe that’s why it can’t find the command.

This thread helped me a lot - just a note: to get the xiaomi token, I’ve found this very usefull: GitHub - Maxmudjon/Get_MiHome_devices_token: Get Mi Home devices token Windows/MacOS app.

Hello !

Thanks for the tutorial,
I’ve got the same issues than Deutadado, Step 17 didn’t work. I’ve got lots of errors:
I think this is the most relevant:
error: Microsoft Visual C++ 14.0 or greater is required. Get it with “Microsoft C++ Build Tools”: Microsoft C++ Build Tools - Visual Studio

Install build Tools didn’t add something to path, maybe it comes from it?


OK I install build tools badly, it works very well, thank you!

1 Like

I have some experience 12 hours of trying to instal this bloody ‘‘pip3 install python-miio’’.
For those who don’t know what are doing like me :smiley: easest way on windows is with Anaconda Prompt and Visual++ it takes 5min.

I completed all of the steps but when I try to add HA yeelight integration, It says “Failed to connect”. I dont know what should I do now

Hi, I now its an old post but maybe someone can share the Mi Home 5.4.54, I cant find that exact version, the closer was the 5.4.56 but it wont give me the plug_DeviceManager

Thanks for the help

Try this one: Mi Home 5.4.54 APK Download by Xiaomi Inc. | Android APK (

Thanks @johnflorin , I was really disappointed when my wife gave me this bulb and at first thougt this couldnt be added to HA, so this post was a miracle for me.
I follow your instructiones but finally I used the linked shared before to obtain the token. Also I used the anaconda installation mention by @bratick

Just for help someone new trying to add this bulb, this is what I did. Its not perfect but its what works for me, because I struggle a bit installing the required software

  1. Add the bulb to the MI HOME app (updated play store version)
  2. Use this app to obtain the token
  3. Install build tools
  4. Install Anaconda Prompt and Visual++ (Thanks @bratick)
  5. Check the IP of the bulb on the MI HOME app and then reserve the IP on router
  6. Open anaconda prompt as admin and run “pip3 install python-miio”
  7. In anaconda promt run the command miiocli yeelight --ip YOURBULBIP --token YOURBULBTOKEN set_developer_mode 1
  8. Make sure the output finishes with “Setting developer mode to True - [‘ok’]”
  9. Add Yeelight integration to HA & put your bulb’s IP address in there
1 Like


ça marche

Right, one of my bulbs got knocked off the network after being without power for a few days (guess its memory has a pretty small lifespan if left without power), so I updated the guide with more recent info like the token tool.

I also found out this way that the reason everyone was getting errors with Python years later was because the python-miio tool is specifically made for Python 3.9 & Visual Studio Tools 2019 and using newer versions will make its install fail!

I have no idea how to use Anaconda, so just followed the classic guide after checking what Python version was latest in 2021 when it was first published.