Xiaomi Gateway Integration

For some reason I can never get the aqara double switch to actually work with the both press, in the mi home app it registers I press both at the same time, and in the HA interface I see a device for both being pressed at the same time.

Wall Switch (Both)_XXXXXXXX
yet when I use it in automations it never triggers?

- id: 'XXXXXXXXXXX'
  alias: XX
  trigger:
  - event_data:
      click_type: single
      entity_id: binary_sensor.wall_switch_both_XXXXXXXX
    event_type: click
    platform: event

This is very strange. I will setup a second gateway and try to reproduce the issue. Could you disable one of your gateways (by configuration) temporary? Does it “fix” the issue?

Hi,

same issue here:

2017-09-25 09:25:09 ERROR (Thread-3) [PyXiaomiGateway] Got error element in data {“error”:“Invalid key”}
2017-09-25 09:29:47 WARNING (MainThread) [homeassistant.helpers.entity] Update of binary_sensor.motion_sensor_158XXXXXXXXX is taking over 10 seconds
2017-09-25 09:29:47 ERROR (Thread-2) [PyXiaomiGateway] Cannot connect to Gateway
2017-09-25 09:29:47 ERROR (Thread-2) [PyXiaomiGateway] No data in response from hub None
2017-09-25 09:31:00 ERROR (Thread-8) [PyXiaomiGateway] Got error element in data {“error”:“Invalid key”}
2017-09-25 09:31:03 ERROR (Thread-4) [PyXiaomiGateway] Got error element in data {“error”:“Invalid key”}
2017-09-25 09:31:06 ERROR (Thread-8) [PyXiaomiGateway] Got error element in data {“error”:“Invalid key”}

there is some inconsistance as a minute after and before triggering a xiaomi switch with the xiaomi button worked well. Here is my configuration for the xiaomi on configuration.yaml:

# Xiaomi Mi Home Gateway
xiaomi_aqara:
 gateways:
   - mac: XXXXXXXXXXX6
     key: xxxxxxxxxxxxxxw
   - mac: XXXXXXXXXXXE
     key: xxxxxxxxxxxxxx8

Thanks! Will follow on your thread.
I’ve enabled the debug but can’t find anything related to the duplicated component.

no is supposed to change that?

Please study the release notes before upgrading. There was a breaking change. The component is called “xiaomi_aqara” now.

Oh sorry I didn´t read before the update :frowning: my bad. But i do the change and still not working the gateway light the other things are working good.

trigger:
  - platform: event
    event_type: click
    event_data:
      entity_id: binary_sensor.wall_switch_both_158d0001xxxxxx
      click_type: both

That works for me.

1 Like

Thanks I’ve been wondering why my automations were not working.

It looks like the motion detector should support light level, but I don’t see that mentioned in this thread. I poked around the home-assistant source and didn’t see it there either.

Is that simply still to be discovered?

The illumination sensor of the new motion sensor is supported. It should be registered as an additional sensor:

https://github.com/home-assistant/home-assistant/blob/dev/homeassistant/components/sensor/xiaomi_aqara.py#L28-L30

Another thing you could test: With 0.54 a auto-discovery (netdisco) of the gateway via mDNS was introduced. This mechanism is able to load the xiaomi_aqara component without any line of configuration. However the component won’t be able to control devices because the key is missing. Could you disable “discovery:” or blacklist the xiaomi_aqara component for testing?

I have same issue of eBoon and discovery disabled in configuration.yaml:

# Discover some devices automatically
#discovery:

And the issue is still present?

Yes… Sorry I meant: I have the same issue of eBoon and discovery already disabled.

If I can help sending you any log let me know…

Sorry for bothering you again but I noticed that the issue is still present.

The strange thing is that it happens only with a particular sensor which is in a cabinet (which has a window that i also monitor). Do you think is a malfuction or maybe an error?

Thank you

My issue now seems to have mysteriously fixed itself - not sure why but I am no longer seeing the messages and sensors are now working. I believe that this issue is a side-effect of some other problems that I have been seeing with my installation and everything running very slowly on my pi install.

Hi there very good automation that you did there with gateway can you share you git hub so I can have more ideas from xiaomi stuff i don´t see that much conifg fo xiaomi stuff

Hey there,

I am a homeassistant total noob. I used to have a SmartThings setup but decided to go local and have removed everything.

I have setup my Aqara gateway but do not know where to start with automations.

Can someone please provide some help? A sample config would be even better. :slight_smile:
Do I edit the automation.yaml or the configuration.yaml file in order to create automations?

If someone can share some sample code for a simple automation, e.g. if xiaomi door sensor open then play sound from gateway I would be grateful.

Thanks a lot in advance.

@ktsi: Check the docs: https://home-assistant.io/components/binary_sensor.xiaomi_aqara/#automation-examples

1 Like