Xiaomi Gateway Integration

How did you fix the problem with the constantly working sensor?

The smoke and gas alarms are available for pre-order @ gearbest.

Currently smoke is £32 ($40)
http://www.gearbest.com/alarm-systems/pp_615081.html

And Gas is £40 (~$50)
http://www.gearbest.com/alarm-systems/pp_615080.html?wid=21

I’ve not yet tried @Danielhiversen code, but when my sensors went ghost mode, sending a “read” command would return with a “motion” message, so I don’t think that would fix the issue, but I may be wrong.

Relying only on the broadcast could indeed be a way around the issue. We could ignore the heartbeats which are the main issue here. But that would make it easier to miss states I guess.

Did you unplug and replug the gateway, thats the easiest way to test it? I had always ghost openings after this action. I have the eMail of the API developer, i wrote him in english but i didn’t get an answer yet. Next step is, that my chinese friend translates my issue and i hope i will get an answer.

I spoke too soon. After an hour of being in the off state, they changed to “on” again. :frowning:

Hey Daniel,

since i changed to your component, i can not use the gateway light anymore, according to the log the key is invalid.

[custom_components.xiaomi] Got error element in data {“error”:“Invalid key”}

When i use the official repo it works without issues.

Nice! I pre-ordered one. Will start looking into it once i received the smoke sensor

Good point. Ignoring heartbeat message seems like a good idea especially for door sensor. Motion sensor is a little tricky to implement.

Or make your own: Xiaomi Gateway Integration

That is a very useful technique.
Essentially we can make any zigbee enabled binary sensor for less than $10 :slight_smile:

I have one xiaomi gateway, but it can’t be discovered.
Do anyone know how can I fix this issue? Thanks in advance.
And I’ve turned off the 5G wifi.
Invalid Config:
The following components and platforms could not be set up:
xiaomi
Please check your config

Log:
The following errors have been logged this session:

17-03-21 12:27:49 ERROR (Thread-9) [homeassistant.components.switch.broadlink] Failed to connect to device.
17-03-21 12:27:57 WARNING (MainThread) [homeassistant.setup] Setup of sensor is taking over 10 seconds.
17-03-21 12:27:58 WARNING (MainThread) [homeassistant.setup] Setup of xiaomi is taking over 10 seconds.
17-03-21 12:28:03 ERROR (Thread-4) [custom_components.xiaomi] No gateway discovered
17-03-21 12:28:03 ERROR (MainThread) [homeassistant.setup] Setup failed for xiaomi: Component failed to initialize.

Configuartion.yaml:
xiaomi:
gateways:

  • sid:
    key: 4B1F50C008CB4***

key has to be lowercase

hi @1337hium,
thanks, I change the configuration to:
xiaomi:
gateways:

  • sid:
    key: 4b1f50c008cb4***

but it isn’t fixed.

Xiaomi Gateway sends no multicast packets

Hi everyone ,

I’m new here on this forum so I hope I post this issue at the right spot and I hope someone can help me with the following problem:

I have a Xiaomi Gateway installed.
the firmware version of the software is 1.3.1_140 and it is also connected to the several devices.

But i can’t connect to it.

When I inspect the network traffic with Wireshark I see only UDP traffic from 192.168.1.180 port 9966 to 255.255.255.255 port 8875

What I learned from people who have this working I should see UDP traffic from 192.168.1.180 port 4321 to 224.0.0.50 port 9898

I really hope someone can help me with this issue.

had the same issue @oliverR
The only thing that helped was to chose another Wifi Accesspoint :confused: (had to change Routers)

I can confirm its working well with a Ubiquiti Unifi AC access point coupled with a Edgerouter-X router.
The Unifi AP also works well with HA for presence detection.
I highly recommend these devices - might be a bit of a learning curve for some people to configure, but amazing value.

1 Like

@1337hium good idea! It works after I reset my router.
Thanks a lot!

Isn’t the motion sensor behaviour the same as the magnet sensor? It sends a “motion” message and a “no_motion” 1 minute after, right?

What for “special” things did you change or setup on your router to make it work?

Nothing for the xiaomi - it just worked.
But in general my router and AP combination is a little more complex to configure than a typical wifi router provided by an ISP. e.g. the Unifi AP needs a separate controller (java application) running in order to manage it (although I think you can now manage APs via a iOS app).