Welcome to the Athom Community Forum! This is a place to share ideas, ask for help and discuss about Homey in general.

Please read Welcome to the forum to get started.
Official

[APP] Xiaomi Mi Home (supports Yeelight, Robot Vacuum etc.)

PhuturistPhuturist Member
edited July 12 in Apps

Control Xiaomi Mi Home Wi-Fi devices

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.

App Store Page: https://apps.athom.com/app/com.xiaomi-miio

Latest version - 2017-07-11 -- v2.1.2

This update requires you to re-pair the Yeelights, Air Purifier and Humidifier.

  • NEW: changed from miio protocol to direct API for Yeelights, now using auto discovery and hue and saturation are working
  • IMPROVEMENT: better field validation for tokens in pairing wizard for miIO devices
  • IMPROVEMENT: use polling mechanism to get the capabilities for Air Purifier and Humidifier
  • FIX: fixed issue with setting fanspeed for Air Purifier and humidifier
  • FIX: fixed app crashing due to error in processing Yeelight status
Tagged:
«134

Comments

  • TaxandriaTaxandria Member
    Wow cool. Any chance of connection to the these as well?

  • TedTolboomTedTolboom Moderator, Backer - Geek Edition, Homey Ambassador
    @Taxandria I'm not sure if the bridge of these sensors is accessible through the miIO library.

    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).
  • PhuturistPhuturist Member
    @Taxandria  @TedTolboom
    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.

  • AlanMccormickAlanMccormick Backer - Early Bird
    I can confirm the air purifier works, except for speed control. Issue raised in GitHub.
  • PhuturistPhuturist Member
    I can confirm the air purifier works, except for speed control. Issue raised in GitHub.
    Thanks for reporting. It's been fixed in master of the repository. Will publish a new beta release some time soon. Just waiting on a little more feedback.
  • AlanMccormickAlanMccormick Backer - Early Bird
    Fix confirmed!
  • I've tested it with a yeelight color, capturing the token does take some knowledge.

    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.




  • I've tested it with a yeelight color, capturing the token does take some knowledge.

    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.




    I hope to improve the pairing proces for Yeelights in a future update. Currently colors (hue and saturation) are not working yet in this beta version, this is mentioned in the README of the app. Yeelights dont allow to set these values individually and I still need to figure out how to convert RGB values to hue and saturation values.
  • casedacaseda Moderator
    edited June 14
    @Phuturist
    see the tinycolor2 node.js module :smile: 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?
  • caseda said:
    @Phuturist
    see the tinycolor2 node.js module :smile: 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?
    Yeah, had been looking into a similar color conversion library. Yeelights allow RGB or HSV, no individual hue or saturation. A RGB or HSV capability in the light class would have been a lot more easier but it's not that I dont know how to make this work but it's the lack of time.
  • casedacaseda Moderator
    yeah :sweat_smile: i know all about the time issues at the moment
  • JooleeJoolee Backer - Super Early Bird
    Phuturist said:
    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.

    If you need a set, I'ts collecting dust with me right now because I couldn't get the multicast API working reliably with Homey. I can drop it off if you live in the Randstad.
  • TedTolboomTedTolboom Moderator, Backer - Geek Edition, Homey Ambassador
    @joolee I expect to receive my Mi smart home set early next week. 1.4.0-alpha.2 has been released to Development-Preview and installed on my Homey...
    will start looking into a Mi Zigbee app once the set arrives...
  • Joolee said:
    Phuturist said:
    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.

    If you need a set, I'ts collecting dust with me right now because I couldn't get the multicast API working reliably with Homey. I can drop it off if you live in the Randstad.
    I appreciate the offer but I live in Groningen, so that's not gonna happen. Next to that, I'm seriously meeting the limits of my coding skills already. I doubt if I'll be capable to get it working.

    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.
  • AlanMccormickAlanMccormick Backer - Early Bird
    Air Purifier 2 confirmed fully working (inc sensor readings for temp, humidity and air quality).
  • Air Purifier 2 confirmed fully working (inc sensor readings for temp, humidity and air quality).
    Thanx for beta testing! I hope to release a new version to the app store within the week which include these fixes for the Air Puifier and Humidifier. It also contains a switch for Yeelights from the miio protocol to the direct api. This enables to use discovery upon pairing and being able to set hue and saturation. 
  • dENNtoetdENNtoet Member
    Hmm can't seem to get my Xiaomi Vacuum cleaner to work.. 

    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 :(

  • PhuturistPhuturist Member
    edited July 2
    I received a crash report with the error "invalid hex string" . Your steps are correct but I think you made a copy and paste error. Check again if you have a 32 character string. There is better field validation in the next release to prevent this from happening.

    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.
  • dENNtoetdENNtoet Member
    @phuturist Confirmed, the method above PARTIALLY works but it is not as simple as it is stated on GitHub. I don't think people who are not tech savvy can pull this off since the steps are much more complicated than that. 

    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:




  • bvdbosbvdbos Moderator, Backer - Geek Edition
    what do you see when you click on the triangle?
  • PhuturistPhuturist Member
    dENNtoet said:
    @phuturist Confirmed, the method above PARTIALLY works but it is not as simple as it is stated on GitHub. I don't think people who are not tech savvy can pull this off since the steps are much more complicated than that. 

    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:




    Yeah, this might be the end of the official support for the Xiaomi Vacuum Robot. I wonder if Xiaomi made this change on purpose to make controlling the cleaner through 3rd party software harder. It's a shame though.

    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.

  • dENNtoetdENNtoet Member
    edited July 2
    @bvdbos @Phuturist Call to device timed out.. Strange thing is, that now the vacuum won't start but I can find it.. Seems like you can only use 1 function at a time..  

    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. 
  • PhuturistPhuturist Member
    dENNtoet said:
    @bvdbos @Phuturist Call to device timed out.. Strange thing is, that now the vacuum won't start but I can find it.. Seems like you can only use 1 function?
    The device timing out can happen when a lot of commands are executed after each other because all capabilities (state /onoff) and flow cards are update real time with actual calls. Homey than sort of DDOS'es the vacuum cleaner to check every capabiity and flow condition or action. The alternative is polling the device but I did not think this was necassary, I figured most users would only create one or two flows to automate the cleaning. Polling would than be just using resources.

    If time outs happen often and irregular it may indicate a bad connection between Homey and the Vacuum Cleaner.
  • dENNtoetdENNtoet Member
    edited July 2
    I have 2 flows:

    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
  • PhuturistPhuturist Member
    dENNtoet said:
    I have 2 flows:

    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
    Strange, you are the first to report this behaviour. Perhaps it's related to the latest firmware. I assume you have a stable Wi-Fi network?
  • dENNtoetdENNtoet Member
    Yep very stable
  • hi  @Phuturist

     I am using a neo coolcam touch switch, but this  switch does not responce to homey when i turn on the light
    I know that has been discussed before, but when comes the solution.(software update)
    
    Kindly greet

  • PhuturistPhuturist Member
    hi  @Phuturist

     I am using a neo coolcam touch switch, but this  switch does not responce to homey when i turn on the light
    I know that has been discussed before, but when comes the solution.(software update)
    
    Kindly greet

    I think you have the wrong topic here. This is about Xiaomi products, not about Neo Coolcam products.
  • yep, sorry


    But I was in the right direction :# 
  • PhuturistPhuturist Member

    New version - 2017-07-05 -- v2.1.0

    This update requires you to re-pair the Yeelights, Air Purifier and Humidifier.
    • NEW: changed from miio protocol to direct API for Yeelights, now using auto discovery and hue and saturation are working
    • IMPROVEMENT: better field validation for tokens in pairing wizard for miIO devices
    • IMPROVEMENT: use polling mechanism to get the capabilities for Air Purifier and Humidifier
    • FIX: fixed issue with setting fanspeed for Air Purifier and humidifier
Sign In or Register to comment.