User's Guide
Mode 9, PID 2, VIN, is used to report the car's DMV VIN to the attached OBDII device. Since
the rest of the parameters reported by the OBDII ECU task are simulated, and some OBDII
devices may use the VIN for tracking purposes, the reporting of the VIN may be turned off by
setting the privacy flag to "yes". The command is 'config set obd2ecu privacy yes'. Setting it to
'no', which is the default, allows the reporting of the VIN.
Mode 9, PID 10, ECU Name, is statically mapped to report the OVMSv3's Vehicle ID field
(vehicle name, not VIN). This string may be customized to any printable string of up to 20
characters, if not used with the OVMS v2 or v3 mobile phone applications. (‘config set vehicle
id car_name
’)
Metric Scripts
Should one desire to return a value not directly available by a single named metric, it is possible
to map a PID to a short script, where combinations of metrics, constants, etc. may be used to
create a custom value. Note that the restrictions on PID value ranges still applies. Also note
that the special handling for PID 12 (engine RPM) is not applied in the OBDII ECU task, so it
must be included in the script if driving a HUD.
Scripts should be placed in the directory /store/obd2ecu/PID, where PID is the decimal value of
the PID to be processed. Example for creating a "kw per km" sort of metric:
ret1=OvmsMetricFloat("v.p.speed");
ret2=OvmsMetricFloat("v.b.power");
out=0.0;
if (ret1 > 0) { out=ret2/ret1; }
out;
Put this text in a file /store/obd2ecu/4 to map it to the "Engine Load" PID. See "Simple Editor"
chapter for file editing, or use 'vfs append' commands (tedious). Note however, that Vehicle
Power (v.b.power) is not supported on all cars (which is why this is not the default mapping for
this PID).
Warning: The error handling of the scripting engine is very rough at this writing, and will
typically cause a full module reboot if anything goes wrong in a script.
OVMS v3 User Guide Page 77 / 86