I need your help. I have been desperately trying to integrate Xiaomi GW in homeassistant (both latest versions).
I cannot see the GW and I cannot debug because my homeassistant.log does not write events. It is a very small file that was last updated many days ago.
You could take this one Xiaomi gateway not discovered or just create a new one. It will help other users to find a solution without reading the 3000 messages of this thread.
I decrypted the 96 character token using this webpage:
Pasted the token I had into the “Input text” and made sure the Function was AES and Mode ECB. For the key I entered “00000000000000000000000000000000” as @syssi wrote. Make sure you change to HEX before you press Decrypt. You will now have the 32 char Token you need for Xiaomi to work!
But now when starting HASS, I get the following error. Has anyone seen this or can advise how to fix?
2017-09-19 13:21:05 WARNING (Recorder) [homeassistant.components.recorder] Ended unfinished session (id=37 from 2017-09-19 03:11:32.677610)
2017-09-19 13:21:06 ERROR (MainThread) [homeassistant.setup] Error during setup of component xiaomi
Traceback (most recent call last):
File "c:\software\python\python36-32\lib\site-packages\homeassistant\setup.py", line 194, in _async_setup_component
component.setup, hass, processed_config)
File "c:\software\python\python36-32\lib\asyncio\futures.py", line 332, in __iter__
yield self # This tells Task to wait for completion.
File "c:\software\python\python36-32\lib\asyncio\tasks.py", line 250, in _wakeup
future.result()
File "c:\software\python\python36-32\lib\asyncio\futures.py", line 245, in result
raise self._exception
File "c:\software\python\python36-32\lib\concurrent\futures\thread.py", line 55, in run
result = self.fn(*self.args, **self.kwargs)
File "c:\software\python\python36-32\lib\site-packages\homeassistant\components\xiaomi.py", line 64, in setup
from PyXiaomiGateway import PyXiaomiGateway
File "c:\software\python\python36-32\lib\site-packages\pyxiaomigateway-0.3.0-py3.6.egg\PyXiaomiGateway\__init__.py", line 7, in <module>
from Crypto.Cipher import AES
File "c:\software\python\python36-32\lib\site-packages\pycrypto-2.6.1-py3.6-win32.egg\Crypto\Cipher\AES.py", line 50, in <module>
from Crypto.Cipher import _AES
ImportError: DLL load failed: The specified module could not be found.
Still not able to connect to the Xiaomi gateway no matter what I try.
My config is as follows:
xiaomi:
discovery_retry: 5
gateways:
- mac:
key: YG83LTZPNXXXXX (not the real one)
No matter how many discovery retries it doesn’t find it.
I’ve tried turning the network communication protocol on and off
Tried multiple keys, in upper and lower
Tried with and without mac address (with and without : separatos).
Logs:
:[code]e[32m2017-09-19 20:55:49 INFO (SyncWorker_6) [homeassistant.components.xiaomi] Discovering Xiaomi Gateways (Try 5)e[0m
e[32m2017-09-19 20:55:54 INFO (SyncWorker_6) [PyXiaomiGateway] Gateway discovery finished in 5 secondse[0m
e[31m2017-09-19 20:55:54 ERROR (SyncWorker_6) [homeassistant.components.xiaomi] No gateway discoverede[0m
e[32m2017-09-19 20:55:54 INFO (MainThread) [homeassistant.setup] Setup of domain xiaomi took 25.2 seconds.e[0m
e[31m2017-09-19 20:55:54 ERROR (MainThread) [homeassistant.setup] Setup failed for xiaomi: Component failed to initialize.e[0m
e[32m2017-09-19 20:55:54 INFO (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=persistent_notification, service=create, service_data=title=Invalid config, message=The following components and platforms could not be set up:
xiaomi
Please check your config, notification_id=invalid_config, service_call_id=1371799624840-4>e[0m
e[32m2017-09-19 20:55:54 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=persistent_notification.invalid_config, old_state=None, new_state=<state persistent_notification.invalid_config=The following components and platforms could not be set up:
xiaomi
Please check your config; title=Invalid config @ 2017-09-19T20:55:54.082342+12:00>>[/code]
I am running it on a different subnet to the one my PC is on, but it is fully routed. Does the discovery do a broadcast which would be stopped by the router? The app on my android doesn’t have any problem traversing subnet. I wish there was a way of simply specifying the IP address of the gateway rather than having to search for it!
pip install --use-wheel --no-index --find-links=https://github.com/sfbahr/PyCrypto-Wheels/raw/master/pycrypto-2.6.1-cp35-none-win_amd64.whl pycrypto
Collecting pycrypto
Could not find a version that satisfies the requirement pycrypto (from versions: )
No matching distribution found for pycrypto
Guys new update from xiaomi appeared on the app.
Gonna try it latter tonight, and post if the bug was fixed. It was a long wait let’s hope it’s fixed!!
I have detected that after switching off the gateway light via home assistant, the brightness of this light is set to 0 (checked in MiHome app). Then when you try to switch back on via app or via automation, the light reminds off until you raise the brightness again.
Where should I report this issue?
Thanks