From b22e7c3d28e0dadf07421b1bc752871e79172878 Mon Sep 17 00:00:00 2001 From: Scott Petersen Date: Fri, 27 Mar 2015 12:33:25 -0700 Subject: [PATCH] Correctly decoding byte string. Added future requirement. --- alarmdecoder/decoder.py | 4 +--- requirements.txt | 1 + setup.py | 3 ++- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/alarmdecoder/decoder.py b/alarmdecoder/decoder.py index 66ad156..3365224 100644 --- a/alarmdecoder/decoder.py +++ b/alarmdecoder/decoder.py @@ -303,7 +303,7 @@ class AlarmDecoder(object): :returns: :py:class:`~alarmdecoder.messages.Message` """ - data = str(data) + data = data.decode('utf-8') if data is not None: data = data.lstrip('\0') @@ -314,8 +314,6 @@ class AlarmDecoder(object): msg = None header = data[0:4] - #print('header', header, type(header), type(header[0])) - if header[0] != '!' or header == '!KPM': msg = self._handle_keypad_message(data) diff --git a/requirements.txt b/requirements.txt index 8313187..9bbdf93 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1,2 @@ +future==0.14.3 pyserial==2.7 diff --git a/setup.py b/setup.py index b5e733c..8a436c9 100644 --- a/setup.py +++ b/setup.py @@ -30,7 +30,8 @@ setup(name='alarmdecoder', license='MIT', packages=['alarmdecoder', 'alarmdecoder.event'], install_requires=[ - 'pyserial>=2.7', + 'future==0.14.3' + 'pyserial==2.7', ], test_suite='nose.collector', tests_require=['nose', 'mock'],