HA HomeKit初始化失败

在最新版本的HomeAssistant中,有现成的HomeKit组件可以使用,但是在初始化过程中发生错误.

Homekit Component Setup

按照HA官方文档中HomeKit的最简设置方法修改_config.yml文件

# Example for HomeKit setup
homekit:

重启HA后,前台显示Homekit初始化失败,Log中有如下错误:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/app/homeassistant/components/homekit/__init__.py", line 111, in start_driver
    from pyhap.accessory_driver import AccessoryDriver
  File "/usr/local/lib/python3.6/site-packages/pyhap/accessory_driver.py", line 41, in 
    from pyhap.hap_server import HAPServer
  File "/usr/local/lib/python3.6/site-packages/pyhap/hap_server.py", line 19, in 
    from Crypto.Protocol.KDF import HKDF
ImportError: cannot import name 'HKDF'

原因

依赖库PyCrypto(2.6.1)版本旧且安全性较差

解决方法

使用PyCryptodome代替PyCrypto.

$ sudo pip install pycryptodome

重启HA,Homekit加载成功,显示PinCode.

你可能感兴趣的:(HA HomeKit初始化失败)