Xiaomi Gateway Integration

Hi All! Firstly great work to all contributors. Following guide here was able to get my Xiaomi switch, temp/humidity, gateway light, motion sensor & window/door sensor all showing and working. Can see the power plug listed anywhere. Below is ALL output that relates to Xiaomi in HA.

2017-07-18 23:02:49 ERROR (MainThread) [homeassistant.components.switch] Error while setting up platform xiaomi
Traceback (most recent call last):
  File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py", line 164, in _async_setup_platform
SLOW_SETUP_MAX_WAIT, loop=self.hass.loop)
  File "/usr/lib/python3.4/asyncio/tasks.py", line 372, in wait_for
return fut.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/homeassistant/.homeassistant/custom_components/switch/xiaomi.py", line 31, in setup_platform
devices.append(XiaomiGenericSwitch(device, "Plug", 'status', True, gateway))
  File "/home/homeassistant/.homeassistant/custom_components/switch/xiaomi.py", line 53, in __init__
XiaomiDevice.__init__(self, device, name, xiaomi_hub)
  File "/home/homeassistant/.homeassistant/custom_components/xiaomi.py", line 449, in __init__
self.parse_data(device['data'])
  File "/home/homeassistant/.homeassistant/custom_components/switch/xiaomi.py", line 104, in parse_data
self._load_power = int(data[LOAD_POWER])
ValueError: invalid literal for int() with base 10: '8.80'

Power Plug is model ZNCZ02LM

Try to change “/home/homeassistant/.homeassistant/custom_components/switch/xiaomi.py”, line 104 to

self._load_power = float(data[LOAD_POWER])

1 Like

You have power plugs? Do they repeat the Zigbee signal?

I have 1 power plug but it’s disconnected for some time now. Didn’t even know it would repeat the signal.

I’m calling the service to play the lower number ringtones (and it works) but they don’t play as endless loops to me (although I’d like to actually). Am I missing something?

Thanks in advance.

Seeing some strange value from the sensor below. Is that a code defect?

[Update] I think I know why…The new code is subtracting 300 from the value reported by the gateway

if self._data_key in ['illumination']:
    value = value - 300

But the value from the gateway does not range from 300-1300. It does go down to 290 from my log below.

2017-07-18 23:47:21 DEBUG (Thread-8) [homeassistant.components.xiaomi] PUSH >> <Entity Gateway Light_xxxxxxxxxx: on>: {'illumination': 290, 'rgb': 822084711}

1 Like

I had similar issues with my devices (both motion sensors and light sensors would turn on at almost the same time and get stuck). What seemed to solve it was moving my wifi channels to 9 and 11. The far from 6 the better, since that causes more interference with Wifi.
Nevertheless, according to a Xiaomi developer, that should be fixed in the latest firmwares. I think the gateway will report unknown instead of motion when that happens now, but I’m not sure…

What repo are you using?

Hmmm I have my wifi as auto, will try to lock it to a specific and see how it goes. I’m using Daniel’s repo.
Thanks

Well Zigbee systems should have repeater functions by wired devices

Sensor is showing up fine. Tried toggling a light on and off and just does nothing. Just swapped the sensor name in one of my existing automations and it’s not working. Really not sure why.

No! You don’t miss somehting. I was wrong. There are no looping sounds!

It looks like for some people the range starts at 290. cp. https://github.com/Danielhiversen/homeassistant/pull/21

Can you post your automation?

My alarm will not work well… need to think of a solution…

Saw someone was saying his starts from 279. Let me do an experiment tomorrow where i will cover the gateway as well as shine light on it. Will report back the range.

1 Like

where do you get the Gateway mac address? and what are 42.62.0.0/16 and 58.83.0.0/16? are those Chinese server IP address you sniffed going out to from the Xiaomi device? Thank you!!

Not sure if you all have noticed a new sensor on sale! :smiling_imp:

http://www.gearbest.com/home-smart-improvements/pp_668897.html

3 Likes

Nobody else having issues with their gateway not appearing in home assistant today after firmware update???

Gateway SID is a MAC address (SID AABBCCDDEEFF -> MAC AA:BB:CC:DD:EE:FF). 42.62.0.0/16 and 58.83.0.0/16 are the addresses of the Chinese servers with which the gateway attempted to connect.

No. Did you reboot your wifi access point? Is your local network communcation key unchanged? Can you post some log message from home-assistant.log?