Xiaomi Gateway Integration

I was searching a wil but i can’t find the answer. Is it posible to control the light / color of the gateway lamp from home assistant?

Both of my gateways are good.

Yes, my gateway raport illumination between 279-1272. I add PR to fix that https://github.com/Danielhiversen/homeassistant/pull/24

Yes, you can. Click on the lightbulb icon and it will open a panel as below where you can control the light / color.

Yep, rebooted router, nothing changed on network.
logs below, just telling me it can’t find gateway. Working fine on mi app though…

2017-07-18 18:36:14 INFO (Thread-1) [custom_components.xiaomi] Expecting 1 gateways
2017-07-18 18:36:15 INFO (Thread-1) [custom_components.xiaomi] Discovering Xiaomi Gateways (Try 1)
2017-07-18 18:36:20 INFO (Thread-1) [custom_components.xiaomi] Gateway finding finished in 5 seconds
2017-07-18 18:36:20 INFO (Thread-1) [custom_components.xiaomi] Discovering Xiaomi Gateways (Try 2)
2017-07-18 18:36:24 WARNING (MainThread) [homeassistant.setup] Setup of xiaomi is taking over 10 seconds.
2017-07-18 18:36:25 INFO (Thread-1) [custom_components.xiaomi] Gateway finding finished in 5 seconds
2017-07-18 18:36:25 INFO (Thread-1) [custom_components.xiaomi] Discovering Xiaomi Gateways (Try 3)
2017-07-18 18:36:30 INFO (Thread-1) [custom_components.xiaomi] Gateway finding finished in 5 seconds
2017-07-18 18:36:30 ERROR (Thread-1) [custom_components.xiaomi] No gateway discovered
2017-07-18 18:36:30 ERROR (MainThread) [homeassistant.setup] Setup failed for xiaomi: Component failed to initialize.

Occasionally I have stopped home assistant and I removed all

__pycache__

directories from custom_components. Just give it a try. May be I’m paranoid. I don’t know. :wink:

Thanks Skull29, can you share this part of your code that is in the picture. I have not the lightbulb, HA see it like an sensor with a chart.

No joy with that either… :cry:

It is not my code but part of the xiaomi component. You should see something like “light.gateway_light_xxxxxxxxxxxx” in your main page under Lights if I am not mistaken or you can try searching for it in Developer Tools -> States.

sensor.illuminance_f0b4299aaeb4 ? He see it like a sensor haha. That is why i see chart. That is :confused:

That is correct as there is a luminance sensor in the gateway. You should also see the light. If you are not, might be you have not copied all the directories and files properly?

1 Like

Sorry, my fault. I was forget to check or HA install pycrypto automaticly, and he did not. I have install it manually and i have light!
Thanks Skull for your help and quick answer!

1 Like

Glad you found the problem. :wink:

Hi,

yes it’s possible. I have an automation with wireless switch that when i press 1 click switch on white and when i make long press on switch, then turn on blue for example.

alias: Enciende Luz GW Xioami Azul
hide_entity: True
trigger:
  platform: event
  event_type: click
  event_data:
      entity_id:  binary_sensor.switch_158dxxxxxxx
      click_type: hold
action:
   service: light.turn_on
   entity_id: light.gateway_light_f0bxxxxxxx
   data:
     brightness: 255
     rgb_color: [4,26,255]

Just a hint: If you use “long_click_press” instead of “hold” the action is triggered before you release the button. For me it feels better.

4 Likes

Thank you for your answer. I dis not realized that a gateway subdevice coule be detected in HA and not been showed in the MiHome Interface.

It works like a charm !

No luck with playing ringtones :frowning:

When I add the Gateway SID to my configuration.yaml I can’t control the gateway (turn light on and off). But when I don’t have the SID and try to play the ringtone, I get the following error message in the logfile.

2017-07-18 18:30:28 ERROR (Thread-5) [homeassistant.components.xiaomi] Unknown gateway sid: xxxxxxxxxxx was specified.

What am I doing wrong?

Same I did.

Make sure your gateway sid is all specified without : and in lower case. That last bit, did the trick for me.

Thanks for the hint. This works much better, as it allows you to stop holding the button as soon as the action is triggered.

since i switched from rave to daniels repo, i have stucked motion detections randomly :frowning: