Convert payload byte1 to int

This commit is contained in:
Nico Schottelius 2016-11-12 17:52:29 +01:00
parent f20630564d
commit a9f0b0dea2

View file

@ -26,7 +26,7 @@ known_devices = [ "0018B20000000C58", "0018B20000000C37", "0018B20000000C59", "0
def get_gps(deveui, payload): def get_gps(deveui, payload):
res = [] res = []
if not payload[0] & (2**7): if not int(payload[0:2], 16) & (2**7):
return res return res
lat_deg = float(payload[4:6]) lat_deg = float(payload[4:6])
@ -49,7 +49,8 @@ def get_gps(deveui, payload):
def get_temp(deveui, payload): def get_temp(deveui, payload):
res = [] res = []
if payload[0] & (2**7):
if int(payload[0:2], 16) & (2**7):
res = [ deveui + ":temperature=" + str(binascii.a2b_hex(payload)[1])] res = [ deveui + ":temperature=" + str(binascii.a2b_hex(payload)[1])]
return res return res