BMS Ignition on Ioniq BEV

#1

Hello @plord I finally got some time to try and get your script to work on my Ioniq, and well I figured out how to convert some of the PIDs by using the files over at https://github.com/JejuSoul/OBD-PIDs-for-HKMC-EVs

But I’m having trouble with the BMS Ignition.
When I run my_charge_status.get_driving and the car is on, No matter if in park or in drive, or if I’m charging then I get:
573562e2444aad2d9bf49752fdb6a5ea:
return: 0

When the ignition is off and not charging I get.
-1

So it seems it does not detect when it is charging.
I compared the csv files for Kona and the Ioniq BEV, and they both seem to use the formula {ay:2}

I don’t quite understand what :2 means.
ay seems to translate to the formula bytes_to_int(message.data[53:54])

So I tried to run only that part:
obd.query driving mode=21 pid=01 header=7E4 formula=‘bytes_to_int(message.data[53:54])’ baudrate=500000 protocol=6 verify=false force=true
_type: driving
_stamp: ‘2019-07-13T19:57:47.957937’
value: 1

I then see in the script that you do some calculation:
return (int(salt[‘obd.query’](*args, **kwargs)[‘value’])&4)/4

But I don’t get how (int(1)&4)/4 becomes the above strange output, or how it translates to :2.

Do you perhaps know what goes wrong here?

#2

This is bit 2. For example 26 is encoded in binary as 0001 1010 - bit 2 is zero.

You can do the same by anding with 4 ( 0001 1010 AND 000 0100 = 0000 0000 ) and then divide by 4.