viestursr / homebridge-xiaomi-yeelight

MIT License
4 stars 3 forks source link

💡 homebridge-xiaomi-yeelight 💡

Version License: MIT

Xiaomi branded Yeelight support for Homebridge: https://github.com/nfarina/homebridge.

There are several plugins for Yeelights already, for example https://github.com/cellcortex/homebridge-yeelighter. If you have a Yeelight branded Yeelight that still supports LAN control, my plugin isn't for you.

This plugin focuses on Xiaomi branded Yeelights that were stripped of the ability to control them via LAN, rendering the above and similar plugins useless for their control. I got very frustrated by that, considering that these lamps are almost identical to Yeelight lamps. This, combined with the fact that my Xiaomi Yeelight lamps are extremely unreliable in Homekit, motivated me to create my first plugin for Homebridge to alleviate these issues.

I'm happy to report that for me this plugin is incomparably more reliable than their own HomeKit integration. The lights have not gone into a "Not Responding" state since, while previously they went into such state several times per day.

Caveats

Installation

You might want to update npm through: $ sudo npm -g i npm@latest

Install this plugin through: $ sudo npm -g i homebridge-xiaomi-yeelight

Add this plugin to your HomeBridge platform list, see Configuration section.

Configuration

"platforms": [
  {
    "name": "XiaomiYeelightSupport",
    "debugLogging": false,
    "platform": "XiaomiYeelightSupport"
  }
]

The plugin supports setting the configuration through homebridge-config-ui-x. You'll be able to configure the device details there, or you can add them as a parameter in the JSON config:

"lights": [
    {
        "ipAddress": "192.168.0.100", // local ip address of the light
        "token": "<secret token>", // light encryption token, see Token section for more info
        "name": "Dresser Light" // friendly name for the light
    },
    {
        ...
    }
],

Setting up the lights

Since Xiaomi/Yeelight has removed the option to control Xiaomi branded Yeelights via LAN, this process is more convoluted than it should be.

First of all, you have to obtain the encryption token of the light after adding it to one of the control applications (Xiaomi Home or Yeelight). To do so is left as an excercise to the user. Personally I used an Android phone to set up the lights in the Yeelight app, then I downloaded app backup over ADB and extracted the token using Miio CLI from the backup. There are many possible approaches described to extract the token, choose one that fits you best.

⚠️ After setting up the lights, I would suggest considering blocking their access to the Internet. I wouldn't want my lamps to be forced some OTA update that restricts them even further to Xiaomi's own home management app.

🤝 Contributing

Contributions, issues and feature requests are welcome!

Show your support

Give a ⭐️ if this project helped you!