eschava / broadlink-mqtt

MQTT client to control BroadLink devices
MIT License
222 stars 60 forks source link

Initialization vector must be bytes #43

Closed seanbaker74 closed 5 years ago

seanbaker74 commented 5 years ago

I must be doing something wrong here.

The application starts if I use the default configuration settings, but I get an error "ERROR No Broadlink device found". When I run tcpdump, I don't see any traffic on the interface.

If I change the default settings (for example, local_address = '192.168.15.109', which is the IP address of the machine running broadlink-mqtt), I get the below error:

Traceback (most recent call last): File "mqtt.py", line 419, in <module> devices = get_device(cf) File "mqtt.py", line 272, in get_device broadlink.discover(timeout=lookup_timeout, local_ip_address=local_address) File "/usr/local/lib/python2.7/dist-packages/broadlink/__init__.py", line 136, in discover dev = gendevice(devtype, host, mac) File "/usr/local/lib/python2.7/dist-packages/broadlink/__init__.py", line 61, in gendevice return device_class(host=host, mac=mac, devtype=devtype) File "/usr/local/lib/python2.7/dist-packages/broadlink/__init__.py", line 529, in __init__ device.__init__(self, host, mac, devtype) File "/usr/local/lib/python2.7/dist-packages/broadlink/__init__.py", line 171, in __init__ self.update_aes(key) File "/usr/local/lib/python2.7/dist-packages/broadlink/__init__.py", line 183, in update_aes_crypto self.aes = Cipher(algorithms.AES(key), modes.CBC(self.iv), File "/usr/lib/python2.7/dist-packages/cryptography/hazmat/primitives/ciphers/modes.py", line 92, in __init__ raise TypeError("initialization_vector must be bytes") TypeError: initialization_vector must be bytes

What am I doing wrong?

eschava commented 5 years ago

Please try to update cryptography library using pip install -U cryptography

seanbaker74 commented 5 years ago

That worked, thanks!