Xiaomi Gateway Integration

before I had only your component and was not working. Then I put the yeelight and is not working 50% and buggy. Then I disabled your component, but same issue. SO no conflict between the two

Works great! Thank you so much. All my sensors and switches now works with HASS. There is no cheaper sensors than xiaomi.

That is true :slight_smile:

1 Like

Looking forward for implement the Magic Cube:)

Me too. Can’t wait to get my hands on the cube and another gateway.

hello there, I am using this plugin with yeelights and mi smart switch and the long and double click are not working does my syntax looks correct ? (single click is working)

  - alias: Turn on bedroom Lights when click
    trigger:
      platform: event
      event_type: click
      event_data:
          entity_id: binary_sensor.switch_158d000xxxxxx
          click_type: single
    action:
      service: light.toggle
      entity_id: light.chambre, light.yeelumi

  - alias: Turn on bedroom Lights scene doux on double click
    trigger:
      platform: event
      event_type: click
      event_data:
          entity_id: binary_sensor.switch_158dxxxxxxxxx
          click_type: double
    action:
      service: scene.turn_on
      entity_id: scene.chambre_doux

  - alias: Turn on bedroom Lights scene normal on hold
    trigger:
      platform: event
      event_type: click
      event_data:
          entity_id: binary_sensor.switch_158dxxxxxxxx
          click_type: hold
    action:
      service: scene.turn_on
      entity_id: scene.chambre_normal

Claudio, use this code: https://github.com/mxtra/yeelight-ha for Yeelights.

Works flawlessly for me.

Yeah the inbuilt Yeelight component doesnt work for white bulbs. Mxtras github gives instructions for download/install.

this Mxtras code works very well so far. Thanks!

Is not true.
You can by more cheaper,if you going to 433mhz sensors, and there a lot.
Pir,gas,doorbell,door/windows,smoke etc etc.look on aliexpress.

Don’t see any problem with the code. Did you see the event being sent in the developer tool?

I cant check right now since Im at( work and can’t activate the switch.
on a side note since upgrading the plugin and homeassistant to latest version, the binary sensors are inverted, for example motion sensors show off state when activated and on when there is no presence

yupo since updating homeassistant setuptools component motion sensors states are inverted

Hi I put a wrong key, for testing, and the errors are the same.

BTW you put the key between ’ or without?

you put it without ’

tried it both ways, stil the same error

16-12-29 15:16:54 homeassistant.bootstrap: Setting up xiaomi
16-12-29 15:16:54 custom_components.xiaomi: Discovering Xiaomi Gateways
16-12-29 15:16:54 custom_components.xiaomi: Gateway found on IP 192.168.1.215
16-12-29 15:16:54 custom_components.xiaomi: Creating Multicast Socket
16-12-29 15:16:54 custom_components.xiaomi: Listening
16-12-29 15:16:54 custom_components.xiaomi: Discovering Xiaomi Devices
16-12-29 15:16:54 custom_components.xiaomi: Response does not match return cmd
16-12-29 15:16:54 homeassistant.bootstrap: Error during setup of component xiaomi
Traceback (most recent call last):
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/homeassistant/bootstrap.py", line 151, in _async_setup_component
    None, component.setup, hass, config)
  File "/usr/lib/python3.4/asyncio/futures.py", line 388, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.4/asyncio/tasks.py", line 286, in _wakeup
    value = future.result()
  File "/usr/lib/python3.4/asyncio/futures.py", line 277, in result
    raise self._exception
  File "/usr/lib/python3.4/concurrent/futures/thread.py", line 54, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/hass/.homeassistant/custom_components/xiaomi.py", line 44, in setup
    XIAOMI_HUB = XiaomiHub(key)
  File "/home/hass/.homeassistant/custom_components/xiaomi.py", line 113, in __init__
    self._discover_devices()
  File "/home/hass/.homeassistant/custom_components/xiaomi.py", line 119, in _discover_devices
    self.GATEWAY_TOKEN = resp["token"]
TypeError: 'NoneType' object is not subscriptable
16-12-29 15:16:54 homeassistant.loader: Loaded device_tracker.bluetooth_tracker from homeassistant.components.device_tracker.bluetooth_tracker
16-12-29 15:16:54 homeassistant.core: Bus:Handling <Event call_service[L]: service=create, domain=persistent_notification, service_data=message=The following components and platforms could not be set up:
* [xiaomi](https://home-assistant.io/components/xiaomi/)
Please check your config, notification_id=invalid_config, title=Invalid config, service_call_id=1977962544-7>
16-12-29 15:16:54 homeassistant.core: Bus:Handling <Event state_changed[L]: old_state=None, new_state=<state persistent_notification.invalid_config=The following components and platforms could not be set up:
* [xiaomi](https://home-assistant.io/components/xiaomi/)
Please check your config; title=Invalid config @ 2016-12-29T15:16:54.345231+01:00>, entity_id=persistent_notification.invalid_config>

do you have a V1 gateway ?

@rave - great job btw

I can say everything is working. Its just that if the sensors and gateway are far , things tend to act a bit wonky

Bought the aqara switch , can’t be fitted at my house , need to do some work to fit the thing in. So far no issues with HA and Xioami

1 Like

how to check which version I have?

in some half chinese settings I have
hw_ver: MW300, model: lumi.gateway.v3

Does it have a radio , in mi home application . If you see Chinese Radio - congrats you are on V2 , otherwise you are on V1