The Homey Community has been moved to https://community.athom.com.
This forum is now read-only for archive purposes.
[APP] Xiaomi Mi Home (supports Yeelights and Mi Home WiFi devices)
Control Xiaomi Mi Home Wi-Fi devices and Yeelights
Use Homey to control Xiaomi Mi Home devices (the Mi Home Ecosystem is also branded as MiJia). Currently Xiaomi does not officialy support controlling most of it's devices from outside the Mi Home app with the exception of Yeelights. Yeelights can be added to Homey quite easy but for all other devices additional steps are needed that require technical skills setting up. These steps are described in the readme in the app store but Xiaomi can make changes to it's eco system at any time resulting in devices that can not be added or controlled by Homey anymore.
This app uses an unofficial library called the miIO Device Library for communication with those devices whoch lack official support for controlling externally, credits go out to the author of this library. This Homey app also only adds support for the devices that can be controlled directly through Wi-Fi, there is a whole range of Mi Home sensors that can only be used together with the Xiaomi Smart Home Gateway (which uses ZigBee) but this is currently out the scope of this app.
Adding miIO devices
For Homey to be able to communicate with devices over the miIO protocol a unique device token needs to be obtained. Technical knowledge is needed for retrieving these tokens. If your are not to tech-savvy using this app for any other devices than the Yeelights might be challenging. See the instructions here on retrieving device tokens.
App Store Page: https://apps.athom.com/app/com.xiaomi-miioLatest version - 2018-07-24 -- v2.8.0
- NEW: support for Yeelight White Tunable (V2) and Yeelight Color V2
- NEW: add action card for Xiaomi Mi Robot to send the robot to a specific target (see instructions)
- NEW: add action card for Xiaomi Mi Robot to do a zone(s) cleanup (see instructions)
- FIX: fix temperature range for Yeelight color bulbs
Comments
I've ordered one set and will have a look once Homey 1.4 enables Zigbee if it is possible to create a driver to communicate directly with these sensors (without the need of a bridge).
The Xiaomi Mi Smart Home Kit is supported over Wi-Fi through the miio protocol through the gateway but support has not been built into this app (yet). It gets somewhat complex as you need to register a device (the gateway) to control other devices (the sensors). These kind of dependencies are not supported by default within Homey. With only one gateway you could perhaps register it in the settings of the app but once you have multiple gateways it gets really complex.
Anyway, a much more elegant solution would be to support the sensors directly over Zigbee without the gateway as Ted already mentioned. Zigbee should become available with firmware 1.4. Athom has no plans to look into this integration so we do depend on the community to look into this. I dont own the Mi Home Smart Kit myself and will not have it any time soon. But I'm sure that if there are any possibilities that Ted will look into it, either through Zigbee directly or by using the miio protocol.
My focus for this app will first be to improve the Yeelights support. It's still a bit messy and can be improved a lot.
First check wich ip adres you get when you connect to the yeelight wi-fi, it isn't always 192.168.8.1 (in my case it was 192.168.13.1).
When i add the yeelight in the App it's not clear wich bulb is the color one. (both can be used, i checked)
Looking up your ip adres in your router (takes some knowledge), you then also have to make a reserveration so that the local ip adres keeps the same.
Problem is that i cant seem to get color working.
see the tinycolor2 node.js module you can do a lot of color convertions,
though homey already uses hue (0.00 - 1.00) and saturation (0.00 - 1.00), not RGB?
will start looking into a Mi Zigbee app once the set arrives...
I'm currently working on auto discovery of yeelights. The yeelights offer an open api next to the miio protocol. Got auto discovery working but I'm stuck with maintaining an open socket for communication. I really wish I was better at coding.
What I've done:
1. Downloaded Packet Sender on my laptop.
2. Reset WIFI (pressing both home and power button for 3 seconds)
3. Connect my laptop to the vacuum cleaner wifi
4. Pinged the 192.168.8.1 address (got a reply)
5. Filled in the packet sender information
6. Send the packet
7. Got response, only copied/paste the last 16 bytes (32 characters) to notepad
8. Disconnect laptop from vacuum cleaner wifi
9. Reconfigured the vacuum with the Mi Home app on phone.
10. Browsed the network settings to find the current ip address
11. In Homey wanted to add the new device with that ip address and the 16 bytes fstep 7.
12. When I want to test the connection I get a red cross after about 5 seconds..
What am I doing wrong ?
I also read somewhere that with the latest firmware for the robot the token is reset once you set to the robot. That means this method would not work anymore. I have not received this latest firmware yet so I can't check. What firmware are you on (I'm on 3061)?
[EDIT] Just read your message on slack, looks like you are indeed on the new firmware and this method for obtaining the token does not work anymore because the token is reset during the setup process. In the link below is a method which describes another way but I have not been able to test it.
Apple: https://github.com/aholstenson/miio/issues/40#issuecomment-309224708
Android: https://github.com/aholstenson/miio/issues/40#issuecomment-312447643
Both methods are even more complex then the current method. Not sure if it's suitable for the app store like this. I think I could make the Android process easier but you would have to be rooted. I'll look into it once I receive this latest firmware myself.
I added the vacuum cleaner now with the token. But starting the vacuum cleaner is the only thing that works, if I want to stop/pause/find the vacuum cleaner I get a red triangle next to the action:
I have a rooted Android phone and the steps to obtain the token on rooted Android are actually easier than the currently described method but for the regular John Doe this is getting to complicated.
Like @bvdbos says, what does the traingle says. I still have not received the latest firmware so I cant check myself.
So it seems that when the robot is cleaning it is using that function and you can't use another one for X time or when it is done cleaning.
If time outs happen often and irregular it may indicate a bad connection between Homey and the Vacuum Cleaner.
1. Start
2. Stop
When I start the device and wait like 1 minute and I try to stop it, I get the time out.. So it's not like i'm flooding the device with start/stop commands
New version - 2017-07-05 -- v2.1.0