Skip to content

Commit

Permalink
Merge pull request #194 from mexon/sample-python-script
Browse files Browse the repository at this point in the history
Fix calculation of 16-bit integers
  • Loading branch information
atc1441 committed Jun 19, 2021
2 parents 618b657 + af37231 commit 0f83187
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions contrib/python/scan-thermometer.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ def parseData(self, val):
return {
'timestamp': datetime.now().astimezone().replace(microsecond=0).isoformat(),
'mac': ":".join(["{:02X}".format(bytes[i]) for i in range(2,8)]),
'temperature': (bytes[8] * 16 + bytes[9]) / 10,
'temperature': (bytes[8] * 256 + bytes[9]) / 10,
'humidity': bytes[10],
'battery_percent': bytes[11],
'battery_volt': (bytes[12] * 16 + bytes[13]) / 1000,
'battery_volt': (bytes[12] * 256 + bytes[13]) / 1000,
'count': bytes[14],
}

Expand Down

0 comments on commit 0f83187

Please sign in to comment.