New Xiaomi gateway firmware (xiaomi_aqara component)

Nevermind, found it. To see the button with the three dots you have to select your gateway first. I missed that step

1.4.1_151 is out and its filling up the log. Everything works fine though.

ERROR (Thread-19) [PyXiaomiGateway] Non matching response. Expecting write_ack, but got read_ack
ERROR (Thread-19) [PyXiaomiGateway] No data in response from hub None

I just got notified about new firmware …I might wanna wait then ?

Just updated to 1.4.1_151.0143 because my thermometers vanished from HA and MIAPP (don’t know if related), and after that no problem - both gateway and devices connected to it are shown and accessible in HA 0.58.0

Hopefully someone can help me!

I just received my xiaomi aqara set and directly connected it to home assistant. Unfortunately I run into problems:
[PyXiaomiGateway] Got error element in data {“error”:“Invalid key”}
Home Assistant is updated to current version 59.2
The firmware on the gateway also was updated to latest version.1.4.1_151.0143
My setup:
I run ubuntu on a NUC with docker and portainer installed. Home Assistant runs in a docker.
the configuration part of home assistant:

xiaomi_aqara:
gateways:
- host: 192.168.1.24
mac: 28:6c:07:f1:xx:xx
key: 2av21502esxxxxxx
(discovery I have turned off.)

When opening home assistant, I nicely see all the connected sensors and devices. Happy so far!
However, when sending a command to the plug, or gateway, it returns the ‘invalid key’ error (which I checked and changed already at least 10 times, including resets)

Then I checked if the port (udp 9898, was open). Still fine
I have a Netgear R7000 Nighthawk, which should support multicast, all seems good

After spending a whole afternoon I ran out of inspiration on how to fix this.

Anybody can help?

Try changing the mac so it does not have : between and change the key to uppercase:

mac: 286c07f1xxxx
key: 2AV21502ESXXXXXX

Tried with no luck

Unfortunately probably this means either your router or HA device is not capable of handling multicast packets.

Any way to verify this? I would be surprised if the router is the issue, maybe less surprised with the NUC

I solved it. Errellion’s answer sent me to the right direction.
By simple adding the following rules to iptables and a restart it works now:

iptables -P OUTPUT ACCEPT
iptables -I INPUT -p udp -j ACCEPT

which surprises me, since I thought I added some rules for port 9898 udp and tcp before. (assumptions…)

I have one question that hasn’t been answered yet. I have bought the ZigBee wall switch and I disabled the buttons to automatically toggle the switch. is there a possibility to automate that button press in home assistant. I can do it for the battery powered wall switch, but that switch has 3 entity ids one for left press one for right and one for a double press. This one gives me just two switches for the relays.

I am also having a problem which I don’t know if it’s related to this upgrade.
At some point, after restarting Home Assistant, the Xiaomi sensors and switches started showing a strange behaviour. Instead of having all the devices only some of them are shown. The ones that appear are shown multiple times.
I don’t know what caused the problem, everything was fine and after a restart this happened.

My configuration.yaml is the simplest one (ignore the indentation, it’s ok in the file):
xiaomi_aqara:
gateways:
- key: xxxxxxxxxxxxx

From the log it’s possible to see how strange the behaviour is:

It’s looks like protocol changed a little. Gateway got additional sid. When we discovering devices gateway reports additional sid in device list (first in the list). After getting device list component discovers their type by sending read command to each sid in the list. Sending read command to gateway second sid it interprets it as get_device_list and reports device list again. And component expects read_ack response.

What gateway are you using?
Is your gateway reports illumination and light state?

Hi Lapatoc,

Thank you for your reply! Yes, indeed! Initially it was working with no issues, even with the “discovery” component the sensors were ok. Then I commented out “discovery” and added “xiaomi_aqara” and everything was perfect.
But at some point this happened and it doesn’t recover.
The gateway model is “lumi.gateway.v3”, firmware version “1.4.1_151.0143” (upgraded recently, it may be related?). I had access to the gateway light previously, but not anymore.
This is what I see:


I can call the “xiaomi_aqara.play_ringtone” service without any problems, it looks like it’s just some issue with initialization of the devices.

Note: I am also using Homebridge on a different Pi, and it’s working perfectly - I tried stopping Homebridge to avoid any conflict, without success. Both were running at the same time with no problems previously.

I’ve just upgrade to the same fw. But do not have any issues. What is your HW_VER?

You do not have access to light and illumination because your gateway response to read command with state of your motion sensor - last line on your screenshot. But this this is wrong because it’s not gateway state.
Maybe you need to perfome gateway reboot or reset.

hw_ver=MW300 :slight_smile:

I have same. Next parameter life:2529

Yes, exactly! And also another switch I have, everything is being seen as sensors.
I thought about that, that will be my last resource, since it will force me to configure everything again.

life=97640

Did you restart HA after upgrading the GW?

Yes. I’ve restarted Hass.