Control Zigbee devices from Home Assistant with Aqara Gateway (KTBL12LM, ZHWG15LM, ZHWG12LM, ZNSXJ12LM, ZNSXJ12LM). Gateway support Zigbee 3.
This integration was based on the development of @AlexxIT, Thanks Alex.
ATTENTION: The component only works on modified firmware (M2) or the gateway which was enabled telnet.
For Gateway M2, to flash modified firmware to M2, please use AqaraGateway.exe to flash customize firmware. Need to open the case of gateway and wired out the UART.
For Gateway M1S CN, AirCondition P3 CN, Smart Hub H1 CN, Hub E1 CN, please switch to Mi Home mode, and get the token.
you can install component with HACS, custom repo: HACS > Integrations > 3 dots (upper top corner) > Custom repositories > URL: niceboygithub/AqaraGateway
> Category: Integration
Or Download and copy custom_components/aqara_gateway
folder to custom_components
folder in your HomeAssistant config folder
-
⚙️ Configuration > 🧩 Integrations > ➕ Add Integration > 🔍 Search
Aqara Gateway
- If the integration didn't show up in the list please REFRESH the page
- If the integration is still not in the list, you need to clear the browser cache.
-
Enter Gateway IP address.
-
If you applied a password of telnet in gateway, please enter the password. Otherwise, ignore this field.
-
Enter the xiaomi token of gateway if it is the first time to add integration. Otherwise, ignore this field.
-
Click Send button, then wait this integration is configured completely.
-
Done
More detail instructions from @InsaneWookie
You can use custom open telnet command way 2 or way 3 to enable telnet in Mija Home mode, then flash modification firmwares to M1S , P3 , E1 , if you want use them in Aqara Home. No need to open the case of gateway.
After telnet to gateway via putty, there are two methods (Flash or Not) to enable telnet and public mqtt.
mkdir /data/bin
cd /data/bin
wget -O /data/bin/curl "http://master.dl.sourceforge.net/project/mgl03/bin/curl?viasf=1"
chmod +x /data/bin/curl
/data/bin/curl -s -k -L -o /data/bin/mosquitto https://raw.githubusercontent.com/niceboygithub/AqaraM1SM2fw/main/binutils/mosquitto
chmod a+x /data/bin/mosquitto
mkdir /data/scripts
cd /data/scripts
/data/bin/curl -s -k -L -o /data/scripts/post_init.sh https://raw.githubusercontent.com/niceboygithub/AqaraM1SM2fw/main/binutils/post_init.sh
chmod +x /data/scripts/post_init.sh
Then restart gateway by reboot command.
cd /tmp
wget -O /tmp/curl "http://master.dl.sourceforge.net/project/mgl03/bin/curl?viasf=1"
chmod a+x /tmp/curl
/tmp/curl -s -k -L -o /tmp/linux.bin https://raw.githubusercontent.com/niceboygithub/AqaraM1SM2fw/main/original/M1S/3.2.8_0009.0526//linux_3.2.8_0009.0526.bin
fw_update /tmp/linux.bin
/tmp/curl -s -k -L -o /tmp/rootfs.bin https://raw.githubusercontent.com/niceboygithub/AqaraM1SM2fw/main/modified/M1S/3.2.8_0009.0526/rootfs_3.2.8_0009.0526_modified.bin
fw_update /tmp/rootfs.bin
/tmp/curl -s -k -L -o /tmp/ControlBridge.bin https://raw.githubusercontent.com/niceboygithub/AqaraM1SM2fw/main/original/M1S/3.2.8_0009.0526/ControlBridge.bin
[ "$(md5sum /tmp/ControlBridge.bin)" = "799ecb705ce22049566a0d772c93c2b2 /tmp/ControlBridge.bin" ] && zigbee_msnger zgb_ota /tmp/ControlBridge.bin
If there is no any error generated, then restart gateway by reboot command.
cd /tmp
wget -O /tmp/curl "http://master.dl.sourceforge.net/project/mgl03/bin/curl?viasf=1"
chmod a+x /tmp/curl
/tmp/curl -s -k -L -o /tmp/linux.bin https://raw.githubusercontent.com/niceboygithub/AqaraM1SM2fw/main/original/M2/3.2.8_0006.0526/linux_3.2.8_0006.0526.bin
fw_update /tmp/linux.bin
/tmp/curl -s -k -L -o /tmp/rootfs.bin https://raw.githubusercontent.com/niceboygithub/AqaraM1SM2fw/main/modified/M2/3.2.8_0006.0526/rootfs_3.2.8_0006.0526_modified.bin
fw_update /tmp/rootfs.bin
/tmp/curl -s -k -L -o /tmp/ControlBridge.bin https://raw.githubusercontent.com/niceboygithub/AqaraM1SM2fw/main/original/M2/3.2.8_0006.0526/ControlBridge.bin
[ "$(md5sum /tmp/ControlBridge.bin)" = "799ecb705ce22049566a0d772c93c2b2 /tmp/ControlBridge.bin" ] && zigbee_msnger zgb_ota /tmp/ControlBridge.bin
If there is no any error generated, then restart gateway by reboot command.
cd /tmp
wget -O /tmp/curl "http://master.dl.sourceforge.net/project/mgl03/bin/curl?viasf=1"
chmod a+x /tmp/curl
/tmp/curl -s -k -L -o /tmp/linux.bin https://raw.githubusercontent.com/niceboygithub/AqaraM1SM2fw/main/original/P3/3.0.7_0007.0515/linux_3.0.7_0007.0515.bin
fw_update /tmp/linux.bin
/tmp/curl -s -k -L -o /tmp/rootfs.bin https://raw.githubusercontent.com/niceboygithub/AqaraM1SM2fw/main/modified/P3/3.0.7_0007.0515/rootfs_3.0.7_0007.0515_modified.bin
fw_update /tmp/rootfs.bin
If there is no any error generated, then restart gateway by reboot command.
cd /tmp
wget -O /tmp/curl "http://master.dl.sourceforge.net/project/mgl03/bin/curl?viasf=1"
chmod a+x /tmp/curl
/tmp/curl -s -k -L -o /tmp/linux.bin https://raw.githubusercontent.com/niceboygithub/AqaraM1SM2fw/main/original/H1/3.0.8_0001.0512/linux_3.0.8_0001.0512.bin
fw_update /tmp/linux.bin
/tmp/curl -s -k -L -o /tmp/rootfs.bin https://raw.githubusercontent.com/niceboygithub/AqaraM1SM2fw/main/modified/H1/3.0.8_0001.0512/rootfs_3.0.8_0001.0512_modified.bin
fw_update /tmp/rootfs.bin
If there is no any error generated, then restart gateway by reboot command.
cd /tmp
wget -O /tmp/curl "http://master.dl.sourceforge.net/project/aqarahub/binutils/curl?viasf=1"
chmod a+x /tmp/curl
/tmp/curl -s -k -L -o /tmp/coor.bin https://raw.githubusercontent.com/niceboygithub/AqaraCameraHubfw/main/original/E1/3.1.3_0066/Network-Co-Processor.ota
[ "$(md5sum /tmp/coor.bin)" = "59b527769c2ecb2b840967f97b88eaa3 /tmp/coor.bin" ] && zigbee_msnger zgb_ota /tmp/coor.bin
/tmp/curl -s -k -L -o /tmp/kernel https://raw.githubusercontent.com/niceboygithub/AqaraCameraHubfw/main/original/E1/3.1.3_0066/kernel_3.1.3_0066
[ "$(md5sum /tmp/kernel)" = "c5fb24da4d0ba28181a1c0c7f71e5497 /tmp/kernel" ] && fw_update.sh /tmp/kernel
/tmp/curl -s -k -L -o /tmp/rootfs.sqfs https://raw.githubusercontent.com/niceboygithub/AqaraCameraHubfw/main/modified/E1/3.1.3_0066/rootfs_3.1.3_0066_modified.sqfs
[ "$(md5sum /tmp/rootfs.sqfs)" = "2a8c23fa8e0f742269f0eb1dc13bbc7c /tmp/rootfs.sqfs" ] && fw_update.sh /tmp/rootfs.sqfs
If there is no any error generated, then restart gateway by reboot command.
Note: It updates firmware only if the checksum of the downloaded file is correct.
There is a way to enable telnetd.
Go to Configuration->Info->system_health
Attention: The component is under active development.