diff --git a/pycirculate/anova.py b/pycirculate/anova.py index 3d39c25..8540416 100644 --- a/pycirculate/anova.py +++ b/pycirculate/anova.py @@ -1,5 +1,6 @@ from bluepy import btle import datetime +import sys class AnovaDelegate(btle.DefaultDelegate): """ @@ -59,7 +60,11 @@ def close(self): def _send_command(self, command): command = "{0}\r".format(command) - self.characteristic.write(command) + if sys.version_info[0] < 3: + self.characteristic.write(command) + else: + self.characteristic.write(bytes(command, 'UTF-8')) + def _read(self): #self.characteristic.read() @@ -71,7 +76,10 @@ def _read(self): def send_command_async(self, command): self._send_command(command) _, output = self._read() - return output.strip() + if sys.version_info[0] < 3: + return output.strip() + return output.strip().decode('UTF-8') + ##### Temperature commands @@ -248,8 +256,4 @@ def set_date(self, date=None): if not date: date = datetime.datetime.now() command = "set date {}".format(date.strftime("%y %m %d %H %M")) - return self.send_command_async(command) - - - - + return self.send_command_async(command) \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 47a7081..3610c73 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,2 @@ -bluepy==1.0.3 +bluepy==1.1.4 flask==0.10.1