Mi Connector (Xiaomi and Yeelight)

Thanks Shadowmx. Ive since set it up on homebridge with individual room control so will reverse engineer with virtual devices in ST/Webcore to get it all running

I recently asked @fison67 about adding the ability to vacuum specific rooms via coordinates. He said that he would work on adding it.

Hello @fison67 I am trying to add my Air purifiers but I am getting some errors:

I was wondering if this particular model isn’t supported by the device handler?

What else could be wrong ?

Hey, I am getting the same Error, did you find a solution?

Hi, I am having issues connecting my air purifier too.
This is the model zhimi.airpurifier.mc1.
It would not find my device automatically so I found the token using this method:
How to get Xiaomi Token for any device

Now, this is the error I see when I add it manually:

noob question:

How I can install Mi Connector on a Home Assistant hassio environment? (I just installed one on a raspi but didnt figure it yet how it works)

When I click search devices, it does find both my Xiaomi Air Purifier 2H. But I can’t add them as they are red and does not provide token…

Is this also what you are seeing?

Anyone knows a solution to this issue ?

I managed to solve the problem by manually adding device.
I used this guide: https://github.com/Maxmudjon/com.xiaomi-miio/blob/master/docs/obtain_token.md to get the token. " Extract token from log file"
I installed the old version of the Mi Home app on nox player and found the token in the logfile.

After manually adding device ip/token they were correctly recognized and added to smartthings


Thank you so much for updating us on the solution I tried this way and it worked for me too.


Can i use a Home Assistant instalation (HasOs) on Rpi as “man in the middle” for this to work?

Hey Fison! first of all thank you !

I set mi connector on pi4 , and I have weird problem:

I have some Xiaomi Philips Ceiling lights -I can control them from st but I cant see the right status, same thing with the Xiaomi Philips Downlight.

Btw In contrast to this lights I can see the right status for the Xiaomi Air Purifier & Xiaomi Vacuum so I don’t know why with this lights I cant see the right status.

Thank you again

Hey Fison, hope you are doing fine,
first of all, thank you for your great work.

However i may seek your assistant here please.
FYI, i am using lumi.gateway.v3 to integrate all my xiaomi sensors (motion, door, zigbee socket) on raspb pi-3. Upon installation everything works fine

d321de6b24f0 fison67/mi-connector-arm:latest “/usr/bin/entry.sh /…” 2 hours ago Up 8 seconds mi-connector-arm
ec68e41877ec jsurf/rpi-mariadb “docker-entrypoint.s…” 2 hours ago Up 16 seconds>3306/tcp mariadb

My smarthings can received all the registered device (from mi-connector page)

Unfortunately it looks like only one way communications. I cannot control them at all (i.e. turn on/off etc) Can see the devices appeared in my smartthings app in mobile

Any idea or suggestion why is this happening? I saw there are no DB activity at all upon checking on the json logs (eventhough it is connected)

DB logs:
{“log”:“200626 12:59:37 [Note] InnoDB: Completed initialization of buffer pool\n”,“stream”:“stderr”,“time”:“2020-06-26T04:59:37.642356674Z”}
{“log”:“200626 12:59:37 [Note] InnoDB: Highest supported file format is Barracuda.\n”,“stream”:“stderr”,“time”:“2020-06-26T04:59:37.67089511Z”}
{“log”:“200626 12:59:37 [Note] InnoDB: 128 rollback segment(s) are active.\n”,“stream”:“stderr”,“time”:“2020-06-26T04:59:37.729060567Z”}
{“log”:“200626 12:59:37 [Note] InnoDB: Waiting for purge to start\n”,“stream”:“stderr”,“time”:“2020-06-26T04:59:37.73032837Z”}
{“log”:“200626 12:59:37 [Note] InnoDB: Percona XtraDB (http://www.percona.com) 5.6.42-84.2 started; log sequence number 1783199\n”,“stream”:“stderr”,“time”:“2020-06-26T04:59:37.780764613Z”}
{“log”:“200626 12:59:37 [Note] Plugin ‘FEEDBACK’ is disabled.\n”,“stream”:“stderr”,“time”:“2020-06-26T04:59:37.781629971Z”}
{“log”:“200626 12:59:37 [Note] Server socket created on IP: ‘::’.\n”,“stream”:“stderr”,“time”:“2020-06-26T04:59:37.7848175Z”}
{“log”:“200626 12:59:37 [Warning] ‘proxies_priv’ entry ‘@% root@ec68e41877ec’ ignored in --skip-name-resolve mode.\n”,“stream”:“stderr”,“time”:“2020-06-26T04:59:37.788689503Z”}
{“log”:“200626 12:59:37 [Note] mysqld: ready for connections.\n”,“stream”:“stderr”,“time”:“2020-06-26T04:59:37.803928713Z”}
{“log”:“Version: ‘10.0.38-MariaDB-0+deb8u1’ socket: ‘/var/run/mysqld/mysqld.sock’ port: 3306 (Raspbian)\n”,“stream”:“stderr”,“time”:“2020-06-26T04:59:37.804050431Z”}

Mi-Connector Log:
{“log”:“2020-06-26 05:27:41 info: Notify \u003e\u003e ID(80986777):type(lumi.gateway.v3) state={“key”:“illuminance”,“value”:1119} \u003e\u003e [1119]\n”,“stream”:“stdout”,“time”:“2020-06-26T05:27:41.858068083Z”}
{“log”:“2020-06-26 05:28:41 info: Notify \u003e\u003e ID(80986777):type(lumi.gateway.v3) state={“key”:“illuminance”,“value”:1143} \u003e\u003e [1143]\n”,“stream”:“stdout”,“time”:“2020-06-26T05:28:41.86921791Z”}
{“log”:“2020-06-26 05:29:41 info: Notify \u003e\u003e ID(80986777):type(lumi.gateway.v3) state={“key”:“illuminance”,“value”:1131} \u003e\u003e [1131]\n”,“stream”:“stdout”,“time”:“2020-06-26T05:29:41.880723226Z”}
{“log”:“2020-06-26 05:30:11 info: Notify \u003e\u003e ID(80986777):type(lumi.gateway.v3) state={“key”:“illuminance”,“value”:1110} \u003e\u003e [1110]\n”,“stream”:“stdout”,“time”:“2020-06-26T05:30:11.901566016Z”}

In my smarthings IDE logs can see it too
1:30:06 PM: debug getChildDevices(false), children=11
1:29:56 PM: debug getChildDevices(false), children=11
1:29:46 PM: debug getChildDevices(false), children=11
1:29:42 PM: debug illuminance : 1131
1:29:36 PM: debug getChildDevices(false), children=11
1:29:26 PM: debug getChildDevices(false), children=11
1:29:16 PM: debug getChildDevices(false), children=11

FYI: My hardware type of Mi Gateway is
lumi.gateway.v3 1.4.1_176 MW300 0220

I have followed your procedure accordingly n now i have no idea to make it work :frowning:

Thanks for your help and great support
Kind Regards

hello @Z-BRA

looks like i got same problem like you. Maybe you need to key in password1234 (remember on during installation what value did u entered) as it is saying being denied in mi-connector settings page.
Make sure DB and mi-connector docker are running (status UP)
su docker ps -a
pi@raspberrypi:~$ sudo docker ps -a
d321de6b24f0 fison67/mi-connector-arm:latest “/usr/bin/entry.sh /…” 2 hours ago Up 8 seconds mi-connector-arm
ec68e41877ec jsurf/rpi-mariadb “docker-entrypoint.s…” 2 hours ago Up 16 seconds>3306/tcp mariadb

if not, give a stop and start (always app stop, db stop, db start, app start in sequence)
sudo docker stop containerid
sudo docker start containerid


1 Like

Hi. I have now been using this bridge server for my two Air Purifier 2H for a few weeks now. Unfortunately I am not having the greatest experience and I would like to do something about that. Unfortunately I know too little about writing device handlers (yet) but I sense that the current ones are not being maintained super frequently anymore, so I figure I might give it a try now. If someone can help and point me in the right direction would be great.

I am using this device handler (xiaomi-air-purifier.groovy) for this Xiaomi Air Purifier 2H - I think the device handler was written before this product existed in the air purifier product line, I believe it is quite recently released. So maybe it could be updated to work properly?

I’m experiencing the following issues that I would like to tackle:

1. The tile is not ideal. The icon is a “thing” icon, I would like it to be the air purifier icon. The information below the device name is also not ideal the power button will already indicate on/off status. I would like it to display something like temperature, humidity, air quality (preferably). Or even if possible a mix of information.

2. The fan speed slider does not work. This is perhaps the biggest problem, I think this is also the reason why automation doesn’t work. If I press on max speed, it jumps back to zero. Also on init is always displays something like 33% speed, regardless of what the speed is in the Mi Home app.

3 Select mode. This would be super handy, also if could become available for automation, I don’t know if that would even be possible, but at least being able to toggle it from the smartthings app would be amazing.

SmartThings app ---------------------------- Mi Home app

4. I would like to add this particular model to the list. I’m not sure if this is really necersarry, because when I look through the device handler code, to me it just looks like changing model only impact a tile image.png, which I believe is not even being used in the new app. But in case selecting model actually impacts which information and actions is rendered in the UI then I would like to add MiAirPurifier2H to the list, to be able to configure a proper dashbaord for that model.

5. Improve dashboard

  • I believe my model cannot meassure PM 10 dust level but only PM 2.5, I would like to remove the dust meter as it is obsolete.
  • I would like to replicate the filter information from the Mi Home app "Filter remaning 79%, estimated lifespan 112 days
  • Doesn’t look like temperature is being correctly reported, would like to fix this bug
  • Whats is dimmer? There is only a small indication LED that is not dimmable on the device, I would like to remove this section.

SmartThings app ---------------------------- Mi Home app

I do not have an idea of how many of my wishes are even possible as I do not yet know smartthings UI api and very little about how device handlers work in details. But If anyone around here sees something on my list and thinks “hey! I know how you can fix this” then please come forward and point me to the documentation (or preferably guide) that I need to read or explain me what I need to do, eventually I might fix at least some of the problems (hopefully) which could benefit every one who owns this otherwise lovely air purifier

Been trying to set this up with a Raspberry pi 3b+ and a Mi Flora device. My Raspberry pi detects the Mi Flora but I think there is something wrong with my imported DTH.
I got this message in the live logs for the Mi Connector in the Smartthings IDE:

Failed >> Non exist DTH!!! Type >> unknown
Data >> null
Try >> ADD Xiaomi Device id=c47c8d67a2dd, type=unknown

and in the Mi Connector on the Raspberry pi it looks like this:

Here is also some more info from the logs of the “Device History”

TypeError: Cannot read property 'info' of undefined
    at Object.module.exports.getDeviceInfo (/usr/src/app/miio/miio.js:1549:24)
    at /usr/src/app/routes/devices.js:60:23
    at Object.module.exports.getDeviceTotalState (/usr/src/app/miio/miio.js:1496:5)
    at /usr/src/app/routes/devices.js:59:10
    at Layer.handle [as handle_request] (/usr/src/app/node_modules/express/lib/router/layer.js:95:5)
    at next (/usr/src/app/node_modules/express/lib/router/route.js:137:13)
    at Route.dispatch (/usr/src/app/node_modules/express/lib/router/route.js:112:3)
    at Layer.handle [as handle_request] (/usr/src/app/node_modules/express/lib/router/layer.js:95:5)
    at /usr/src/app/node_modules/express/lib/router/index.js:281:22
    at param (/usr/src/app/node_modules/express/lib/router/index.js:354:14)
    at param (/usr/src/app/node_modules/express/lib/router/index.js:365:14)
    at Function.process_params (/usr/src/app/node_modules/express/lib/router/index.js:410:3)
    at next (/usr/src/app/node_modules/express/lib/router/index.js:275:10)
    at Function.handle (/usr/src/app/node_modules/express/lib/router/index.js:174:3)
    at router (/usr/src/app/node_modules/express/lib/router/index.js:47:12)
    at Layer.handle [as handle_request] (/usr/src/app/node_modules/express/lib/router/layer.js:95:5)

Does anyone know how to fix this?
Thanks in advance!

EDIT: After digging through the thread a bit I found the solution. I was running the mi-connector-arm:latest when I should have been running mi-connector-arm:test3 as suggested by @paros :