Xiaomi Gateway Integration

Wrong mac address?

Is it necessary?
I only got the key.

Worth a try.

Nope.

This was not the solution. I can see all the sensors but not gateway.

Only the key should work.
Make sure the firmware of the gateway not is very old.

My fault. FW update was the solution. Thanks for the heads up.

Hello

I am completely lost trying to understand HA, probably the installation of hass.io has been so simple that I lack basic knowledge, and the examples in documentation apaprently do not do anything remotely useful and every test requires a reboot of the raspberry pi that takes AGES.

Can anyone please post an example that is just one file configuration.yaml (separation in multiple files with includes I understand that is good and necessary for real, complex, installations, but makes very difficult learning for a newbie) that uses a xiaomi gateway and a xiaomi switch and a xiaomi temperature sensor and as few other things as possible? Maybe with some simple functionality, for example, the gateway emits some sound every XX minutes when the temperature is over certain level, and the light in the gateway toggles on/off everytime the switch is pressed. Or something similar to that.

I cannot find examples that are simple, real/tangible and concise, and the documentation in the xiaomi component in https://home-assistant.io/components/ for xiaomi is almost non-existant

Thank you

Hi @pko

This might be helpful, I split my Xiaomi config into a separate package.

2 gateways and a few sensors. The automation switches on the GW light when there is movement.

https://github.com/Data-Monkey/Home-Assistant-Config/blob/master/includes/packages/Xiaomi_Package.yaml

Thank you very much, with your help I could prepare a basic configuration.yaml that with a button toggles the gateway light, only that I had to comment out the “customize” part because it gave me this error:

ERROR (SyncWorker_0) [homeassistant.util.yaml] mapping values are not allowed here
in “/config/configuration.yaml”, line 15, column 20
ERROR (MainThread) [homeassistant.bootstrap] Error loading /config/configuration.yaml: mapping values are not allowed here
in “/config/configuration.yaml”, line 15, column 20

but this configuration works, it simply toggles the gateway light every time the button is press:

 homeassistant:
  name: Mi Casa
  latitude: 40.4168
  longitude: -3.7038
  elevation: 667
  unit_system: metric
  time_zone: Europe/Madrid
#  customize:
#    light.gateway_light_fXXXXXXXXXX0
#	  friendly_name: Luz del gateway
#	binary_sensor.switch_1XXXXXXXXXXXX5
#	  friendly_name: Boton prueba
  

# Enables the frontend
frontend:

# Enables configuration UI
config:

http:
  # Uncomment this to add a password (recommended!)
  # api_password: PASSWORD
  # Uncomment this if you are using SSL/TLS, running in Docker container, etc.
  # base_url: example.duckdns.org:8123

# Checks for available updates
updater:

# Discover some devices automatically
discovery:

# Enables support for tracking state changes over time
history:

# View all events in a logbook
logbook:

xiaomi:
  gateways:
   - mac: XXXXXXXXXXXX
     key: XXXXXXXXXXXXXXXX

sensor:
 

switch:
    

light:
  
# Text to speech
tts:
  - platform: google
    language: 'es'


group: 

automation:
  - alias: Toglea la gateway light
    trigger:
      platform: event
      event_type: click
      event_data:
        entity_id: binary_sensor.switch_1XXXXXXXXXXXX5
        click_type: single
    action:
      service: light.toggle
      entity_id: light.gateway_light_fXXXXXXXXXX0

Hi,

I’ve got an Aqara 2-switch (wireless) and a Aqara 1-switch (wireless)

I can see both as binary sensors but the following is not working:

- alias: xiaomi office
  initial_state: 'on'
  trigger:
    - platform: event
      event_type: click
      event_data:
        entity_id: binary_sensor.wall_switch_left_158d00012a7e68
        click_type: single

  action:
    - service: light.toggle
      entity_id: light.office_light

Can anyone help? :slight_smile:

FW version of GW is 1.4.1_149.0143

1 Like

@MarkR Ah this could be my problem. So just unboxed, upgraded the firmware… added the switches and neither are working double or single wireless versions :frowning:

UPDATE: Right channel on the double switch is working :frowning: damn, hope there is a FW update soon

1 Like

I just got added one door sensor and one power plug but have some connections issues.

The new door sensor is added very close (<1m) to a power plug that have a working connection to the GW. The door sensor and the power plug are at the same distance (~7m) from the GW, but thick walls to the GW.

The new power plug is added 4m from a temperature sensor that have a working connection to the GW. The temp sensor has basically free sight (7-8m) to the GW (sometimes closed door) but works always, The power plug has maybe 9-10m to GW (w thick wall).

I have understood that Zigbee devices can be either “routers” or “end device”, is there any information or knowledge if all Xiaomi devices are routers or if some are end devices? …or why isn’t the mesh feature working here…?

I think this works only on powered devices (not battery operated)

I am waiting for my 2nd hub to arrive for upstairs, where I want to use the switches. I will not be updating the firmware, so I hope I will be ok with it :D:D:D

Let me know how it goes!

@MarkR where you buying from this time?

When updating to the latest HA version I noticed a message some xiaomi components:

/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/cover/
/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/switch/

when I checked I found that they were links to the files I had “Manually installed” before the component became an official HA component, so I removed them. Now on boot I get:

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

    cover.xiaomi
    switch.xiaomi

I guess these files are still referenced somewhere, any ideas?

You mean only powered devices are “routers”.

This was my first theory as well, but then the door sensor should be able to get a connection to the GW thru the closely positioned power plug…

AliExpress they are much slower than gear best, as I ordered some more sensors from gear and they arrived in a week! and signed for (for free). The new gateway from Ali has been over 10 days now

What’s the problem with gearbest?

none, I think they are brilliant, nice fast deliveries.