Hi @syssi, I’ve been using the Xiaomi gateway for a month or two and generally it works fine.
I’m running a few movement sensors etc off it and it was pretty much plug and play.
My only issue is with the Plug aka Socket (Zigbee version). When I try to turn it on/off from Homeassistant, it doesn’t work.
Basically, I just turn the switch on/ff via the interface, and the switch moves and after a few seconds reverts back to the original position.
If I use the MiHome app to turn on/off the switch, I see the switch mode within HA changes accordingly. I also get to see the power utilisation etc as it should. See below.
Here’s the log;
2017-10-28 06:05:41 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/lib/python3.5/asyncio/tasks.py", line 241, in _step
result = coro.throw(exc)
File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/core.py", line 1026, in _event_to_service_call
yield from service_handler.func(service_call)
File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/switch/__init__.py", line 117, in async_handle_switch_service
yield from switch.async_turn_off()
File "/usr/lib/python3.5/asyncio/futures.py", line 380, in __iter__
yield self # This tells Task to wait for completion.
File "/usr/lib/python3.5/asyncio/tasks.py", line 304, in _wakeup
future.result()
File "/usr/lib/python3.5/asyncio/futures.py", line 293, in result
raise self._exception
File "/usr/lib/python3.5/concurrent/futures/thread.py", line 55, in run
result = self.fn(*self.args, **self.kwargs)
File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/switch/xiaomi_aqara.py", line 106, in turn_off
if self._write_to_hub(self._sid, **{self._data_key: 'off'}):
File "/srv/homeassistant/lib/python3.5/site-packages/PyXiaomiGateway/__init__.py", line 290, in write_to_hub
data['key'] = self._get_key()
File "/srv/homeassistant/lib/python3.5/site-packages/PyXiaomiGateway/__init__.py", line 320, in _get_key
encryptor = AES.new(self.key.encode(), AES.MODE_CBC, IV=init_vector)
File "/srv/homeassistant/lib/python3.5/site-packages/Crypto/Cipher/AES.py", line 95, in new
return AESCipher(key, *args, **kwargs)
File "/srv/homeassistant/lib/python3.5/site-packages/Crypto/Cipher/AES.py", line 59, in __init__
blockalgo.BlockAlgo.__init__(self, _AES, key, *args, **kwargs)
File "/srv/homeassistant/lib/python3.5/site-packages/Crypto/Cipher/blockalgo.py", line 141, in __init__
self._cipher = factory.new(key, *args, **kwargs)
ValueError: Key cannot be the null string
Any thoughts?
Thx
JP