Skip to content

Commit

Permalink
Fix data decoder Python2 support
Browse files Browse the repository at this point in the history
  • Loading branch information
ttu committed May 3, 2017
1 parent 94e67fb commit fed8b0c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

### [Unreleased]
* Support for Data Format 3 and 4
* Fix data decoder Python2 support

## [0.5.0] - 2017-03-01
* RuuviTagReactive: reactive wrapper and background process for RuuviTagSensor get_datas
Expand Down
4 changes: 3 additions & 1 deletion ruuvitag_sensor/decoder.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import division

import base64
import math

Expand Down Expand Up @@ -121,7 +123,7 @@ def decode_data(self, data):
dict: Sensor values
'''
try:
byte_data = bytes.fromhex(data)
byte_data = bytearray.fromhex(data)
return {
'humidity': self._get_humidity(byte_data),
'temperature': self._get_temperature(byte_data),
Expand Down

0 comments on commit fed8b0c

Please sign in to comment.