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:
- Obtain and install old MI Home app via .apk on Android or Bluestacks (I always use version 5.4.54)
- Login with Xiaomi account
- Reset bulb by turning on/off 5 times
- Give Location permission to MI Home app
- Scan for new devices in app
- Connect to bulb & add it to the WiFi network
- Ignore the fact that it ends with “Connection error, check network and retry” and click on Back button, Stop adding device, OK
- Go back from Add Device
- Pull down to refresh main device screen, you will see the bulb added and marked New
- 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
- 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
- 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”
- Reserve the bulb’s DHCP IP in your router UI so that it will always receive the same IP
- Download and install the latest Python release for Windows from Python Releases for Windows | Python.org
- Download and install “Build Tools for Visual Studio 2019” from Download Visual Studio 2019 for Windows & Mac
- You will need to restart the PC after you install the Build Tools
- Open Command Prompt and run “pip3 install python-miio”
- Run in Command Prompt "miiocli yeelight --ip YOURBULBIP --token YOURBULBTOKEN set_developer_mode 1
- Make sure the output finishes with “Setting developer mode to True - [‘ok’]”
- Add Yeelight integration to HA & put your bulb’s IP address in there
- Enjoy!
P.S. As mentioned in the alert at Alerts – Home Assistant, 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.