brendan-w / python-OBD

OBD-II serial module for reading engine data
GNU General Public License v2.0
1.02k stars 360 forks source link

Passing Through Raw Vehicle Response Info In Custom Commands #259

Open peszaber opened 1 year ago

peszaber commented 1 year ago

I'm currently trying to request some non-standard OBD Modes/Service IDs using the Custom Command feature, the "OBDCommand" object.

I'd like to be able to get the response back I get from the vehicle without any sort of decoding, however this does not seem to be possible. Using a decoder function within the OBDCommand object that just returns the same input, the only output I get when I query the custom command is "<obd.OBDResponse.OBDResponse at 0x1fc7ac58130>", which I assume is just the memory address of the object. However, if I enable debugging I can see that I am actually able to see the byte array response from the vehicle, but since this is not a part of the actual output I am unable to manipulate it further.

csurf commented 12 months ago

what you're looking for is the 'message' attribute for that response object that's returned by your custom command:

r = obd.query(my_custom_command)
print(r.message) # <--- your raw, un-decoded data should be here