homebridge-smarthome-plus v1.1.7
homebridge plugin and webapp for smarthome
mijia & broadlink & more...
Thanks for 0. rench(the author of homebridge-smarthome) 1. snOOrz(the author of homebridge-aqara) 2. YinHangCode(the author of homebridge-mi-aqara) 3. aholstenson(the author of miio) 4. all other developer and testers.
Note: I have only a part of these devices, some devices do not have been tested. If you find bugs, please submit them to issues.
Mijia & Aqara Accessory for homebridge.
Zigbee

Wifi

Supported Devices
- Gateway(LightSensor/Lightbulbhue)
- Magent(ContactSensor)
- TemperatureAndHumiditySensor(HumiditySensor/TemperatureSensor)
- Motion(MotionSensor)
- Switch(StatelessProgrammableSwitch)
- Plug(Outlet)
- CtrlNeutral1/CtrlNeutral2(Switch)
- CtrlLN1/CtrlLN2(Switch)
- 86SW1/86SW2(StatelessProgrammableSwitch)
- 86Plug(Outlet)
- Smoke(SmokeSensor)
- Natgas(SmokeSensor)
- Curtain(WindowCovering)
- AirPurifier(AirPurifier/AirQualitySensor/TemperatureSensor/HumiditySensor/Lightbulb)
- Vacuum(Fan)
- PowerPlug(Outlet)
- PowerStrip(Outlet)
- Yeelight(Lightbulbhue)
- Aqara Switch(Switch)
- Aqara Magent(ContactSensor)
- Aqara TemperatureAndHumiditySensorAndPressure(HumiditySensor/TemperatureSensor/
CommunityTypes.AtmosphericPressureSensor) - Aqara Motion(MotionSensor)
- Aqara WaterLeak(LeakSensor)
- Xiaomi Philips Bulb (and Candle Bulb)
Broadlink Accessory for homebridge.

Supported Devices
- MP1(Outlet)
- MP2(Outlet)
Pre-Requirements
- Make sure you have V2 of the gateway. V1 has limited space so can't support this feature.
- Update gateway firmware to 1.4.1_141.0141 or later. You can contact @babymoney666 if your firmware is not up to date.
Installation
- Install HomeBridge, please follow it's README.
If you are using Raspberry Pi, please read Running-HomeBridge-on-a-Raspberry-Pi. - Make sure you can see HomeBridge in your iOS devices, if not, please go back to step 1.
- Download homebridge-smarthome to your local folder or
npm i homebridge-smarthome.
Configuration
- Open Aqara gateway's settings, enable local network protocol.
Please follow the steps in this thread: http://bbs.xiaomi.cn/t-13198850. It's in Chinese so you might need a translator to read it or follow the steps. - You'll need an android device or an emulator (I've used BlueStack and it works fine for me).
- Install Mi app on the Android device and set up your gateway.
- Click in the top right corner.

- Click About tab

- Click few times bottom area to open the programmer mode

- Click the LAN protocol

- Open the LAN protocol and remember the password (this goes to your config.json file)

- Click Information about the gate

- To control the devices, put gateway's MAC address (lower case without colon) and password to ~/.homebridge/config.json.

- How to get device ip and token? see miio.
Basic (enough for Gateway and ZigBee devices) config.json
{
"bridge": {
"name": "SmartHome",
"username": "CC:22:3D:E3:CE:30",
"port": 51826,
"pin": "031-45-154"
},
"platforms": [
{
"platform": "smarthome-mijia",
"web": {
"port": 8888
},
"mijia": {
"sids": [
"34ce0088faed"
],
"passwords": [
"75ED5A235C4A44D4"
],
"devices": []
}
},
{
"platform": "smarthome-broadlink",
"broadlink": {
"devices": []
}
}
]
}Advanced (for WiFi and BroadLink devices) config.json
{
"bridge": {
"name": "SmartHome",
"username": "CC:22:3D:E3:CE:30",
"port": 51826,
"pin": "031-45-154"
},
"platforms": [
{
"platform": "smarthome-mijia",
"web": {
"port": 8888
},
"mijia": {
"sids": [
"34ce0088faed"
],
"passwords": [
"75ED5A235C4A44D4"
],
"devices": [
{
"sid": "Air Purifier 001",
"name": "Air Purifier",
"type": "wifi",
"model": "air-purifier"
},
{
"sid": "Power Plug 001",
"name": "Power Plug",
"type": "wifi",
"model": "power-plug"
},
{
"sid": "Power Strip 001",
"name": "Power Strip",
"type": "wifi",
"model": "power-strip"
},
{
"sid": "Yeelight 001",
"name": "Yeelight",
"type": "wifi",
"model": "light"
},
{
"sid": "Vacuum Cleaner 001",
"name": "Vacuum Cleaner",
"ip": "192.168.2.200",
"token": "4ac2cd21f3e9272ab21a5c1fd4053ed9",
"type": "wifi",
"model": "vacuum"
}
]
}
},
{
"platform": "smarthome-broadlink",
"broadlink": {
"devices": [
{
"name": "MP2",
"type": "MP2",
"mac": "34:EA:34:D9:FE:B3"
}
]
}
}
]
}To set Xiaomi Philips Bulbs you'll most likely need a token as auto-token doesn't work properly on them. To obtain a token you'll need to reset the bulb to it's factory settings (delete it from Mi Home app and tur on it off and on 5 times as it will start blinking) and connect your PC to it's WiFi called philips-light_xxx and run in your terminal command "miio discover --sync" (miio is required). When sorted all you have to do it's add it to your config.json file like follow:
"devices": [
(...)
{
"sid": "Your own light name",
"type": "wifi",
"model": "philips.light",
"device_id": "YOUR DEVICE ID",
"token": "YOUR DEVICE TOKEN"
}
(...)
]Run it
Debug mode:
homebridge -D
Regular mode
homebridge
Troubleshooting
- If you receive an
{"error":"Invalid key"}in your log (in debug mode) while trying to control the gateway light, you should generate the key again using an Android Phone or alternatively an emulator such as bluestacks. In some instances there is an issue with keys being generated using the iOS application.
Version Logs
1.1.4
miijafix & improved magnet sensorsaqarafix & improved magnet sensorsmijiaimproved motion sensorsaqaraimproved motion sensorsaqaradisabling pressure form TemperatureAndHumiditySensorAndPressure as it's not supported yet by HomeKit
1.1.3
mijiafix purifier type error.mijiafix multi getways.
1.1.2
mijiafix yeelight missing miio require.
1.1.1
mijiafix gateway lighthub.
1.1.0
mijiafix air-purifier accessory(fix multi callback).
1.0.7
mijiafix air-purifier accessory(remove some duplicated code).
1.0.6
aqaramagnet,motion,switch,temperature-humidity-pressure accessory.mijiachange monitor.js->motion.js.mijiaupdate miio.
1.0.5
mijiayeelight accessory(bugfix).
1.0.4
mijiayeelight accessory.mijiafix wifi device bug.
1.0.3
mijiavacuum accessory.mijiapowerplug accessory.mijiapowerstrip accessory.
1.0.2
mijiamagnet sensor accessory.mijiactrln1/ctrln2 switch accessory.mijiactrlneutral1/ctrlneutral2 switch accessory.mijiamotion sensor accessory.mijiaplug/86plug plug accessory.mijia86sw1/86sw2 switch accessory.mijiaswitch accessory.mijiasmoke sensor accessory.mijianatgas sensor accessory.mijiaair-purifier accessory.broadlinkmp1/mp2 plug accessory.
1.0.1
mijiagateway sensor accessory.mijiadoor and window sensor accessory.mijiatemperature and humidity sensor accessory.
8 years ago
