You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have tried to use the script with my own PT8005 device for sound meter monitoring however I get the following output error:
root@raspberrypi:/pt8005# ./pt8005_influx.py
Connecting to serial port ...
Connecting to InfluxDB ...
Reading data from PeakTech 8005 ...
Traceback (most recent call last):
File "./pt8005_influx.py", line 140, in
main()
File "./pt8005_influx.py", line 135, in main
value = pt.stream() # Read from serialport
File "./pt8005_influx.py", line 89, in stream
value = (part1*10)+int(part2.hex())+(int(part3.hex())/10)
ValueError: invalid literal for int() with base 10: '0c'
I have printed variables part1, part2 and part3:
3
b'\x05'
b'\x08'
The text was updated successfully, but these errors were encountered:
Python 3.6.9 (default, Dec 8 2021, 21:08:43)
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> part1 = 3
>>> part2 = b'\x05'
>>> part3 = b'\x08'
>>> type(part3)
<class 'bytes'>
>>> value = (part1*10)+int(part2.hex())+(int(part3.hex())/10)
>>> value
35.8
I have tried to use the script with my own PT8005 device for sound meter monitoring however I get the following output error:
root@raspberrypi:/pt8005# ./pt8005_influx.py
Connecting to serial port ...
Connecting to InfluxDB ...
Reading data from PeakTech 8005 ...
Traceback (most recent call last):
File "./pt8005_influx.py", line 140, in
main()
File "./pt8005_influx.py", line 135, in main
value = pt.stream() # Read from serialport
File "./pt8005_influx.py", line 89, in stream
value = (part1*10)+int(part2.hex())+(int(part3.hex())/10)
ValueError: invalid literal for int() with base 10: '0c'
I have printed variables part1, part2 and part3:
3
b'\x05'
b'\x08'
The text was updated successfully, but these errors were encountered: