Xiaomi Gateway Integration

not sure but try this

    brightness: 254
    rgb_color: [255,106,253]

values inside [ ]

1 Like

Hi! Xiaomi Gateway users,

I have been using Xiaomi Gateway and HASS without any issues. Today, I upgraded HASS to 0.38.1 and the Xiaomi Gateway no longer worked.

In the debug log, the following messages were shown:

17-02-12 22:15:21 INFO (Thread-6) [custom_components.xiaomi] Expecting 1 gateways
17-02-12 22:15:21 INFO (Thread-6) [custom_components.xiaomi] Discovering Xiaomi Gateways (Try 1)
17-02-12 22:15:21 INFO (Thread-6) [custom_components.xiaomi] Xiaomi Gateway 286c0785919f found at IP 192.168.11.172
17-02-12 22:15:21 INFO (Thread-6) [custom_components.xiaomi] Discovering Xiaomi Devices
17-02-12 22:15:21 DEBUG (Thread-6) [custom_components.xiaomi] >> b’{“cmd” : “get_id_list”}’ 17-02-12 22:15:22 DEBUG (Thread-6) [custom_components.xiaomi] << {‘cmd’: ‘get_id_list_ack’, ‘sid’: ‘286c0785919f’, ‘data’: ‘[“158d000156f96f”,“158d000129b181”,“158d00012636f5”,“158d00012f54bc”]’, ‘token’: ‘KgkXAGm337kuP9ld’}

In the Web UI, the following error was shown with all devices gone:

Invalid config
The following components and platforms could not be set up:

xiaomi

Please check your config

Did anyone experience the same? Any advice?

BTW, I am using HASS on Raspberry Pi with manual installation (not virtualenv).

maybe logging in with the xiaomi app?

Is that all the log? Don’t see a problem with the log you posted

Read the Readme.md in the github page

I can use Xiaomi app to control the Gateway and attached devices. Then what?

Yes, that the whole log content related to the Gateway. Seems everything normal.

There’s something even more spooky. I fell back to HASS 0.38 and the Gateway worked again. However, after rebooting RPi, it no longer worked and showed the same error since then. I’m totally confused.

I reinstall HASS from scratch and the Gateway is working again. Sorry for shouting too early.

The sid is the mac address with the separators ( - or : ) stripped out and all lower case.

development mode is dealt with in a number of places, mainly in chinese unfortunately. I found an english version and will post the link if I can find it again.

Hi :slight_smile: Any advice on getting the Gateway Key on Android? Has anyone succeeded with the latest version of MiHome or is there another way? Nothing under device settings > about. Thanks!

https://www.domoticz.com/wiki/Xiaomi_Gateway_(Aqara)

Oh amazing, thank you @nickrout. For others with the same issue - you need to keep tapping the version number for the extra options to appear.

Okay Ghost openings happened again!.. 3 Sensors out of 6 changed to open without action.

The log shows 3 normal PUSH events.

Forget it with the firewall policy change, i mixed the log time a bit :-). I changed it after the events happened.

I’m puzzled, was so happy before i realized that the time settings are different that i have a guilty one.

Okay update, the rest of the sensors changed the state to open too, without action.

17-02-13 08:37:08 DEBUG (Thread-14) [custom_components.xiaomi] MCAST (heartbeat) << {‘cmd’: ‘heartbeat’, ‘short_id’: 30556, ‘sid’: ‘xxx’, ‘data’: ‘{“status”:“open”}’, ‘model’: ‘magnet’}
17-02-13 08:37:08 DEBUG (Thread-5) [custom_components.xiaomi] PUSH >> : {‘status’: ‘open’}
17-02-13 08:42:36 DEBUG (Thread-14) [custom_components.xiaomi] MCAST (heartbeat) << {‘cmd’: ‘heartbeat’, ‘short_id’: 16536, ‘sid’: ‘xxx’, ‘data’: ‘{“status”:“open”}’, ‘model’: ‘magnet’}
17-02-13 08:42:36 DEBUG (Thread-7) [custom_components.xiaomi] PUSH >> : {‘status’: ‘open’}
17-02-13 08:54:41 DEBUG (Thread-14) [custom_components.xiaomi] MCAST (report) << {‘cmd’: ‘report’, ‘short_id’: 30556, ‘sid’: ‘xxx’, ‘data’: ‘{“status”:“open”}’, ‘model’: ‘magnet’}
17-02-13 08:54:41 DEBUG (Thread-5) [custom_components.xiaomi] PUSH >> : {‘status’: ‘open’}

In the MI Home i don’t see the events again. (activated internet connection again and the deny outgoing traffic i set after the events occured)

So… i unplugged the xiaomi gateway and replugged it and the ghost openings happened again across all sensors.

I checked the last log, it was this time without report messages, it was just heartbeat messages from the gateway which were wrong… so i assume the component reacts on both heartbeat and reports. and the faulty messages are from the gateway send as heartbeat. i wrote already xiaomi feedback in the mi home app, but i don’t believe that they will fix it fast enough. Probably we can ignore heartbeat messages for this type of sensors to have a fast workaround?

the power plug is not working right.

If on both HASS and Mi home app is OFF, if you turn it ON from HASS is working. But then from HASS it does not turn off. Opposite is also true

Hi @anon35356645,

Thanks for advice, values with [x,x,x] worked!

There is a script in HA to create a random numbers, to for example, each time that switch xioami gateway has a different color?

thanks

You mean gateway light?

I know the colorloop, check in light
Random

Question: does the remote (wifi) button also work with HASS ?