I’m a big fan of Xiaomi products… Recently I bought the Xiaomi Robot vacuum.
This vacuum can be controlled via openhab. .
NB. As of 5 December 2018 the binding is no longer available on the Eclipse market place as it is merged and available as regular binding.
If you have not upgraded to 2.4 M8, the way to install the binding
To enable it now, either upgrade to the snapshot release or execute in the shell
bundle:list to find the bundle nr.
bundle:start nr where Mr is the number of the bundle… Probably the last/highest number
To have a working binding, a little difficult step needs to be done to retrieve the vacuum token.
You could read the Token from the Mi-Home app. This can be eased with the help of the MiToolKit
In short you have to:
- Connect the Mi-Home App with the Robot
- Change Wlan an Settings
- Enable Developer Options in Android
- Download the MiToolKit
- Connect your Phone to your PC and start the MiToolKit
- Read the new Token with the MiToolKit
Alternatively, e.g. if you have root access to your phone you can read the token from the mio2.db database file using a sqlite reader.
Note: latest Android MiHome no longer has the tokens in the database. Use 5.0.19 version, see link in the post earlier
You must delete the app data when downgrading to 5.0.19 from a higher version, otherwise the token will still not be visible! (… and you will be wasting hours installing different versions as I did )
The binding is still very much in development, but I think already quite usable. Main functionality, like getting the status, switching it on & off etc are working.
Sending custom commands
To send custom commands, enable the cmd channel in paperUI (using the ‘show more’ in the channel list as it is a channel marked as advanced) and link a String item to the channel.
You can than send the command to the created string item. It will send the command to the Xiaomi device and update the channel with the response.
Example item files and channels for each device are now in the readme file
- Allow updates on the dnd timings
- Show last few history items
Note, unfortunately the maps that are displayed in the app are not directly coming from the vacuum, instead they are coming from the Xiaomi cloud. Much more discovery is needed to find out exactly how to connect to the Xiaomi cloud and get this details.
note that direct cleaning map display is possible using dustcloud with hacked firmware
9 July - preserve id when connection failed
17 July Update with various fixes and improvements
- Increase timeouts to avoid offline for devices with slow response
- Change consumables logic to remaining instead of used time
- Reuse port for connectivity
- Cleanup channels, e.g. message version channel
- Update Readme wrt iphone token
- Simplify the channels. Single command channel
21 July Add fan control, fix bugs
- Fix wrong total cleaning time, change format total cleaning time to minutes
- Allowed control of vacuum fan level
31 July More logging wrt connectivity
- Set online if at least 1 message works
- Add the network parameters (e.g. signal strenght)
- Add the firmware version
- Allow for other MiIo devices to be added (manually) and send commands to.
14 Aug Renamed binding
- Renamed the binding to miio binding to reflect the possibility to control many other Xiaomi Wifi devices. This means manual item files need to be updated to use it. (updated file in 2nd post)
- Many small improvements to the connectivity, starting sequence etc
- Refresh after sending each command (issue from @elias_gabrielsson)
- The discovery sequnce has changed. Your device is discovered as a xiaomi generic device. Once the tolken is there and communication is successful, the type is changed to the vacuum and the vacuum related channels become available. For other Xiaomi devices, it will either change to the appropriate type (basic) or change to unsupported.
11 Sept. Improve discovery speed & 2nd method
- Added new way of discovering
- Reworked the existing discovery with faster responses
- Changed the communication from synchronous to async
- Command queuing, ensuring all commands are executed
- Improved online/offline detection. Note, if your device can be pinged, but does not accept commands it assumes a token issue and goes to offline with configuration error.
- Support for IOS encrypted tokens
- 2nd discovery method (using mDNS), which may support discovery passing subnet boundary
- Check for checksum errors
- Added Xiaomi Philips Led Bulb support
5 Oct 2017:
- Added support for several air purifiers, control favorite level on air purifiers
15 Oct 2017
- Added channels for last cleaning details
- Allowed to send on & off to the vacuum to start & stop vacuum to allow to used with Alexa voice control
- configurable timeout in case of poor connection
22 Oct Release
- Vacuum - new switch channel for on/off to allow alexa integration @Multisaft7
note this new channel (actions#vacuum) is marked advanced, hence hidden in paperUI by default.
Note, this will start vacuum when switched on, goes to dock on switching off. For status updates, it will also switch to on when doing spot cleaning
Note: I removed the on/off values from the command channel again, as there is now a proper switch channel
- vacuum - reset consumables channel. This new channel allows you to reset your consumables (e.g. the sensor usage time)
- airpurifiers - fix temperature reading (/10) @BOFH90 @shorty707 @akhilmagotra
23 December release
- Updated yeelight database
- Change type from string to number for several properties of Philips bulb & yeelight @OliM
- Add new Robot vacuum 2 support
- Updated to 2.3 snapshot
- Fix discovery
- Fix several code warnings
- Update documentation (a bit…)
- Change log level to avoid flooding log
- Colors for yeelight color bulb(untested, experimental)
- removes NPE is specific cases during change of type
- Removing unavailable properties from plug m1
- Several cleanups to prepare for including it in the regular builds
24-03 Small update to the binding
- Added AirPurifier 2S detected as zhimi.airpurifier.ma2 to the database
- Added Philips Eyecare 2 & improve Yeelight 650 (thanks to @dimalo)
25-08 Small update to the binding
- Added Xiaomi Mi Smart Pedestal Fan (zhimi.fan.sa1)
05-12 Binding is merged into the regular branche
- Yeelights dimming will not trigger on/off. It purely reports what the device is returning as value.
To update to the latest version uninstall the market binding, than install again.
to know the installed version, use
bundle:list | grep Xiaomi in the openhab commandline
If you have issues, please include your firmware version (can be seen in mihome app) and the log. Depending on the issue this may be the debug or the trace log.
log:set debug org.openhab.binding.miio log:display org.openhab.binding.miio
If the binding works for you let us know as well
Note: for discussion around Air purifiers check topic : Xiaomi Mi Air Purifier (Xiaomi Mi IO)