Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions pycirculate/anova.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from bluepy import btle
import datetime
import sys

class AnovaDelegate(btle.DefaultDelegate):
"""
Expand Down Expand Up @@ -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()
Expand All @@ -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

Expand Down Expand Up @@ -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)
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
bluepy==1.0.3
bluepy==1.1.4
flask==0.10.1