Hello, guys! I’m having the same problem.
I got a Xiaomi kit from Amazon (EU version). The gateway is a DGNWG05LM. Here’s a photo of the gateway and the box it came in:
The problem is that the latest versions of the gateway don’t have the psm-set command you need in order to open the port. I get: psm-set: command not found
I don’t know if simply getting the binaries for psm-set and psm-get could be enough.
That is where I’m stuck now.
In case someone has already walked this path, I’d really appreciate some help.
I’ll post here if I have any news.
Hello Olivier, I just received confirmation from the seller that he is sending me version 3 of the gateway, can you confirm that everything works with HA please?
thanks again
So since version 3 does not have a built-in speaker, is it possible to create automation in HA so that when the alarm activates, it plays a siren sound on my Amazon echo? Thank you
I finally found a way.
There is no way (at least that I know of) to open port 9898 with the new units as the one I posted in the picture.
Luckily, the open source community is awesome and a user called cadavre came up with a solution.
Follow this guide and you’ll have it working in no time:
For that you should have SSH access to your gateway as root, which is also explained in the README file.
I can confirm that it works really good. I’m using it already.
Good luck!
I got my brand new xiaomi LED smart bulb rgbw in the mail.
at this moment i am trying to connect them to HASS but i cant figure it out.
when i try to configure them trough the homekit option i need to provide a 8 digit code, i cant find that anywhere.
when i try to add them trough the configuration.yaml i need a 16 digit code but i cant find that either.
is there anyone who can help me? i’ve tried the method of changing your region to china etc but couldnt find the key/code
I only would like to use and xiaomi alarm like in this video where aqara gateway is setup in HA with yaml code what is allowing many option specificly with service ringtone.
After my first amazon order resent with DGNWG05LM and I order Aqara “home kit version”. The device is only integrable in HA with the 8 digits as home kit device. This way is not working for ringtone option (only alarm panel and light of the gateway)
I also plan to resent aqara home kit.
Wich version do you recommande for using this yaml integration exampled here ?
I note the mio gateway aliexpress link posted by Olivier
First, to check if your gateway is working, you can call the service : go to “develloper tools” (left margin of HA) and “service”. you fill the service by the name of the gateway like :
xiaomi_aqara.play_ringtone
and in “data” you paste :
gw_mac: xxxxxxxxxxxx (mac adress of your gateway)
ringtone_id: 8
ringtone_vol: 8
and you clic “call the service” and you will heard a dog barking.
Look at the documentation (link i just provide above) and you have all option and all ringtone and you even have an automation exemple to use.
But if you have any sensor i dont understand what do you expect to do???
At least you need a physical switch to trigger the automation and play a ringtone…
BUT, the first thing before asking is to read at least the documentation of the integration you try to use…all informations you need are there…
Last thing : if you buy a mio gateway, you dont have “alarm panel” in HA, so you just have the light of the gateway as an entity, no more. That means you have the good item, no need to change…just use it as it is expect to…
1-Have you configure the gateway under “Mi Home APP” and can you access it and test the ringtones?
2-have you check this?
If your gateway’s MAC address starts with 04:CF:8C or 7C:49:EB, there is a good chance that the required port 9898 is closed on your gateway (you can check it with the Nmap utility, using the command sudo nmap -sU {gateway_ip} -p 9898). To fix that issue, you need to do these steps:
Find a specific screw bit (like a fork) to open the gateway case.
Find a USB-UART cable/module and connect it to your computer.
Solder 3 wires - RX, TX and GND like here.
Turn on the gateway (220V).
Open a serial terminal application (e.g., PuTTY) and connect to the serial port assigned to the USB-UART module (baudrate: 115200).
Wait until the gateway is booted up, connect the RX, TX and GND wires to the UART module (don’t connect the Vcc (power) wire!).
You will see all the messages from the gateway.
Send the command psm-set network open_pf 3 (the command has to end with a CR newline character).
Check your settings executing the command psm-get network open_pf to be sure it’s OK.
Restart the gateway.
3-If 1 and 2 are ok, then :
Unplug your gateway from the socket
Reboot HA (not only restart but reboot) and plug your gateway just after reboot
Check your gateway is online in the Mi Home APP
Check your gateway is ok in HA and test again the service xiaomi_aqara.play_ringtone
If it doesnt work, you missed something.
Normally you add the gateway in MI Home APP and configure the wifi. When its connected and you have access in MI Home APP, then you restart HA and with “discovery:” enable in config.yaml you should be prompt for a new device.(if not you go in "integration > + > Home Kit). Then enter your pin xxx-xx-xxx. Then restart. Then test the xiaomi_aqara.play_ringtone service.
Redo again with a fresh install…dont know where there is a problem…:
have you check the log? (developpement tools > logs) is there an error about aqara integration?
Where do I need to put the key ? I have the “works with the homekit”
Also bought it on Aliexpress
Also if I want to add the homekit component in hassio I can only see my hue and Ikea tradfri hub.
Can you help me further with this ?
Also with the homekit key:
Log Details (ERROR)
Logger: homeassistant.config
Source: config.py:726
First occurred: 4:55:34 PM (1 occurrences)
Last logged: 4:55:34 PM
Invalid config for [xiaomi_aqara]: length of value must be at least 16 for dictionary value @ data['xiaomi_aqara']['gateways'][0]['key']. Got '582-58-954'. (See /config/configuration.yaml, line 44). Please check the docs at https://www.home-assistant.io/integrations/xiaomi_aqara```
My Aqara :
ZHWG11LM
update,
even if I remove the aquara_config from the config file hass keeps complaining that the setup is wrong.
I finaly got the lights into Homeassistant without a key or some sort!!
Now the only problem is that the light shows up as a entity but not as a device.
i can control everything from home assistant but i cant create an automation with it because it is not visible as an device.
If i left out the interface section, homeassistant couldn’t seem to find the xiaomi gateway since i have multiple interfaces connected to homeassistant. If you only have a single interface, your config should work as it is but with an actual key.
thanks for replying but the link you have does not work for me like multiple other people.
I do not have the “about” menu in the mi home app.
What I understand from @Olivier974 is that you can use the code that is on the box were the hub came with it.
for some reason my hass does find it but it complaint it was linked to an other device. I removed all config of the xiaomi in the config.yaml file but for some reason it still finds it.
I’m struggling with this for more then 6 months now.
I used the Samsung smartthings to link the xiaomi sensor but it is a real pain in the ass to get them working and therefor I got the hub but I found out it is also a struggle to get it visible in home assistant.
Yes, i’ve heard reports of the ‘about’ menu being missing too. There are some suggstions on other sites to try older versions of the Android app. I’m using the latest iOS app which seemed to work fine. One thing to note is that the hub needs to be setup in the app before you will be able to select the hub and click the about menu. I’ve never heard of the HomeKit code working for the xiaomi_aqara integration but i could be wrong. I had a similar issue with homeassistant finding the hub but not communicating with it. Homeassistant would discover the hub but wouldn’t communicate with it until i added the correct key in the configuration. I’m afraid that without the key it won’t work. I didn’t have the homekit-enabled hub, but there are some hubs that have port 9898 blocked. That port needs to be open and multicast needs to be enabled on your network. To test if the port is open you can use telnet host porttelnet host:port on Unix systems. If the port is closed you will probably need to take the hub apart and connect to it via a serial connection and then issue a command to open the port. This worked for me:
I hope the helps! Too bad it isn’t any easier. I had the hardest time getting the hub to connect into the MiHome app. The trick was to setup an account on the Xiaomi website instead of through the app. The app uses location services and will know that you are not in “Mainland China” which is the region that’s required to get the hub to connect to the app - at least it was for me.
the response was just the POST above your question
Hey guys take some times to read this POST and existing responses…
@meichthys all your suggestions has already give in the above parts of this POST…
and yes it works for the “about” menu but not for EU version, just Chinese one…
NOBODY READ THE POST AND ASK AGAIN THE SAME QUESTION…
So this POST is becoming a repeatition of explanations and solutions that are clearly given first…
"
Please note, there are two versions of the hub: v1 and v2. v1 can be used with Home Assistant without any problems, however, v2 might be less straight forward when it comes to enabling the local API, and might even require you to open up your device in order to do so. Xiaomi has suggested this is in the pipeline.
"
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// V1 is ZHWG11LM
This is Aqara Gateway (Aqara on the center spot of the gateway)
So, if you dont have this version, IT DOESNT WORK with the method above with xxx-xx-xxx key in integration. !!!ONLY FOR CHINESE VERSION “HOME KIT COMPATIBLE”!!! NOT EU
V3 is DGNWG02LM
This is MIO gateway (M on the center spot of the gateway) and it works with the key 16 digit that you copy in the “about” section after activate the hiden menu) !!!ONLY FOR CHINESE VERSION!!! NOT EU
V4 is ZNDMWG03LM
this is the Smart Home version (and last version) without Leds RGB and Ringtones
and it work like AQARA if you buy the “Home Kit Compatible” version, with the key xxx-xx-xxx, integration in HA. !!!ONLY FOR CHINESE VERSION “HOME KIT COMPATIBLE”!!! NOT EU
V5 ? DGNWG05LM (EU VERSION)
Seems to be a nightmare to make it work in HA (or if you want to open it and solder some rx, tx cables and make some root commands…lol)
So, AVOID IT if you want to make your life easier…
Anyway, even if the gateway connect on a EU server, sure the informations gone to China…so this version is good for people just use the MI HOME APP and dont use HA…
I have those 3 version : 2 gateway V1, 2 gateway V3 and 1 V4, and IT WORK LIKE A CHARM in HA, since the 0.95 update. Now i have the latest, 0.108.6 and STILL WORKING. I dont use the Mi Home APP, even for automations. Just sometimes for check if there is firmware upgrades. But automations works, both in MI Home APP and HA! just dont duplicate them in both, off course…
SO, buy Chinese versions if you dont want to make a brain storming to make it work.
AND, ANY VERSION WILL WORK in HA without setting up before in MI HOME APP on your PHONE Android or IOS. “Mainland China” or “China” for country.
(A PLUG/ UNPLUG may be necessary for HA to discover them after setup in Mi Home APP)
Gateways have to be on the same LAN of your HA server.