Decode OBD data from ST-902

Bert 5 years ago

I've got the device added to Traccar and I can see some basic attributes (coordinates, ignition etc) but is it possible to get more OBD data (fuel etc)?

All the HEX codes that I see in my logs are binary and therefore unable to be decoded. Have I reached the limit of what I can do with this device in Traccar?

2021-01-06 14:31:02  INFO: [e5bd9a18: huabao > 82.132.246.98] HEX: 7e8001000501917163445400010045020000507e
2021-01-06 14:31:02  INFO: [e5bd9a18] id: 019171634454, time: 2021-01-06 14:31:00, lat: 55, lon: -2, course: 41.0
2021-01-06 14:31:32  INFO: [e5bd9a18: huabao < 82.132.246.98] HEX: 7e020000830191716344540046000000000000000a032e8b4b001db7d400040000002921010622313001040000000fcc143839343431313030363833363937313038363346300117800100810200008202007583010084012885020000860128870200008801008901008a0200008b115756575a5a5a314b5a42573334343338338c04000000008d0200008e0100a000127e

I've found other similar topics on the forums but there doesn't seem to be a resolution.

Anton Tananaev 5 years ago

You can check the decoder class to see what parameters are currently supported.

Bert 5 years ago

Thanks for your reply! Could you possibly link me to some documentation on how to do that?

Bert 5 years ago

Ah you mean the Java class in code for the protocol I'm using ?

Anton Tananaev 5 years ago

Yes, I meant Java class.

Bert 5 years ago

I can't see any reference in that class to the attributes I'm talking about.

When I look at my device in the software provided by the device manufacturer these are the OBD fields I can see. You can also see things like vehicle faults etc.

Is it possible to add these extra attributes? I'm happy to do the work (although I'm not a Java dev) but if you can tell me if it's possible then I can put the time in.

Anton Tananaev 5 years ago

Of course it's possible. Not sure where you looked, but after a brief look I can see that it already supports at least engine load and coolant temperature.

Bert 5 years ago

I looked here but yes sorry you're right it does have those but I'm pretty sure it's missing some things or maybe I just can't read!!

Anyway, so if it supports those things, how come I can't see them as state attributes in the UI?

Anton Tananaev 5 years ago
Bert 5 years ago

Sure, but I didn't search for those, I searched for the first few in the screenshot I sent (engine rotate, battery voltage) and didn't find anything so I assumed the others weren't there. My bad!

For the ones that are there, how can I view them in the traccar UI? According to that Java class I should be able to see engine load etc but I can't.

Anton Tananaev 5 years ago

You should be able to see them in the state panel and in some reports.

If you don't see them, it could be one of the two reasons:

  • Your device doesn't report that information
  • Protocol format is different from what's currently implemented
Bert 5 years ago

I can't see them in the state panel or reports and I'm pretty sure the device does report those things because I could see them in the device manufacturer's software.

If the protocol format is different, what's involved in solving this? As I said before, I'm interested in contributing but it would be useful to have some guidance as a starting point.

Anton Tananaev 5 years ago

You already know which file to change. That's a good starting point. You can add a sample from your device to the unit tests for verification.

I would also recommend you do a manual breakdown of a message to make sure that all the information is there before you start any coding.

Bert 5 years ago

Awesome, thanks! I think I can manage updating the unit tests with my HEX codes and seeing what comes out etc but I'm not sure how to do a manual breakdown of a message. Is the message you're referring to the same thing I linked at the beginning of this topic where the hex decoder couldn't decode because it's binary?

Anton Tananaev 5 years ago

Yes.