Xiaomi Gateway Integration

Daniel merged the feature a few minutes ago. Give it a try! :slight_smile:

I guess I was mistaken.

Also I wasnt sure how to suggest it on github so ill do it here, for the part where you get the SID and Key instead of linking to the other website that is all in chinese you could have something like this instead, I only thought this might be better as it took me a little while to figure everything out and what the SID vs Key actually was.

Your SID is your mac address without the colons (:) and your key is obtained from inside the xiaomi app, make sure the firmware is up-to-date and follow these steps.

1. Open the Mi Home App
2. Open the side menu and make sure list view is selected.
3. Click on the gateway you wish to obtain the key for.
4. In the top right there are three dots click that button.
5. Click about
6. Tap on the version number a few times until a new menu options appear.
7. Click on the local area network communication protocol.
8. Turn on the local area network communication protocol and make a note of the password (this is the key that you need)

Hey Guys,
I often have a bug where Home assistant starts and fails to find the gateway and throws the below 2 errors.
My fix for this is to restart my raspberry pi (hassbian), restart my router then restart my pi again - this fixes it maybe 60% of the time. My router is as Asus ac88u if that matters.

Has anyone experienced anything similar? Anyone know what the cause might be?

2017-07-07 08:10:06 ERROR (Thread-11) [homeassistant.components.xiaomi] No gateway discovered 2017-07-07 08:10:06 ERROR (MainThread) [homeassistant.setup] Setup failed for xiaomi: Component failed to initialize

Hi Fletch,

This used to happen to me. Since I changed my router, never happened again.
The previous router was Ok, but apparently, this behavior seems to occur with some.

T

1 Like

I bought the new Xiaomi pir sensor (with light sensor included), it will arrive in 1 month, hope by then is included in this component.

At 11 euro is cheaper then the Bruh diy sensor

So the aqara sensors only depend on Xiaomi firmware release?

I just bought 3 an hour ago. Will arrive worst case 2 weeks. :stuck_out_tongue:

Nope…it depends on both Xiaomi (for exposing the sensor for 3rd party apps) as well as @Danielhiversen or @rave (for the Xiaomi component in HA).

This is what the feedback of the unsupported devices looks like:

2017-07-07 18:31:57 DEBUG (Thread-9) [custom_components.xiaomi] >> b'{"cmd":"read","sid":"158d00017202ba"}'
2017-07-07 18:31:57 DEBUG (Thread-9) [custom_components.xiaomi] << {'model': '', 'data': '{"voltage":3055}', 'cmd': 'read_ack', 'short_id': 27539, 'sid': '158d00017202ba'}

In my case it’s a temperature/humidity sensor. I’ve mapped the model “empty-string” to sensor_ht without success. The gateway does not provide any data at protocol version 1.0.7. If a new gateway firmware is available I will check it again for temperature/humidity sensor (square), window/door sensor (square) and the wireless button (square).

And new pir sensor, the only new object (why buy the Aqara sensor if they are exactly the same function as the old ones

Guys,

no one here start the alarm via HA? only me want to make it?

Thank you for great component. Received starter kit yesterday and was able to run it without any issues using @Danielhiversen fork. One thing which probably makes sense to add to readme: when you’re using ios device to get gateway password, it doesn’t have version number, but you still need to tap 5 times at the bottom of the screen (where version is supposed to be :slight_smile: ).
In addition, I wrote simple AppDaemon app for switch automation, if anyone interested it’s here. You can configure it in a following way

Hallway Switch: 
  class: XiaomiSwitch
  module: xiaomi_switch
  switch: binary_sensor.switch_xx
  single: 
    - group.hallway_lights
  timeout_s: 120
  double: 
    - group.living_room_lights
  timeout_d: 0
  hold: 
    - group.kitchen_lights
  timeout_h: 0
2 Likes

What do you mean by “start alarm via HA”? The button of the gateway is not supported in HA. The internal arm/disarm function of the gateway cannot be used, too. You can use a input_boolean to arm and disarm a home assistant automation. The input_boolean can be toggled by a wireless button f.e. The automation tracks the state of your windows or motion sensors. If the state change and the input_boolean is on you can play some ringtone. This is your goal?

I like the form factor of the new devices and the challenge to make it work. :wink:

If you like challenges you can come to my house, there are a lot of things to fix :grinning:

2 Likes

They are not quite the same with the only exception of the door/window sensor.

The new Temp/Hum sensor now also has Pressure. As for the new Wireless button, it is now 1-click, 2-clicks, 3-clicks & 4-clicks.

2 Likes

Great news!

1 Like

I saw from the Mi Home app the new Leak sensor. Wondering why it is not available in Gearbest or Banggood. Anyone seen it for sale?

well then is definetely an improvement

Yes!! This is my goal, to arm/disarm wen i’m out from home to get alarm if any one enter to my home.

I thought i could set the button to click twice and arm the gateway .

what next? how can i make the alarm arm via home assistant and not go to the button every time?

Big Thanks!