SmartThings Community

Mi Connector (Xiaomi and Yeelight)

You didn’t set a st url, app id, token on setting page.


Open smartapp Mi connector.
Type a address and press save button.

Then it will be written by automatically.

As your log monnlight is init on mi connector.
It’s just not registered to st.

@fison67 would you be able to provide some pointers? I’m trying to get a Flora talking to the docker on my Synology NAS. I see earlier that you’re running a similar setup. I’ve got the USB device passed through to the docker, but not sure precisely where to go from here.

I scan with hcitool -i hci0 scan and hcitool -i hci0 lescan but the Flora doesn’t show up. It does find the Nest Protect in the same room as the server, the Flora is even closer, probably no more than 60cm from the Bluetooth adapter.

Also, when it comes to token time, I’m wondering how to obtain this. The instructions I followed for the vacuum worked, but that’s from the Mi Home App, which doesn’t appear to have any support for the Flora, I had to install an app called “Flower Care” to get it paired with my phone.

You don’t have to do something.

It’s just connected automatically with docker container restart.

Or remount USB & docker container restart.

Version of your Bluetooth dongle is higher than 4.0?

I had to do a little more than that to get it passed through but it is passed through now. The dongle is BT 4.0 exactly according to the product description.

Fison67 ,

I went and gave this another go yesterday .

Im using 64bit Centos , and your test3 image . Docker version is from the YUM repository. I have also disabled the SELINUX security.

I changed the command a little bit when installing Mysql

docker run -d --restart=always --name mariadb -e MYSQL_ROOT_PASSWORD=password1234 -e TZ=Asia/Seoul -p 33006:3306 -d jsurf/rpi-mariadb

Seems to have fixed the issue when after a reboot sql would no longer be running , but stating “exiting” . Either the command above did or the version got updated on docker :wink:

Test3 image seems fine, now when i reboot the server it picks the lights up fine again.

So seems great :wink: many thanks for your past help and well done on a great piece of software !

Im using it currently with a Yeelight bulb and Philiips/Xiaomi downlight . I will be installing another 8 downlights soon and wanted Smartthings to turn them on when my philiips hue lights turn on ! so this should do the trick :wink:

Hi and thanks for the info.

At the end i insert manually all data that was shown to me inside the config of the smartapp on my device to the mi connector before adding devices and then it worked no problem.

I also wanted to tell you, that someone found an easier way to get device tokens:

This is a modified to work in spanish, that at the same time in the device network settings shows you the token. I needed this, because my vacuum 2 is an eu one, and the other method used the mi home app 5.0.0 beta that doesn’t support EU server.

I’ve had this up and running for a good while and it works great… however just recently my Yeelight bulb went offline. Instead of waiting to see if it just sorted itself out, I reset it and it now isn’t working with the Mi Connector :frowning: The Mi Connector was initially finding and displaying the bulb in red (as it didn’t have an assigned token). I really struggled in obtaining the token for it this time but managed to find a method that worked. Through messing around and my stupidity I’ve assigned a duplicate wrong token to the yeelight and now the Mi Connector won’t let me add the correct IP address with accompanying token. When I search for devices the light isn’t showing to register anymore but it has been displayed at the bottom of the dashboard within the not initialized devices with an ID.

Hello fison67(CHALS) i have an issue, got DB loaded on R Pi 3+, all looks good. Hubitat has device drivers loaded, but mi-connector only finds hub token, no other devices has token and nothing show in hubitat interface at all. Thank You for your work on this !

Zigbee devices has no token. It’s normal.

X means that each device is not registered to Smartthings or Hubitat.
Go to the setup page & check st app url, token, id.

If it’s empty, open mi connector smartapp, just press the save button.
It’s filled out it automatically.

Thank You for the reply.
Info is filled correctly, I checked app, has correct URL, token & ID.
This is the 3rd time I try to setup, I used version “…mi-connector.test3”
I notice in raspberry pi, says “docker:0-link is down”, maybe that is issue, but then smartapp should show errors, i think ?

Let me know logs of SmartApp after restart a docker container.

can i just reboot Rasberry pi for restarting docker container?
sorry I’m not so good with linux command line
“docker restart /docker/mi-connector-arm” ??

docker ps -a
Then you can see a container id.

docker restart [container id]

ex) docker restart asdf234sdf

What is the easiest way of finding the token for specifically the yeelight light bulb (colour)? The method that I used in the past involved using the mi toolkit and an android device and extracting the token through a backup. I vaguely remember doing another stage before using SQlite when I was successful last time?
I’ve got logs on my android device that seem to be showing the correct token for my gateway and lightstrip but are incorrect for my bulb. I’ve tried all the miio commands for my Pi but the token for the bulb is hidden and shows up as ???
Just trying to use BlueStacks now to try and retrieve the token that way. Spent several hours on this already but kind of determined to get it back sorted!

Managed to get the token for the Yeelight but the Mi Connector is still not letting me add the light. Think it is because I’ve previously tried to add the light with an incorrect token but when I delete these devices, they still remain. Pretty certain I’ve got the correct token now (retrieved it from logs from Mi Home app 5.4.54). Any suggestions?


DB is disconnected>>Error: connect ECONNEFUSED

Tried to reinstall DB but still got this error message. Please advise.

Added another error message:
DB is disconnected >> Error: Host ‘’ is not allowed to connect to this MariaDB server

Used below command, working now.

docker run -d --restart=always --name mariadb -e MYSQL_ROOT_PASSWORD=password1234 -e TZ=Asia/Seoul -p 33006:3306 -d jsurf/rpi-mariadb

I don’t know exactly what you’re saying.
Just delete device info on mi connector & delete device on smartthings.
And Restart a docker container. Add a device with token.

Managed to do it already. I set up a new Mi connector on a different Raspberry Pi. Thanks again for getting back to me :blush: Do you have a PayPal or Patreon?

It’s good.
I have a PayPal.

Made some progress. The tested devices listed here indicates a triangle for the Mi Flora but a circle for the beta so I tried the beta image. I can see there’s polling in the docker console, but searching for devices yields nothing. I can connect it with the Plant Care app on my phone without issue so the sensor itself must be working. I’ve removed it as well in case that causes an issue. Yes, BT is enabled in the app and the container was restarted after that, but the Flora is not picked up in the Mi Connector app.

Any tips? Any way I can scan from command line? Seems like there aren’t any of the standard Bluetooth utilities installed.