You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Added check_voltage optional argument that is `True` by default and when
set to `False` disables the detection of the car supply voltage on OBDII
port (which should be about 12V). This control assumes that, if the
voltage is lower than 6V, the OBDII port is disconnected from the car.
If the option is enabled, it adds the `OBDStatus.OBD_CONNECTED` status,
which is set when enough voltage is returned (socket connected to the
car) but the ignition is off (no communication with the vehicle).
Setting the option to `False` should be needed when the adapter does not
support the voltage pin or more generally when the hardware provides
unreliable results, or if the pin reads the switched ignition voltage
rather than the battery positive (this depends on the car).
`portstr`: The UNIX device file or Windows COM Port for your adapter. The default value (`None`) will auto select a port.
26
26
@@ -37,6 +37,8 @@ Disabling fast mode will guarantee that python-OBD outputs the unaltered command
37
37
38
38
`timeout`: Specifies the connection timeout in seconds.
39
39
40
+
`check_voltage`: Optional argument that is `True` by default and when set to `False` disables the detection of the car supply voltage on OBDII port (which should be about 12V). This control assumes that, if the voltage is lower than 6V, the OBDII port is disconnected from the car. If the option is enabled, it adds the `OBDStatus.OBD_CONNECTED` status, which is set when enough voltage is returned (socket connected to the car) but the ignition is off (no communication with the vehicle). Setting the option to `False` should be needed when the adapter does not support the voltage pin or more generally when the hardware provides unreliable results, or if the pin reads the switched ignition voltage rather than the battery positive (this depends on the car).
41
+
40
42
<br>
41
43
42
44
---
@@ -58,7 +60,7 @@ r = connection.query(obd.commands.RPM) # returns the response from the car
58
60
59
61
### status()
60
62
61
-
Returns a string value reflecting the status of the connection. These values should be compared against the `OBDStatus` class. The fact that they are strings is for human readability only. There are currently 3 possible states:
63
+
Returns a string value reflecting the status of the connection after OBD() or Async() methods are executed. These values should be compared against the `OBDStatus` class. The fact that they are strings is for human readability only. There are currently 4 possible states:
# successful communication with the ELM327 adapter
70
72
OBDStatus.ELM_CONNECTED# "ELM Connected"
71
73
72
-
# successful communication with the ELM327 and the vehicle
74
+
# successful communication with the ELM327 adapter,
75
+
# OBD port connected to the car, ignition off
76
+
# (not available with argument "check_voltage=False")
77
+
OBDStatus.OBD_CONNECTED# "OBD Connected"
78
+
79
+
# successful communication with the ELM327 and the
80
+
# vehicle; ignition on
73
81
OBDStatus.CAR_CONNECTED# "Car Connected"
74
82
```
75
83
76
-
The middle state, `ELM_CONNECTED` is mostly for diagnosing errors. When a proper connection is established, you will never encounter this value.
84
+
The status is set by `OBD()` or `Async()` methods and remains unmodified during the connection. `status()` shall not be checked after the queries to verify that the connection is kept active.
85
+
86
+
`ELM_CONNECTED` and `OBD_CONNECTED` are mostly for diagnosing errors. When a proper connection is established with the vehicle, you will never encounter these values.
87
+
88
+
The ELM327 controller allows OBD Commands and AT Commands. In general, OBD Commands (which interact with the car) can be succesfully performed when the ignition is on, while AT Commands (which generally interact with the ELM327 controller) are always accepted. As the connection phase (for both `OBD` and `Async` objects) also performs OBD protocol commands (after the initial set of AT Commands) and returns the “Car Connected” status (“CAR_CONNECTED”) if the overall connection phase is successful, this status means that the serial communication is valid, that the ELM327 adapter is appropriately responding, that the OBDII socket is connected to the car and also that the ignition is on. “OBD Connected” status (“OBD_CONNECTED”) is returned when the OBDII socket is connected and the ignition is off, while the "ELM Connected" status (“ELM_CONNECTED”) means that the ELM327 processor is reached but the OBDII socket is not connected to the car. “OBD Connected” is controlled by the `check_voltage` option that by default is set to `True` and gets the ignition status when the socket is connected. If the OBDII socket does not support the unswitched battery positive supply, or the OBDII adapter cannot detect it, then the `check_voltage` option should be set to `False`; in such case, the "ELM Connected" status is returned when the socket is not connected or when the ignition is off, with no differentiation.
0 commit comments