From ecb1ed433e62d2c60bb262a6f08d7a1584dab57e Mon Sep 17 00:00:00 2001 From: elric91 Date: Sat, 10 Feb 2018 16:01:50 +0100 Subject: [PATCH] handle negative temperatures bump to 0.1.2 --- pyzigate/attributes_helpers.py | 3 ++- setup.py | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/pyzigate/attributes_helpers.py b/pyzigate/attributes_helpers.py index 5980fc1..a1c9928 100644 --- a/pyzigate/attributes_helpers.py +++ b/pyzigate/attributes_helpers.py @@ -85,7 +85,8 @@ def interpret_attributes(self, msg_data): ZGT_LOG.info(' * Sliding') # Temperature elif cluster_id == b'0402': - temperature = int(hexlify(attribute_data), 16) / 100 + temperature = int.from_bytes(attribute_data, 'big', signed=True) / 100 + #temperature = int(hexlify(attribute_data), 16) / 100 self.set_device_property(device_addr, endpoint, ZGT_TEMPERATURE, temperature) ZGT_LOG.info(' * Measurement: Temperature'), ZGT_LOG.info(' * Value: {} °C'.format(temperature)) diff --git a/setup.py b/setup.py index 0dd9050..636b2ed 100644 --- a/setup.py +++ b/setup.py @@ -3,12 +3,12 @@ setup( name='pyzigate', packages=['pyzigate'], - version='0.1.0', + version='0.1.2', description='Interface library for ZiGate (http://zigate./fr)', author='Frédéric HARS & Vesa YLIKYLÄ', author_email='frederic.hars@gmail.com', url='https://github.com/elric91/ZiGate', - download_url='https://github.com/elric91/ZiGate/archive/v0.1.0-beta.tar.gz', + download_url='https://github.com/elric91/ZiGate/archive/v0.1.2.tar.gz', keywords=['zigate', 'zigbee', 'python3'], classifiers=[ 'Development Status :: 4 - Beta',