Xiaomi Gateway Integration

I’m curious! :slight_smile:

+1 I’m curious too. (just ordered my second Xiaomi gateway ^^)

@syssi well it seems pretty clear to me that it works on at least those two devices in the link i gave you were somebody has confirmed it working.

The issue on github looks very promising.

I didn’t mention that the motion sensor was stuck on ON since more than a day. Restarting HA didn’t help.
To reset the motion sensor I had to unplug the battery from the sensor.

I also have those dresdensrick but never attached it to the pi or even tried to integrate it in Hass. If someone here has a working setup … would be nice if u would share this

You don’t need, just walk/move in front of it and after 2 minutes it goes back to normal because it sends the “no movement” status back to HA.

Did you get your sensors fixed or find out what the issue was?

I have the same motion sensor bug since i switched to this repo, i will debug further when it appears again.

I am using the dev repo. And hass could not discover my xiaomi gateway.

2017-07-25 08:44:21 WARNING (MainThread) [homeassistant.components.updater] Running on ‘dev’, only analytics will be submitted
2017-07-25 08:44:30 WARNING (MainThread) [homeassistant.setup] Setup of media_player is taking over 10 seconds.
2017-07-25 08:44:32 WARNING (MainThread) [homeassistant.setup] Setup of xiaomi is taking over 10 seconds.
2017-07-25 08:44:37 ERROR (SyncWorker_5) [homeassistant.components.xiaomi] No gateway discovered
2017-07-25 08:44:37 ERROR (MainThread) [homeassistant.setup] Setup failed for xiaomi: Component failed to initialize.

After 3 hours struggling, installed openHAB2. The gateway was found instantly.

Hass is installed in synology docker, openHAB is installed as synology package. Found someone fixed discover issue by using a different router, but openHAB can find it easily. So I think there must be a way to fix it without a new router.
Can anyone help?

I assume the difference of the both setups is the docker environment. If you are able to start HA in an python-virtualenv the discovery will succeed, too.

I checked there code. https://github.com/octa22/org.openhab.binding.xiaomigateway/blob/master/src/main/java/org/openhab/binding/xiaomigateway/internal/XiaomiGatewayBinding.java#L964

They are only discovering the gateway if the sid or key is not provided.
It would be possible to add that to HA too. If someone is interested to do so, a pull request to https://github.com/Danielhiversen/PyXiaomiGateway is welcome.

I think skipping the discovery does not improve the situation. People without a proper discovery will fail a step later: The discovery of devices / reception of sensor events.

Hey Nikopol,
It sounds like the same issue I have, I upgraded from an Asus N56U router to a Asus AC88 and HA and the Xaiomi gateway stopped talking.

My work around is to restart my Pi3 (HA server), once that comes up restart my router, then once thats up restart my Pi3 again. When HA comes up for the 2nd time it finds the gateway but if you restart HA again I have to redo the process. Hopefully this will get you working.

EDIT:
Seriously, since posting this I updated Hassbian and the xaiomi gateway integration components to the latest versions and this seems to now be fixed for me, Awesome!

For everyone having ghost issues: report them to Xiaomi using the feedback thing on the app’s settings! Tell them that you are using the Local Developer API.

Last time I did that they gave me the e-mail of a developer, which after a few firmware updates fixed the issue (but it seems it is not 100% fixed).

1 Like

If you are running in Docker, make sure you use network=host mode

1 Like

a nice beast. How does it work?

I have a netgear r7000, which is ok, but I think has problems with so many IOT using WiFi. You think the AC88 is better for IOT?

I have a problem with the display of the tempeture. Sometimes there are so many numbers :slight_smile: See picture.

Is it posible to at round(x) to the tempeture and sensors on a easy way?
Or must i make for all the sensors a template sensor?

1 Like

Having the same issue. It doesn’t happen at all times and only happens for some of the sensors, not all.

I use template sensors for temperature and humidity

temperature_kitchen:
  entity_id: sensor.temperature_158d0001100xxx
  friendly_name: Kitchen Temp
  value_template: '{{ states.sensor.temperature_158d0001100xxx.state | round(1) }}'
  icon_template: mdi:thermometer
  unit_of_measurement: "°C"
humidity_kitchen:
  entity_id: sensor.humidity_158d0001100xxx
  friendly_name: Kitchen Humidity
  value_template: '{{ states.sensor.humidity_158d0001100xxx.state | round(1) }}'
  icon_template: mdi:water
  unit_of_measurement: "%H"
1 Like