Xiaomi Gateway Integration

On my second gateway I always receive this error, but on the Miapp is working everythin fine. And the IP is correct (static IP and checked)

17-02-27 09:38:31 ERROR (Thread-19) [custom_components.xiaomi] Unknown gateway ip 192.168.1.231

THANKS!

Bingo!That’s my fool…

Because I not have a Android phone,so I get the key from a iPhone xiaomi app before,that’s FAKE!

when I use a Android-simulator,and get the key with Android xiaomi app,everything is OK!

1 Like

@rave do you know if there is some tts support planed? would be awesome to use the gateway’s speaker for tts output. Additional the light sensor information would be great in hass, is the api supporting it already?

Hi,

I’m trying to use this logic: https://home-assistant.io/cookbook/turn_on_light_for_10_minutes_when_motion_detected/ with the movement sensors, but for some reason since polling was added those don’t seem to work anymore, after 10 minutes the light turns off and I have to wait a random time between 0-1 minute for the sensor to activate again and the light turns on again for 10 more minutes.
Anyone experiencing the same problem?

Thanks

I had same problem. And solved it like this. Turn on light whet there is movement and then wait for no movement. The timer resets every time there is movement and light stays on.

1 Like

Whatever that’s in the API is already supported by this component. Just need to wait until they release new firmware

1 Like

That message means the gateway has not been added initially into HA during startup. Try restart HA

You can also turn off polling by setting

poll_motion=false

Hi @rave ,

On the documentation:

poll_motion: True # True (Default) or False. If False, motion sensor will be deactivated in 2 minutes. Turn on polling will shorten the time to 1 minute

It’s a bit misleading. So, changing to false will use the Gateway broadcast and changing to true will use the HA pool every minute?
I still don’t really understand the logic from one to another.

Thanks

Yes yes, but it happens all the time

@anon35356645
Try to add discovery_retry: 5 to your config. (You can also try with a higher number)
You can also try to increase the timeout here: https://github.com/lazcad/homeassistant/blob/master/components/xiaomi.py#L135

Changing to False will use gateway broadcast which will only send a “no motion” message after 2 minutes without motion.

Changing to True means it will request motion status from the gateway every 10 seconds when a motion is detected until the gateway reply with a “no motion” message which is 60 seconds

2 Likes

Just fixed the bug. Please try the latest commit

2 Likes

Now if i turn on and off gateway light from mi home it turns it off in HA. And that is ok. But if i turn on light from HA i can’t turn it off from HA or mi home. It can only be turn off from developer tools and set state to off on gateway light. And then i must change brightness in mi home on gateway light to get it working again.

Yeah, there’s still some bug when i tested them again. Working on it now

Edit. Bug fixed again. Hopefully it works this time

Now i get this in log. ERROR (Thread-5) [custom_components.xiaomi] Cannot connect to Gateway, and again if i turn it off from ha can’t turn it on from mi home or wireless switch.

It seems that if i turn light on and off from HA it sets brightness to 0. And it resets color to white in mi home app. I see in mi home app that wireless switch is pressed but because brightness is 0 nothing happens.

Is it possible to readout the humidity of the temperature / humidity sensor as well?

Thanks a lot!

Thorben

That is already supported.

Ok, stupid me…

sensor.temperature_158d00011003XX

–>

sensor.humidity_158d00011003XX

Thank you!