pfandfrei / Homegear-Xiaomi-Smarthome

please use https://github.com/pfandfrei/MiSmartHome for Homegear 0.7.45 and newer
GNU General Public License v3.0
11 stars 3 forks source link
homegear xiaomi

Xiaomi Smart Home - Homegear Interface

V0.7.0 supports firmware version 1.4.1_159.0143

supports Homegear <=0.7.45

Homegear

Step 1: bring Xiaomi Gateway in developer mode

  1. Install the MiHome app on your mobile phone
  2. Set region to: Mainland China under settings > Locale
  3. You can set language to English
  4. Select your Gateway in MiHome
  5. Click the 3 dots at the top right of the screen
  6. Click on about
  7. Tap the version number at the bottom of the screen repeatedly
  8. Two extra options will appear in English (in Chinese in earlier versions) until you did now enable the developer mode
  9. Choose the first new option
  10. Then tap the first toggle switch to enable LAN functions. Write down the password (Needed in Homegear)
  11. Make sure you hit the OK button to save the changes
  12. Be aware: Every time you change something, the password will change!

All Xiaomi devices have to be added in MiHome app.

Step 2: install Xiaomi devices

  1. make a ssh connection to homegear device
  2. copy all *.xml files to /etc/homegear/devices/254/
  3. copy all *.php files to /var/lib/homegear/scripts/DeviceScripts/Xiaomi/
  4. Restart homegear (sudo service homegear restart)
  5. if you have changed homegear default path, you have to use the customized paths instead
  6. run 'homegear -e rs DeviceScripts/Xiaomi/MiSmartHome.php'
  7. the script will autodiscover all available Xiaomi devices (see supported devices below) and auto-create Homegear devices
  8. add the password from step 1.10 for the gateway device: homegear -e rc '$hg->putParamset(<gateway peer id>,0,["PASSWORD"=>"<enter password>"]);'

Supported devices (tested)

more detailed device documentation can be found in the doc folder

Xiaomi Mi Smart Home Gateway 2 (MiGateway)

Xiaomi Mi Smart Home Temperature/Humidity Sensor (MiSensorHT)

Xiaomi Aqara Temperature Humidity Sensor (MiWeatherV1)

Xiaomi Mi Smart Home Wireless Switch (MiSwitch)

Xiaomi Mi Smart Home Door/Window Sensor (MiMagnet)

Xiaomi Mi Smart Home Occupancy Sensor (MiMotion)

Xiaomi Aqara Window Door Sensor (MiMagnetAq2)

Xiaomi Smart Home Aqara Human Body Sensor (MiMotion)

Aqara Vibration Sensor (MiVibration)

Xiaomi Mi Smart Home Cube (MiCube)

untested, but should work

Xiaomi Aqara Smart Light Control (Mi86Sw1/Mi86Sw2)

Xiaomi Mi Smart Socket Plug (MiPlug)

Xiaomi Aqara Wall Outlet (Mi86Plug)

Xiaomi Aqara Water Leak Sensor (MiWLeakAq1)

Xiaomi MiJia Honeywell Smoke Detector (MiSmoke)

Xiaomi MiJia Honeywell Natural Gas Detector (MiNatGas)

Xiaomi Aqara Smart Wireless Switch (MiSwitchAq2)

Xiaomi Aqara Smart Wireless Switch (MiSwitchAq3)

not implemented

Xiaomi Aqara Smart Curtain Controller

how to enable debug mode

for support of unknown devices and other problems you can enable debug log by setting the config parameter DEBUG_LEVEL of gateway device to 1. A separate log is created at /var/log/homegear/mihome.log