diff --git a/miio/chuangmi_ir.py b/miio/chuangmi_ir.py index b74b6cb6b..ab2a6431a 100644 --- a/miio/chuangmi_ir.py +++ b/miio/chuangmi_ir.py @@ -130,10 +130,10 @@ def play(self, command: str): class ProntoPulseAdapter(Adapter): - def _decode(self, obj, context): + def _decode(self, obj, context, *args, **kwargs): return int(obj * context._.modulation_period) - def _encode(self, obj, context): + def _encode(self, obj, context, *args, **kwargs): raise RuntimeError('Not implemented') diff --git a/miio/protocol.py b/miio/protocol.py index 53f4e1bf2..9d1d862d5 100644 --- a/miio/protocol.py +++ b/miio/protocol.py @@ -130,16 +130,16 @@ def is_hello(x) -> bool: class TimeAdapter(Adapter): """Adapter for timestamp conversion.""" - def _encode(self, obj, context): + def _encode(self, obj, context, *args, **kwargs): return calendar.timegm(obj.timetuple()) - def _decode(self, obj, context): + def _decode(self, obj, context, *args, **kwargs): return datetime.datetime.utcfromtimestamp(obj) class EncryptionAdapter(Adapter): """Adapter to handle communication encryption.""" - def _encode(self, obj, context): + def _encode(self, obj, context, *args, **kwargs): """Encrypt the given payload with the token stored in the context. :param obj: JSON object to encrypt""" @@ -147,7 +147,7 @@ def _encode(self, obj, context): return Utils.encrypt(json.dumps(obj).encode('utf-8') + b'\x00', context['_']['token']) - def _decode(self, obj, context): + def _decode(self, obj, context, *args, **kwargs): """Decrypts the given payload with the token stored in the context. :return str: JSON object""" diff --git a/requirements.txt b/requirements.txt index 63ee1dd5d..7b27ea3de 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,7 @@ click cryptography pretty_cron -construct>=2.9.23 +construct>=2.9.23,<=2.9.30 zeroconf attrs typing # for py3.4 support diff --git a/setup.py b/setup.py index 6f01563f9..dd4e28af0 100644 --- a/setup.py +++ b/setup.py @@ -42,7 +42,7 @@ def readme(): packages=["miio", "mirobo"], python_requires='>=3.4', - install_requires=['construct>=2.9.23', + install_requires=['construct>=2.9.23,<=2.9.30', 'click', 'cryptography', 'pretty_cron',