Hi Daniel,
I’ve done what you kindly suggest me.
Now It seems that I can load the custom component but I’m still unable to use the xiaomi gateway.
Below the error:
17-03-12 00:20:31 INFO (MainThread) [homeassistant.bootstrap] Setting up xiaomi
17-03-12 00:20:31 INFO (Thread-1) [custom_components.xiaomi] Expecting 1 gateways
17-03-12 00:20:31 INFO (Thread-1) [custom_components.xiaomi] Discovering Xiaomi Gateways (Try 1)
17-03-12 00:20:31 INFO (Thread-1) [custom_components.xiaomi] Xiaomi Gateway 286c0788ab7e found at IP 192.168.2.13
17-03-12 00:20:31 INFO (Thread-1) [custom_components.xiaomi] Discovering Xiaomi Devices
17-03-12 00:20:31 DEBUG (Thread-1) [custom_components.xiaomi] >> b'{"cmd" : "get_id_list"}'
17-03-12 00:20:31 DEBUG (Thread-1) [custom_components.xiaomi] << {'data': '["158d000159edf6","158d00015af2d3","158d0001584132","158d00010b2b6b","158d00011c7c9e"]', 'token': 't6sRYEBP8AJy9iwR', 'sid': '286c0788ab7e', 'cmd': 'get_id_list_ack'}
17-03-12 00:20:31 ERROR (MainThread) [homeassistant.bootstrap] Error during setup of component xiaomi
Traceback (most recent call last):
File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/bootstrap.py", line 153, in _async_setup_component
None, component.setup, hass, config)
File "/usr/lib/python3.4/asyncio/futures.py", line 388, in __iter__
yield self # This tells Task to wait for completion.
File "/usr/lib/python3.4/asyncio/tasks.py", line 286, in _wakeup
value = future.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/xiaomi.py", line 77, in setup
PY_XIAOMI_GATEWAY.discover_gateways()
File "/home/homeassistant/.homeassistant/custom_components/xiaomi.py", line 167, in discover_gateways
self.gateways[ip_add] = XiaomiGateway(ip_add, port, sid, gateway_key, self._socket)
File "/home/homeassistant/.homeassistant/custom_components/xiaomi.py", line 262, in __init__
if self._discover_devices():
File "/home/homeassistant/.homeassistant/custom_components/xiaomi.py", line 271, in _discover_devices
self.update_key(resp["token"])
File "/home/homeassistant/.homeassistant/custom_components/xiaomi.py", line 370, in update_key
encryptor = AES.new(self.key.encode(), AES.MODE_CBC, IV=init_vector)
File "/home/homeassistant/.homeassistant/deps/Crypto/Cipher/AES.py", line 95, in new
return AESCipher(key, *args, **kwargs)
File "/home/homeassistant/.homeassistant/deps/Crypto/Cipher/AES.py", line 59, in __init__
blockalgo.BlockAlgo.__init__(self, _AES, key, *args, **kwargs)
File "/home/homeassistant/.homeassistant/deps/Crypto/Cipher/blockalgo.py", line 141, in __init__
self._cipher = factory.new(key, *args, **kwargs)
ValueError: Key cannot be the null string
17-03-12 00:20:31 INFO (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: service_data=title=Invalid config, notification_id=invalid_config, message=The following components and platforms could not be set up:
* [xiaomi](https://home-assistant.io/components/xiaomi/)
Please check your config, service=create, service_call_id=1978650448-1, domain=persistent_notification>
17-03-12 00:20:31 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: new_state=<state persistent_notification.invalid_config=The following components and platforms could not be set up:
* [xiaomi](https://home-assistant.io/components/xiaomi/)
Please check your config; title=Invalid config @ 2017-03-12T00:20:31.697242+01:00>, entity_id=persistent_notification.invalid_config, old_state=None>
Please notice that I’ve added the key from the Mi Home into the configuration.yaml
xiaomi:
gateways:
- sid: Xiaomi Gateway
key: xxxxxxxxxxxxx
Thank you in advance