sjfighter / mi_connector

Connector for Xiaomi Devices with SmartThings

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Mi-Connector

Connector for Xiaomi Devices with SmartThings

Simplify setup process for xiaomi devices to SmartThings.
If Mi-Connector is installed, virtual devices is registered automatically by Mi Connector Smartapp.
You don't have to do anything to add xiaomi device in Smartthings IDE.



Donation

If this project help you, you can give me a cup of coffee
Donate

Example Video

Example



Latest Version

- fison67/mi-connector:latest

- fison67/mi-connector-arm:latest

Beta Version

- fison67/mi-connector:test

- fison67/mi-connector-arm:test



History

Version: 0.0.3

Added a graph in DTH & Web. [ Important!!! You must install a DB. ]
Added support devices.
Added function [find childs] in a gateway DTH.
Fixed bug when Zigbee device count is over 25, network error occured

https://github.com/fison67/mi_connector/blob/master/imgs/v.0.0.3/README.md

Version: 0.0.2

Added Log page. You can check for an invalid token or see if Mi Connector can not get a token.
Fixed bugs.
Added refresh feature.
Added support devices.



Management Web Desktop Version.

web-dashboard-total



Management Web Mobile Version.

total



DTH Example

total2



Install

Preparing

You need a Raspbery pi or Synology Nas to install Mi Connector API Server



Install API Server

Raspberry pi

You must install docker first.

sudo mkdir /docker
sudo mkdir /docker/mi-connector
sudo chown -R pi:pi /docker
docker pull fison67/mi-connector-arm:latest
docker run -d --restart=always -v /docker/mi-connector:/config --name=mi-connector-arm --net=host fison67/mi-connector-arm:latest
Synology nas

You must install docker first.
See the Manual file for details
Current Beta version is 'mi-connector:test'

make folder /docker/mi-connector
Run Docker
-> Registery 
-> Search fison67/mi-connector
-> Advanced Settings
-> Volume tab -> folder -> Select mi-connector & Mount path '/config'
-> Network tab -> Check 'use same network as Docker Host'
-> Complete
Linux x86 x64

You must install docker first.

sudo mkdir /docker
sudo mkdir /docker/mi-connector
docker pull fison67/mi-connector:latest
docker run -d --restart=always -v /docker/mi-connector:/config --name=mi-connector --net=host fison67/mi-connector:latest



Install DTH

Go to the Smartthings IDE
Click My Device Handlers
Click Create New Device Handlers
Copy content of file in the devicetypes/fison67 folder to the area
Click Create
Loop until all of file is registered



Install Smartapps

See the Manual file for details

Connect to the Smartthings IDE
Click My Smartapps
Click New Smartapp
Click From Code 
Copy content of mi_connector.groovy & Paste
Click Create
Click My Smartapps & Edit properties (Mi-Connector)
Enable OAuth
Update Click



Install DB

Raspberry pi

You must install docker first.

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

You must install docker first.
Run Docker -> Registery -> Search mariadb -> Advanced Settings -> Port setup tab -> local port 33006, container post 3306 -> Enviroment tab -> MYSQL_ROOT_PASSWORD (password1234), TZ (Asia/Seoul) -> Complete

Linux x86 x64

You must install docker first.

docker pull mariadb
docker run -d --name mariadb -e MYSQL_ROOT_PASSWORD=password1234 -e TZ=Asia/Seoul -p 33006:3306 -d mariadb

Fill the blank [db_url, db_port, db_password] on the Mi-connector web menu setup If you don't change value, it must be a [ localhost, 33006, password1234 ]. Restart a Mi-connector container.

Problem solving

Suddenly Mi connector can't connect to xiaomi devices

If ip address and token are correct but not connected, remove the device on MiHome
And add the device again on MiHome. Then token is regenerated. Add a device on Mi-Connector again.

Some of xiaomi product is not registered

Some of product is not getting token automatically like Xiaomi Vacuum. You have to get token yourself.
And go to the 'Manage Device' > 'Device List' > Click the add button > Fill out the blank. (IP & Token) > Click OK Button

When Zigbee devices is not working(No response)

a. Open up the MiHome App
b. From the Profile > Settings screen set to the Location field to “Mainland China”
c. Open up the device detail screen for the Gateway device
d. Click the triple dots button in the top-right corner of the screen to open the More screen
e. Open the About screen
f. At the bottom of the screen keep tapping the version number until a notice appears
g. From the same screen open the Local Area Network Communication Protocol screen
h. Slide the toggle element for “Local Area Network Communication Protocol” to enabled

i. Restart Mi-Connector and then register gateway.

How to get token

https://www.home-assistant.io/components/vacuum.xiaomi_miio/#retrieving-the-access-token

These devices is not working auto mode.

You must add device manually

Management Web -> Manage Device -> Device List -> Fill the address & token -> Add Button

  • Yeelight Desk Lamp
  • Yeelight Color Bulb
  • Yeelight White Bulb
  • Yeelight LED Strip
  • Mi Robot Vacuum
  • Mi Air Quality Monitor (PM2.5)
  • Mi Smart Power Strip 1
  • Mi Smart Power Strip 2

Support devices

Wi-Fi Version

Type Model Tested Beta
Xiaomi Air Purifier zhimi.airpurifier.m1 O
zhimi.airpurifier.v1 X
zhimi.airpurifier.v2 X
zhimi.airpurifier.v3 X
zhimi.airpurifier.v6 X
zhimi.airpurifier.ma2 X
Xiaomi Humidifier zhimi.humidifier.v1 X
zhimi.humidifier.ca1 O
Xiaomi Vacuum rockrobo.vacuum.v1 O
roborock.vacuum.s5 X
Xiaomi Power Socket chuangmi.plug.v1 X
chuangmi.plug.v2 X
chuangmi.plug.m1 O
Xiaomi Power Strip qmi.powerstrip.v1 X
zimi.powerstrip.v2 O
Xiaomi Air Monitor zhimi.airmonitor.v1 O
Xiaomi Gateway lumi.gateway.v2 X
lumi.gateway.v3 O
Xiaomi Fan zhimi.fan.v2 O
zhimi.fan.v3 O
zhimi.fan.sa1 X O
zhimi.fan.za1 O O
Yeelight Mono yeelink.light.lamp1 X
yeelink.light.mono1 O
yeelink.light.ct2 O
Yeelight Color yeelink.light.color1 O
yeelink.light.color2 O
yeelink.light.strip1 O
Yeelight Ceiling yeelink.light.ceiling1 O
Philips Ceiling philips.light.ceiling O
Xiaomi IR Remote chuangmi.ir.v2 O

Zigbee Version

Type Model Tested Beta
Xiaomi Motion Sensor lumi.motion X
lumi.motion.aq2 O
Xiaomi Door/Window Sensor lumi.magnet X
lumi.magnet.aq2 O
Xiaomi Weather Sensor lumi.weather O
lumi.sensor_ht O
Xiaomi Power Socket lumi.plug O
Xiaomi Button lumi.switch O
lumi.switch.v2 O
lumi.86sw1 O
lumi.86sw2 O
Xiaomi Cube lumi.cube O
Xiaomi Wall Switch lumi.ctrl_neutral1 O
lumi.ctrl_neutral2 O
Xiaomi Smoke Sensor lumi.smoke O
Xiaomi Gas Sensor lumi.gas O
Xiaomi Water Sensor lumi.water O
Xiaomi Curtain Motor lumi.curtain O

Bluetooth Version

Type Model Tested Beta
Xiaomi Flora ble.flora O
Xiaomi Flora Pot ble.floraPot O



Library



License

This project is licensed under the MIT License - see the LICENSE file for details



Thanks

  • Many thanks to ShinJjang for testing, updating DTH.

About

Connector for Xiaomi Devices with SmartThings

License:MIT License


Languages

Language:Groovy 100.0%