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.
To control the devices, put gateway's MAC address (lower case without colon) and password (keep original and case sensitive) to ~/.homebridge/config.json.
{
"platforms": [{
"platform": "MiAqaraPlatform",
"gateways": {
"6409802da3b3": "02i44k56zrgg578b"
}
}]
}