I'm creating a program in Python 3.5.3 on my Raspberry Pi 3 B+ to interface with my car's OBDII port. The connection is established over Bluetooth correctly, the data reads correctly when the Python-OBD library is used as intended, but unfortunately when this library was made, it automatically adds a unit to the end with the Pint library.
I'm trying to convert responses that look like this:
1689.34 rotations per minute
To just the float part:
1689.34
So I can compare them over time to each other.
The error I'm getting is as follows:
TypeError: int() argument must be a string, a bytes-like object, or a number, not 'OBDresponse'
My code I tried was:
rpm1 = connection.query(rpm_sensor)
int(rpm1)
Any ideas to help with this?
OBDResponseobject. Have you checked its documentation?reponse.valueto get the value, and if it's a string, you'd just need to cut the number from the rest of the text. I think you're going to need to give more information though.rpm1.valuegive?