IanHarvey / bluepy

Python interface to Bluetooth LE on Linux
Other
1.59k stars 491 forks source link

Most Thingy52 Gas Sensor readings throw a ValueError #371

Open Zenulous opened 5 years ago

Zenulous commented 5 years ago

Problem

When reading Thingy52 gas telemetry (co2 and tvoc), the script is guaranteed to throw a ValueError eventually because the code does not take into account that these readings may contain hex values. This leads to ValueErrors like the following:

eco2 = int(teptep[:2]) + (int(teptep[2:4]) << 8) ValueError: invalid literal for int() with base 10: '9b'

Solution

Make sure that the code takes into account that the input values are expressed as hex values.