Xiaomi Gateway Integration

I had not noticed yet, but maybe this includes the API for the new Aqara sensors…

I checked yesterday and there was nothing, nice :slight_smile:
Let’s see if the new sensors are supported now.

Can confirm new update available to download and install

The temperature sensor and the switch are showing up:

2017-07-17 09:28:55 DEBUG (Thread-11) [custom_components.xiaomi] << {‘model’: ‘weather.v1’, ‘sid’: ‘158d0001a21e25’, ‘cmd’: ‘read_ack’, ‘data’: ‘{“voltage”:3035,“temperature”:“2486”,“humidity”:“5110”,“pressure”:“0”}’, ‘short_id’: 53066}
2017-07-17 09:28:55 ERROR (Thread-11) [custom_components.xiaomi] Unsupported devices : weather.v1
2017-07-17 09:28:55 DEBUG (Thread-11) [custom_components.xiaomi] >> b’{“cmd”:“read”,“sid”:“158d0001a67341”}’
2017-07-17 09:28:55 DEBUG (Thread-11) [custom_components.xiaomi] << {‘model’: ‘sensor_switch.aq2’, ‘sid’: ‘158d0001a67341’, ‘cmd’: ‘read_ack’, ‘data’: ‘{“voltage”:3115}’, ‘short_id’: 41894}
2017-07-17 09:28:55 ERROR (Thread-11) [custom_components.xiaomi] Unsupported devices : sensor_switch.aq2

2017-07-17 09:28:55 DEBUG (Thread-11) [custom_components.xiaomi] << {‘model’: ‘weather.v1’, ‘sid’: ‘158d0001a21e25’, ‘cmd’: ‘read_ack’, ‘data’: ‘{“voltage”:3035,“temperature”:“2486”,“humidity”:“5110”,“pressure”:“0”}’, ‘short_id’: 53066}

Just need support now.

2 Likes

I have 3 Square square switches. One was added before the update… It’s in English… The other two were just added now and appear in Chinese :stuck_out_tongue:

Also… This looks promising:

2017-07-17 18:45:26 DEBUG (Thread-25) [custom_components.xiaomi] MCAST (report) << {'cmd': 'report', 'model': 'sensor_switch.aq2', 'sid': '158d000123df04', 'short_id': 11905, 'data': '{"status":"click"}'}
1 Like

It’s funny, I added mine before the upgrade and it doesn’t show up on my list on the Mii home app :frowning: but looks like it has been added to the gateway as it shows up as unsupported on the HA logs.

Yeay! I have added the device support for sensor_switch.aq2 and weather.v1.

https://github.com/Danielhiversen/homeassistant/pull/22

2 Likes

Nice one, syssi, thanks a lot!

Can you do me a favour? Please push the button three and four times and post the associated events. Thanks! :slight_smile:

@mihalski I also have the new square switch here is the corresponding clicks

Single
{"cmd":"report","model":"sensor_switch.aq2","sid":"158d000124xxxx","short_id":5872,"data":"{\"status\":\"click\"}"}

Double
{"cmd":"report","model":"sensor_switch.aq2","sid":"158d000124xxxx","short_id":5872,"data":"{\"status\":\"double_click\"}"}

Looks like it only supports double and single clicks. Tried long press and I did not get a response.

1 Like

And the pair button as well:

2017-07-17 10:08:48 DEBUG (Thread-14) [custom_components.xiaomi] MCAST (report) << {‘sid’: ‘158d0001a67341’, ‘data’: ‘{“status”:“iam”}’, ‘cmd’: ‘report’, ‘short_id’: 20401, ‘model’: ‘sensor_switch.aq2’}
2017-07-17 10:08:48 DEBUG (Thread-14) [custom_components.xiaomi] MCAST (heartbeat) << {‘sid’: ‘158d0001a67341’, ‘data’: ‘{“voltage”:3115}’, ‘cmd’: ‘heartbeat’, ‘short_id’: 20401, ‘model’: ‘sensor_switch.aq2’}

I seem to be getting:

2017-07-17 19:04:24 ERROR (SyncWorker_19) [custom_components.xiaomi] Unsupported devices : sensor_switch.aq2
2017-07-17 19:04:24 ERROR (SyncWorker_19) [custom_components.xiaomi] Unsupported devices : sensor_switch.aq2
2017-07-17 19:04:24 ERROR (SyncWorker_19) [custom_components.xiaomi] Unsupported devices : sensor_switch.aq2

Trying to work out if I messed up somehow with the installation of the updated files.

Check out Daniels GitHub and add the pull request. I have tested it and the square switch now works in home assistant. I love how quick this community is at getting new functions to work.

https://github.com/Danielhiversen/homeassistant/pull/22/files

OK. Fixed.

But how do I get debug info for ONLY the xiaomi component? I just tried:

logger:
  default: error
  logs:
    custom_components.xiaomi: debug

But it didn’t work.

I’ve got the buttons showing up but they don’t respond to a hold (i.e. should turn on when held).

Also I noticed that if you hold for a LONG time the light starts to flash… Don’t know if that’s an additional event.

OK… For some reason after I restarted after configuring the devices with names and all the logging worked (without me having changed it).

Triple click usually shows as double click:

2017-07-17 19:59:11 DEBUG (Thread-3) [custom_components.xiaomi] MCAST (report) << {'cmd': 'report', 'model': 'sensor_switch.aq2', 'sid': '158d000123def4', 'short_id': 1737, 'data': '{"status":"double_click"}'}
2017-07-17 19:59:11 DEBUG (SyncWorker_12) [custom_components.xiaomi] PUSH >> <Entity Switch_158d000123def4: off>: {'status': 'double_click'}

And so does quadruple click:

2017-07-17 19:59:51 DEBUG (Thread-3) [custom_components.xiaomi] MCAST (report) << {'cmd': 'report', 'model': 'sensor_switch.aq2', 'sid': '158d000123def4', 'short_id': 1737, 'data': '{"status":"double_click"}'}
2017-07-17 19:59:51 DEBUG (SyncWorker_15) [custom_components.xiaomi] PUSH >> <Entity Switch_158d000123def4: off>: {'status': 'double_click'}

Also hold comes across as a click:

2017-07-17 20:02:17 DEBUG (Thread-3) [custom_components.xiaomi] MCAST (report) << {'cmd': 'report', 'model': 'sensor_switch.aq2', 'sid': '158d000123def4', 'short_id': 1737, 'data': '{"status":"click"}'}
2017-07-17 20:02:17 DEBUG (SyncWorker_10) [custom_components.xiaomi] PUSH >> <Entity Switch_158d000123def4: off>: {'status': 'click'}

So these seem to be WORSE feature wise than the old round buttons. Unless this is something that a firmware update will fix.

I will add support for the new door window sensor tonight.

Does anyone know for sure what do these volume settings actually control:

I’d like to have the possibility of having ringtones played from HASS, but make sure the chinese lady would be quiet…

Has anyone tried it before, before I try to do it myself?

The new gateway firmware reports always a pressure of 0. If the gateway reports other values some day the sensor will show the measurement.

Can somebody post the events of a new motion sensor? Thanks! :slight_smile: