I recently write a Yeelight plugin for homebridge, so iOS users can use Home App or Siri to control Yeelight WiFi devices directly, you can try it and provide any feedback or bug report here.
BTW, I’m new to Javascript and NodeJS, so some code may look clumsy, but it works You are very welcome to polish it or re-write it once you got the idea how it works.
Download Yeelight plugin https://github.com/vvpossible/homebridge_plugin. “config.json” is to tell HomeBridge how to present your devices to iOS while the folder “yeelight” contains all the code.
The quickest way is to put them under $HOME/.homebridge (only tested on my Linux machine, windows or mac use has to study it yourself ). You may also found other methods to deploy it or you can even publish the plugin to NPM.
Start Homebridge by command “homebridge -P ~/.homebridge/yeelight/”.
Open the Home App and enjoy.
yeelight/index.js --> main plugin file for HomeBridge, implement required plugin interface and interact with Yeelight device adapter yeelight/node_modules/yee.js --> Yeelight device adapter, handle device discover, device management, socket connection and command sending/receiving. yeelight/node_modules/test.js --> some test script for yee.js
Deploy it on your openwrt router or on a long-run machine in your home, then you can enjoy it anytime.
I already publish the latest plugin to NPM, could you try to use “npm install -g homebridge-yeelight” and see if you still got the error? I tested locally and didn’t see any issue …
Already published the plugin to NPM, you can install the plugin and then it should be automatically activated when your homebridge started. If not, you may want to configure ~/.homebridge/config.json and add Yeelight platform there to explicitly ask homebridge to load Yeelight plugin.
You can find yee.js and replace all the “() =>” with “function()”. And then it should be good. I think this new syntax is not supported by your js interpreter yet.
First, i can use home.app or siri to control yeelight bulb. Thanks.
But here’s the bug i found.
e.g. when i turn on the bulb in mijia.app or yeelight.app, then go back to Home.app, the icon of yeelight bulb in home.app is still turned off.(In fact, the yeelight bulb is turned on.)
So the icon of yeelight bulb in home.app can not show me the correct state。
Thanks for your feedback! Regarding the state sync, the 3rd party API of Yeelight do keep that in mind during design, however, I quickly studied hombridge and didn’t find any API that can be used to report the state change to Home App. I believe homekit protocol must have included that, so will do a deeper investigation later.
Thanks for your reply. I’m looking forward to your update for the state sync.
There’s another plugin named homebridge-aqara which is also Cooperating with Xiaomi, and it works good with the state sync.