### Install py-obdii via pip Source: https://py-obdii.readthedocs.io/en/latest Install the library using pip to get started with vehicle communication. ```bash pip install py-obdii ``` -------------------------------- ### Install ELM327-Emulator Source: https://py-obdii.readthedocs.io/en/latest Install the library with simulation capabilities using the sim extra. ```bash pip install py-obdii[sim] ``` -------------------------------- ### Connect and Query OBDII Data Source: https://py-obdii.readthedocs.io/en/latest Example showing how to scan for available ports, establish a connection, and query both adapter firmware and engine speed. ```python from obdii import Connection, at_commands, commands from obdii.utils.scan import scan_ports # Find first available OBDII device connected via serial ports = scan_ports(return_first=True) if not ports: raise ValueError("No OBDII devices found.") # Connect to the adapter with Connection(ports[0]) as conn: # Query adapter firmware version version = conn.query(at_commands.VERSION_ID) print(f"Version: {version.value}") # Query vehicle's engine speed (rpm) response = conn.query(commands.ENGINE_SPEED) print(f"Engine Speed: {response.value} {response.units}") ``` -------------------------------- ### Template substitution example Source: https://py-obdii.readthedocs.io/en/latest/api/core.html Demonstrates how to define a Template with placeholders and perform substitution using either keyword or positional arguments. ```python t = Template("AT {a:str} {b:int} {c:hex4} {d}") r = t.substitute(a=1, b=2.2, c=3, d="four") # or r = t.substitute(1, 2.2, 3, "four") >>> r "AT 1 2 0003 four" ``` -------------------------------- ### Start ELM327-Emulator Source: https://py-obdii.readthedocs.io/en/latest Run the emulator module. Replace REPLACE_WITH_PORT with the actual serial port identifier. ```bash python -m elm -p "REPLACE_WITH_PORT" -s car --baudrate 38400 ``` -------------------------------- ### SupportedPIDS.__init__ Source: https://py-obdii.readthedocs.io/en/latest/api/parsers.html Initializes a SupportedPIDS object with a base PID. The base PID is the starting point for parsing supported PIDs. ```APIDOC ## SupportedPIDS.__init__ ### Description Initializes a SupportedPIDS object with a base PID. The base PID is the starting point for parsing supported PIDs. ### Method Constructor ### Parameters - **base_pid** (int) - Required - The base PID from which the support bits start. ### Example ```python supported_pids = SupportedPIDS(0x01) ``` ``` -------------------------------- ### Parse supported PIDs with SupportedPIDS Source: https://py-obdii.readthedocs.io/en/latest/api/parsers.html Demonstrates parsing a 4-byte response to identify supported PIDs starting from a base PID. ```python unparsed = [190, 31, 168, 19] # 190 31 168 19 # B E 1 F A 8 1 3 # 1011 1110 0001 1111 1010 1000 0001 0011 supported_pids = SupportedPIDS(0x01) result = supported_pids(unparsed) >>> result [0x01, 0x03, 0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x13, 0x15, 0x1C, 0x1F, 0x20] ``` -------------------------------- ### AT FI - FAST_INIT Source: https://py-obdii.readthedocs.io/en/latest/api/modes/mode_at.html Performs a fast initiation sequence for ISO 14230-4 KWP, requires protocol 5 to be active. ```APIDOC ## AT FI ### Description Performs a fast initiation sequence for ISO 14230-4 KWP, requires protocol 5 to be active. ### Command AT FI ``` -------------------------------- ### Connection.__init__ Source: https://py-obdii.readthedocs.io/en/latest/api/core.html Initializes connection settings and optionally auto-connects to the device. ```APIDOC ## Connection.__init__ ### Description Initializes connection settings and optionally auto-connects to the device. ### Method Constructor ### Parameters - **transport** (str | Tuple[str, str | int] | TransportBase) - Required - Can be a string for serial ports (e.g., "COM5", "/dev/ttyUSB0", "/dev/rfcomm0"), a tuple for network transports (e.g., ("", )), or an instance of a TransportBase subclass. - **protocol** (Protocol) - Optional - The protocol to use for communication. Defaults to Protocol.AUTO. - **auto_connect** (bool) - Optional - If True, connect to the adapter immediately. Defaults to True. - **smart_query** (bool) - Optional - If True, send repeat command when the same command is issued again. Defaults to False. - **early_return** (bool) - Optional - If True, the ELM327 will return immediately after sending the specified number of responses. Works only with ELM327 v1.3 and later. Defaults to False. - **log_handler** (logging.Handler | None) - Optional - Custom log handler for the logger. - **log_formatter** (logging.Formatter) - Optional - Formatter to use with the given log handler. - **log_level** (int) - Optional - Logging level for the logger. - **log_root** (bool) - Optional - Whether to set up the root logger. Defaults to False. - **kwargs** (dict) - Optional - Additional keyword arguments forwarded to the transport's constructor. ### Returns None ``` -------------------------------- ### Connection.__enter__() Source: https://py-obdii.readthedocs.io/en/latest/api/core.html Support usage as a context manager. ```APIDOC ## __enter__() ### Description Support usage as a context manager. ### Returns - Connection: The connection instance itself. ``` -------------------------------- ### Connection.connect Source: https://py-obdii.readthedocs.io/en/latest/api/core.html Establishes a connection to the device using the configured transport and runs the initialization sequence. ```APIDOC ## Connection.connect ### Description Establishes a connection to the device using the configured transport and runs the initialization sequence. ### Method connect ### Parameters - **kwargs** - Optional - Additional keyword arguments forwarded to the transport's connect method. ### Returns None ``` -------------------------------- ### Command.__init__ Source: https://py-obdii.readthedocs.io/en/latest/api/core.html Initializes a Command instance with mode, PID, expected bytes, value ranges, units, and an optional resolver. ```APIDOC ## Command.__init__ ### Description Initializes a Command instance with the specified mode, PID, expected bytes, value ranges, units, and resolver. ### Method Constructor ### Parameters - **mode** (Mode | int | str) - Required - Command mode to be used. - **pid** (Template | int | str) - Required - Command PID (Parameter Identifier) to be used. - **expected_bytes** (int | Iterable[int]) - Optional - The number of bytes expected in the response. Defaults to 0. - **min_values** (int | float | Iterable[int | float] | None) - Optional - Minimum valid values for the command's parameters. - **max_values** (int | float | Iterable[int | float] | None) - Optional - Maximum valid values for the command's parameters. - **units** (str | Iterable[str] | None) - Optional - The units for the command's response. - **resolver** (Callable[[...], T] | None) - Optional - A resolver function for custom response handling. ### Returns None ``` -------------------------------- ### AT IIA {hh} - SET_ISO_INIT_ADDR Source: https://py-obdii.readthedocs.io/en/latest/api/modes/mode_at.html Sets the destination address for the ISO 9141-2 or ISO 14230-4 slow (5 baud) initiation sequence, default is $33. ```APIDOC ## AT IIA {hh} ### Description Sets the destination address for the ISO 9141-2 or ISO 14230-4 slow (5 baud) initiation sequence, default is $33. ### Command AT IIA {hh} ### Parameters - **hh** (hex byte) - Required - Destination address for initiation. ``` -------------------------------- ### ModeAT.PROG_SUMMARY Source: https://py-obdii.readthedocs.io/en/latest/api/modes/mode_at.html Displays a summary of all Programmable Parameters, showing their values and whether they are enabled. ```APIDOC ## ModeAT.PROG_SUMMARY ### Description Display a summary of all Programmable Parameters, showing their values and whether they are enabled. ### Command ModeAT.PROG_SUMMARY ### Usage ```python from obdii.modes import ModeAT ModeAT.PROG_SUMMARY ``` ### Notes - The command is "PPS". ``` -------------------------------- ### AT SI - SLOW_INIT Source: https://py-obdii.readthedocs.io/en/latest/api/modes/mode_at.html Performs a slow initiation sequence for ISO 9141-2 or ISO 14230-4 KWP (5 baud), requires protocol 3 or 4 to be active. ```APIDOC ## AT SI ### Description Perform a slow initiation sequence for ISO 9141-2 or ISO 14230-4 KWP (5 baud), requires protocol 3 or 4 to be active. ### Command AT SI ``` -------------------------------- ### AT KW1 - KEY_WORD_ON Source: https://py-obdii.readthedocs.io/en/latest/api/modes/mode_at.html Enables standard key word checking during initiation sequences (default). ```APIDOC ## AT KW1 ### Description Enable standard key word checking during initiation sequences (default). ### Command AT KW1 ``` -------------------------------- ### Command.build Source: https://py-obdii.readthedocs.io/en/latest/api/core.html Builds the query to be sent to the ELM327 device as a byte string. ```APIDOC ## Command.build ### Description Builds the query to be sent to the ELM327 device as a byte string. The ELM327 is case-insensitive, ignores spaces and all control characters. ### Method build ### Parameters - **early_return** (bool) - Optional - Whether to include the early return digit in the command. If True, appends a hex digit representing the expected number of responses. Defaults to False. ### Returns - **bytes** - The formatted query as a byte string, ready to be sent to the ELM327 device. ### Raises - **ValueError** - If the PID is a Template, meaning the command has likely not been formatted. ``` -------------------------------- ### MultiFormula.__init__ Source: https://py-obdii.readthedocs.io/en/latest/api/parsers.html Initializes a MultiFormula object with multiple expression strings. Variable names are converted to uppercase. ```APIDOC ## MultiFormula.__init__ ### Description Initializes a MultiFormula object with multiple expression strings. Variable names are converted to uppercase. ### Method Constructor ### Parameters - **expressions** (str) - Required - Expression strings to evaluate. ### Example ```python engine_torque = MultiFormula("A-125", "B-125", "C-125", "D-125", "E-125") ``` ``` -------------------------------- ### Command.__call__ Source: https://py-obdii.readthedocs.io/en/latest/api/core.html Formats the command with provided positional or keyword arguments and returns a new Command instance. ```APIDOC ## Command.__call__ ### Description Formats the command with the provided positional or keyword arguments, returning a new Command instance with the formatted PID. ### Method Callable ### Parameters - **args** (Any) - Optional - Positional arguments corresponding to placeholders in the command's PID template. - **kwargs** (Any) - Optional - Keyword arguments corresponding to placeholders in the command's PID template. ### Returns - **Command[T]** - A new Command instance with the formatted PID. ``` -------------------------------- ### ModeAT.PROG_PARAMS_ON Source: https://py-obdii.readthedocs.io/en/latest/api/modes/mode_at.html Enables all Programmable Parameters at the same time. ```APIDOC ## ModeAT.PROG_PARAMS_ON ### Description Enable all Programmable Parameters at the same time. ### Command ModeAT.PROG_PARAMS_ON ### Usage ```python from obdii.modes import ModeAT ModeAT.PROG_PARAMS_ON ``` ### Notes - The command is "PP FF ON". ``` -------------------------------- ### AT IB 10 - SET_BAUDRATE_10400 Source: https://py-obdii.readthedocs.io/en/latest/api/modes/mode_at.html Sets the ISO 9141-2 and ISO 14230-4 baud rate to the default of 10400. ```APIDOC ## AT IB 10 ### Description Sets the ISO 9141-2 and ISO 14230-4 baud rate to the default of 10400. ### Command AT IB 10 ``` -------------------------------- ### AT IB 48 - SET_BAUDRATE_4800 Source: https://py-obdii.readthedocs.io/en/latest/api/modes/mode_at.html Sets the ISO 9141-2 and ISO 14230-4 baud rate to 4800. ```APIDOC ## AT IB 48 ### Description Sets the ISO 9141-2 and ISO 14230-4 baud rate to 4800. ### Command AT IB 48 ``` -------------------------------- ### AT TP {h} - TRY_PROTOCOL Source: https://py-obdii.readthedocs.io/en/latest/api/modes/mode_at.html Attempts to use protocol h without saving it to EEPROM. ```APIDOC ## AT TP {h} ### Description Attempts to use protocol h without saving it to EEPROM. ### Command AT TP {h} ### Parameters - **h** (hex digit) - Required - Protocol number to try. ``` -------------------------------- ### Formula.__init__ Source: https://py-obdii.readthedocs.io/en/latest/api/parsers.html Initializes a Formula object with a mathematical expression string. Variable names are converted to uppercase. ```APIDOC ## Formula.__init__ ### Description Initializes a Formula object with a given expression string. Variable names are converted to uppercase. ### Method Constructor ### Parameters - **expression** (str) - Required - The expression string to evaluate. ### Example ```python formula = Formula("(256*A+B)/4") ``` ``` -------------------------------- ### ModeAT.VERSION_ID Source: https://py-obdii.readthedocs.io/en/latest/api/modes/mode_at.html Displays the device identification string and firmware version. ```APIDOC ## ModeAT.VERSION_ID ### Description Display the device identification string and firmware version. ### Command ModeAT.VERSION_ID ### Usage ```python from obdii.modes import ModeAT ModeAT.VERSION_ID ``` ### Notes - The command is "AT I". ``` -------------------------------- ### Template.substitute() Source: https://py-obdii.readthedocs.io/en/latest/api/core.html Substitutes placeholders in the template with provided values. Accepts either positional or keyword arguments, but not both. Returns the resulting string. ```APIDOC ## Template.substitute() ### Description Substitutes the placeholders in the template with the provided values. The substitution must use either positional or keyword arguments, not both. ### Method substitute ### Signature substitute(*args, **kwargs) -> str ### Parameters - *args (Any) - Positional arguments corresponding to the placeholders in the template. - **kwargs (Any) - Keyword arguments corresponding to the placeholders in the template. ### Returns - str: The template string with placeholders replaced by the provided values. ### Example ```python t = Template("AT {a:str} {b:int} {c:hex4} {d}") r = t.substitute(a=1, b=2.2, c=3, d="four") # or r = t.substitute(1, 2.2, 3, "four") ``` ``` -------------------------------- ### AT KW - KEY_WORDS Source: https://py-obdii.readthedocs.io/en/latest/api/modes/mode_at.html Displays the two key word bytes received from the ECU during the initiation sequence. ```APIDOC ## AT KW ### Description Display the two key word bytes received from the ECU during the initiation sequence. ### Command AT KW ``` -------------------------------- ### scan_transports(candidates, transport_cls, probe=..., return_first=False, **kwargs) Source: https://py-obdii.readthedocs.io/en/latest/api/utils.html Attempts to detect working transports from a list of candidate configurations. It instantiates the given transport class for each candidate, sends a probe byte sequence, and returns a list of valid transports. If return_first is True, it stops after the first valid transport is found. ```APIDOC ## scan_transports(candidates, transport_cls, probe=..., return_first=False, **kwargs) ### Description Attempt to detect working transports from a list of candidates. ### Parameters - **candidates** (List[Dict[str, Any]]) - Required - List of transport configuration dictionaries. For example, for serial: [{"port": "COM3"}], for WiFi: [{"address": "192.168.0.10", "port": 35000}] - **transport_cls** (Type[TransportBase]) - Required - Transport class to instantiate for probing (e.g., TransportSerial, TransportSocket). - **probe** (bytes) - Optional - Byte sequence to send to test the transport. Defaults to at_commands.VERSION_ID.build(). - **return_first** (bool) - Optional - If True, stop scanning and return after the first valid transport is found. - **kwargs** (dict) - Optional - Additional keyword arguments forwarded to the transport's connect method. ### Returns List[TransportBase] - List of working transport instances. ``` -------------------------------- ### AT TP A{h} - TRY_PROTOCOL_AUTO Source: https://py-obdii.readthedocs.io/en/latest/api/modes/mode_at.html Attempts to use protocol h without saving it to EEPROM while enabling automatic detection on failure. ```APIDOC ## AT TP A{h} ### Description Attempts to use protocol h without saving it to EEPROM while enabling automatic detection on failure. ### Command AT TP A{h} ### Parameters - **h** (hex digit) - Required - Protocol number to try. ``` -------------------------------- ### Connection.query(command) Source: https://py-obdii.readthedocs.io/en/latest/api/core.html Sends a command and waits for the response. ```APIDOC ## query(command) ### Description Send a command and wait for the response. ### Parameters - **command** (Command) - Required - Command to send. ### Returns - Response: Parsed response from the adapter. ``` -------------------------------- ### AT IB 96 - SET_BAUDRATE_9600 Source: https://py-obdii.readthedocs.io/en/latest/api/modes/mode_at.html Sets the ISO 9141-2 and ISO 14230-4 baud rate to 9600. ```APIDOC ## AT IB 96 ### Description Sets the ISO 9141-2 and ISO 14230-4 baud rate to 9600. ### Command AT IB 96 ``` -------------------------------- ### ModeAT.DESCRIPTION Source: https://py-obdii.readthedocs.io/en/latest/api/modes/mode_at.html Displays the device description string of the ELM327. ```APIDOC ## ModeAT.DESCRIPTION ### Description Display the device description string of the ELM327. ### Command ModeAT.DESCRIPTION ### Usage ```python from obdii.modes import ModeAT ModeAT.DESCRIPTION ``` ### Notes - The command is "AT @1". ``` -------------------------------- ### AT IB 15 - SET_BAUDRATE_15625 Source: https://py-obdii.readthedocs.io/en/latest/api/modes/mode_at.html Sets the ISO 9141-2 and ISO 14230-4 baud rate to 15625. ```APIDOC ## AT IB 15 ### Description Sets the ISO 9141-2 and ISO 14230-4 baud rate to 15625. ### Command AT IB 15 ``` -------------------------------- ### ModeAT.LOWPOWER Source: https://py-obdii.readthedocs.io/en/latest/api/modes/mode_at.html Enters low power standby mode, reducing power consumption until awakened by activity or reset. ```APIDOC ## ModeAT.LOWPOWER ### Description Enter low power standby mode, reducing power consumption until awakened by activity or reset. ### Command ModeAT.LOWPOWER ### Usage ```python from obdii.modes import ModeAT ModeAT.LOWPOWER ``` ### Notes - The command is "AT LP". ``` -------------------------------- ### AT IB 12 - SET_BAUDRATE_12500 Source: https://py-obdii.readthedocs.io/en/latest/api/modes/mode_at.html Sets the ISO 9141-2 and ISO 14230-4 baud rate to 12500. ```APIDOC ## AT IB 12 ### Description Sets the ISO 9141-2 and ISO 14230-4 baud rate to 12500. ### Command AT IB 12 ``` -------------------------------- ### ModeAT.RESET Source: https://py-obdii.readthedocs.io/en/latest/api/modes/mode_at.html Performs a complete hardware reset, restoring all settings and the default baud rate. ```APIDOC ## ModeAT.RESET ### Description Performs a complete hardware reset, restoring all settings and the default baud rate. ### Command ModeAT.RESET ### Usage ```python from obdii.modes import ModeAT ModeAT.RESET ``` ### Notes - The command is "AT Z". ``` -------------------------------- ### ModeAT.RESET_SOFT Source: https://py-obdii.readthedocs.io/en/latest/api/modes/mode_at.html Performs a software reset restoring defaults while preserving baud rate settings. ```APIDOC ## ModeAT.RESET_SOFT ### Description Perform a software reset restoring defaults while preserving baud rate settings. ### Command ModeAT.RESET_SOFT ### Usage ```python from obdii.modes import ModeAT ModeAT.RESET_SOFT ``` ### Notes - The command is "AT WS". ``` -------------------------------- ### AT SS - STANDARD_SEARCH Source: https://py-obdii.readthedocs.io/en/latest/api/modes/mode_at.html Uses the SAE J1978 standard protocol search sequence for initiating connections. ```APIDOC ## AT SS ### Description Use the SAE J1978 standard protocol search sequence for initiating connections. ### Command AT SS ``` -------------------------------- ### AT KW0 - KEY_WORD_OFF Source: https://py-obdii.readthedocs.io/en/latest/api/modes/mode_at.html Disables key word checking, allowing initiation to proceed even if key word values are non-standard. ```APIDOC ## AT KW0 ### Description Disable key word checking, allowing initiation to proceed even if key word values are non-standard. ### Command AT KW0 ``` -------------------------------- ### AT CAF1 - FORMAT_AUTO_ON Source: https://py-obdii.readthedocs.io/en/latest/api/modes/mode_at.html Enables CAN automatic formatting, automatically handling PCI bytes, padding, and simplifying CAN send and receive data. ```APIDOC ## AT CAF1 ### Description Enable CAN automatic formatting, automatically handling PCI bytes, padding, and simplifying CAN send and receive data. ### Command AT CAF1 ``` -------------------------------- ### DTC.__init__ Source: https://py-obdii.readthedocs.io/en/latest/api/parsers.html Initializes a DTC object with a raw DTC code string. The DTC is parsed into its components: category, scope, system, and descriptor. ```APIDOC ## DTC.__init__ ### Description Initializes a DTC object with a raw DTC code string. The DTC is parsed into its components: category, scope, system, and descriptor. ### Method Constructor ### Parameters - **raw** (str) - Required - The raw DTC code string, e.g. "U0158". ### Attributes - **code** (str) - Full DTC code, e.g. "U0158". - **category** (Category) - DTC category, e.g. Category.NETWORK. - **scope** (Scope) - DTC scope, e.g. Scope.GENERIC. - **system** (System) - DTC system, e.g. System.FUEL_AIR_METERING. - **descriptor** (str) - DTC descriptor, e.g. "58". ### Example ```python dtc = DTC("U0158") ``` ``` -------------------------------- ### scan_network(return_first=True, **kwargs) Source: https://py-obdii.readthedocs.io/en/latest/api/utils.html Scans common WiFi endpoints for ELM327 compatible devices. Returns a list of working network transports, or the first one if return_first is True. ```APIDOC ## scan_network(return_first=True, **kwargs) ### Description Scan common WiFi endpoints for ELM327 compatible devices. ### Parameters - **return_first** (bool) - Optional - If True, stop scanning and return after the first valid transport is found. Defaults to True. - **kwargs** (dict) - Optional - Additional keyword arguments forwarded to the transport's connect method. ### Returns List[TransportBase] - List of working network transport instances. ``` -------------------------------- ### AT SW {hh} - SET_WAKEUP Source: https://py-obdii.readthedocs.io/en/latest/api/modes/mode_at.html Sets the periodic wakeup messages interval to hh * 20 ms, keeps the ECU connection active, only supported for protocols 3, 4, and 5. ```APIDOC ## AT SW {hh} ### Description Set the periodic wakeup messages interval to hh * 20 ms, keeps the ECU connection active, only supported for protocols 3, 4, and 5. ### Command AT SW {hh} ### Parameters - **hh** (hex byte) - Required - Wakeup interval multiplier, actual interval is hh * 20 ms. ``` -------------------------------- ### scan_ports(return_first=True, **kwargs) Source: https://py-obdii.readthedocs.io/en/latest/api/utils.html Scans available serial ports for ELM327 compatible devices. Returns a list of working serial transports, or the first one if return_first is True. ```APIDOC ## scan_ports(return_first=True, **kwargs) ### Description Scan available serial ports for ELM327 compatible devices. ### Parameters - **return_first** (bool) - Optional - If True, stop scanning and return after the first valid transport is found. Defaults to True. - **kwargs** (dict) - Optional - Additional keyword arguments forwarded to the transport's connect method. ### Returns List[TransportBase] - List of working serial transport instances. ``` -------------------------------- ### Map data bytes to enumerated values with EnumeratedPIDS Source: https://py-obdii.readthedocs.io/en/latest/api/parsers.html Demonstrates mapping raw byte values to human-readable strings using a dictionary mapping. ```python unparsed = [0, 0] fuel_system_status = EnumeratedPIDS( { 0: "The motor is off", 1: "Open loop due to insufficient engine temperature", 2: "Closed loop, using oxygen sensor feedback to determine fuel mix", 4: "Open loop due to engine load OR fuel cut due to deceleration", 8: "Open loop due to system failure", 16: "Closed loop, using at least one oxygen sensor but there is a fault in the feedback system", } ) result = fuel_system_status(unparsed) >>> result [(0, "The motor is off"), (0, "The motor is off")] ``` -------------------------------- ### ModeAT.PROG_PARAM_ON Source: https://py-obdii.readthedocs.io/en/latest/api/modes/mode_at.html Enables the specified hh Programmable Parameter, allowing its assigned value to override the factory default. ```APIDOC ## ModeAT.PROG_PARAM_ON ### Description Enable the specified hh Programmable Parameter, allowing its assigned value to override the factory default. ### Command ModeAT.PROG_PARAM_ON ### Parameters - **hh** (hexadecimal) - Required - The programmable parameter number. ### Usage ```python from obdii.modes import ModeAT ModeAT.PROG_PARAM_ON ``` ### Notes - The command template is "PP {hh} ON". ``` -------------------------------- ### ModeAT.RESET_DEFAULTS Source: https://py-obdii.readthedocs.io/en/latest/api/modes/mode_at.html Restores all settings, including protocol, headers, filters, masks and timers to their factory default values. ```APIDOC ## ModeAT.RESET_DEFAULTS ### Description Restore all settings, including protocol, headers, filters, masks and timers to their factory default values. ### Command ModeAT.RESET_DEFAULTS ### Usage ```python from obdii.modes import ModeAT ModeAT.RESET_DEFAULTS ``` ### Notes - The command is "AT D". ``` -------------------------------- ### ModeAT.ECHO_ON Source: https://py-obdii.readthedocs.io/en/latest/api/modes/mode_at.html Enables echoing of characters received on the RS232 port back to the host computer. ```APIDOC ## ModeAT.ECHO_ON ### Description Enable echoing of characters received on the RS232 port back to the host computer. ### Command ModeAT.ECHO_ON ### Usage ```python from obdii.modes import ModeAT ModeAT.ECHO_ON ``` ### Notes - The command is "AT E1". ``` -------------------------------- ### Mode09.IN_USE_PERF_TRACKING_COMPRESSION_IGNITION Source: https://py-obdii.readthedocs.io/en/latest/api/modes/mode_09.html Command to retrieve in-use performance tracking for compression ignition vehicles. ```APIDOC ## Mode09.IN_USE_PERF_TRACKING_COMPRESSION_IGNITION ### Description Command to retrieve in-use performance tracking for compression ignition vehicles. ### Command Mode09.IN_USE_PERF_TRACKING_COMPRESSION_IGNITION ### Parameters None ### Response Returns in-use performance tracking data for compression ignition vehicles. ``` -------------------------------- ### AT WM {xxxxxxxxxxxx} - WAKEUP_MESSAGE Source: https://py-obdii.readthedocs.io/en/latest/api/modes/mode_at.html Overrides the default periodic wakeup message, accepts 1 to 6 bytes. ```APIDOC ## AT WM {xxxxxxxxxxxx} ### Description Override the default periodic wakeup message, accepts 1 to 6 bytes. ### Command AT WM {xxxxxxxxxxxx} ### Parameters - **xxxxxxxxxxxx** (hex string) - Required - Wakeup message bytes, 1 to 6 bytes. ``` -------------------------------- ### EnumeratedPIDS.__init__ Source: https://py-obdii.readthedocs.io/en/latest/api/parsers.html Initializes an EnumeratedPIDS object with a mapping dictionary. The mapping maps byte values to their corresponding enumerated meanings. ```APIDOC ## EnumeratedPIDS.__init__ ### Description Initializes an EnumeratedPIDS object with a mapping dictionary. The mapping maps byte values to their corresponding enumerated meanings. ### Method Constructor ### Parameters - **mapping** (Dict[Union[int, Iterable[int]], Any]) - Required - A dictionary mapping byte values to their corresponding enumerated meanings. ### Example ```python fuel_system_status = EnumeratedPIDS({ 0: "The motor is off", 1: "Open loop due to insufficient engine temperature", 2: "Closed loop, using oxygen sensor feedback to determine fuel mix", 4: "Open loop due to engine load OR fuel cut due to deceleration", 8: "Open loop due to system failure", 16: "Closed loop, using at least one oxygen sensor but there is a fault in the feedback system", }) ``` ``` -------------------------------- ### AT C1 - CONFIRMATION_ON Source: https://py-obdii.readthedocs.io/en/latest/api/modes/mode_at.html Enables confirmation of CAN message transmission errors, requires an ELM327 >= 2.3. ```APIDOC ## AT C1 ### Description Enable confirmation of CAN message transmission errors, requires an ELM327 >= 2.3. ### Command AT C1 ``` -------------------------------- ### Evaluate multiple formulas with MultiFormula Source: https://py-obdii.readthedocs.io/en/latest/api/parsers.html Demonstrates using the MultiFormula class to apply multiple expressions to a single list of unparsed data. ```python # 143 (dec) -> A # 125 (dec) -> B # 149 (dec) -> C # 128 (dec) -> D # 111 (dec) -> E unparsed = [143, 125, 149, 128, 111] engine_torque = MultiFormula("A-125", "B-125", "C-125", "D-125", "E-125") result = engine_torque(unparsed) >>> result [18, 0, 24, 3, -14] ``` -------------------------------- ### ProtocolConnectionError Source: https://py-obdii.readthedocs.io/en/latest/api/errors.html Exception raised when no supported protocol is detected. Verify vehicle ignition status, compatibility, and connections. ```APIDOC ## ProtocolConnectionError ### Description No supported protocol detected. Verify vehicle ignition status, compatibility, and connections. ### Constructor `ProtocolConnectionError(_response: bytes)` ### Parameters - `_response` (bytes) - Required - The response bytes associated with the error. ### Attributes - `pattern` (bytes | None) - `b'UNABLE TO CONNECT'` ### Inherits - `ResponseError` ``` -------------------------------- ### Connection.__exit__(exc_type, exc_value, traceback) Source: https://py-obdii.readthedocs.io/en/latest/api/core.html Close the connection when exiting the context. ```APIDOC ## __exit__(exc_type, exc_value, traceback) ### Description Close the connection when exiting the context. ### Parameters - **exc_type** (Type[BaseException] | None) - Required - Exception type. - **exc_value** (BaseException | None) - Required - Exception value. - **traceback** (TracebackType | None) - Required - Traceback. ### Returns - None ``` -------------------------------- ### ModeAT.READ_VOLTAGE Source: https://py-obdii.readthedocs.io/en/latest/api/modes/mode_at.html Reads the current input voltage at pin 2 and converts it to a decimal string. ```APIDOC ## ModeAT.READ_VOLTAGE ### Description Read the current input voltage at pin 2 and converts it to a decimal string. ### Command ModeAT.READ_VOLTAGE ### Usage ```python from obdii.modes import ModeAT ModeAT.READ_VOLTAGE ``` ### Notes - The command is "RV". ``` -------------------------------- ### CanError Source: https://py-obdii.readthedocs.io/en/latest/api/errors.html Exception raised when the CAN system had difficulty initializing, sending, or receiving. ```APIDOC ## CanError ### Description The CAN system had difficulty initializing, sending, or receiving. ### Constructor `CanError(_response: bytes)` ### Parameters - `_response` (bytes) - Required - The response bytes associated with the error. ### Attributes - `pattern` (bytes | None) - `b'CAN ERROR'` ### Inherits - `ResponseError` ``` -------------------------------- ### Connection.wait_for_response(context) Source: https://py-obdii.readthedocs.io/en/latest/api/core.html Waits for a raw response from the transport and parses it using the protocol handler. ```APIDOC ## wait_for_response(context) ### Description Wait for a raw response from the transport and parses it using the protocol handler. ### Parameters - **context** (Context) - Required - Context to use for parsing. ### Returns - Response: Parsed response or raw fallback response. ``` -------------------------------- ### ModeAT.REPEAT Source: https://py-obdii.readthedocs.io/en/latest/api/modes/mode_at.html Repeats the last AT or OBD command performed. ```APIDOC ## ModeAT.REPEAT ### Description Repeat the last AT or OBD command performed. ### Command ModeAT.REPEAT ### Usage ```python from obdii.modes import ModeAT ModeAT.REPEAT ``` ### Notes - This command repeats the last AT or OBD command. ``` -------------------------------- ### ProtocolKWP.to_frames() Source: https://py-obdii.readthedocs.io/en/latest/api/protocols.html Parses a list of raw ELM327 lines into KWPFrame objects. Supports ISO 9141-2 and ISO 14230-4 KWP protocols. ```APIDOC ## ProtocolKWP.to_frames() ### Description Parses a list of raw ELM327 lines into KWPFrame objects. Supports ISO 9141-2 and ISO 14230-4 KWP protocols. ### Method Method call ### Endpoint obdii.protocols.ProtocolKWP.to_frames(lines: List[bytes], context: Context) -> List[Frame] ### Parameters - **lines** (List[bytes]) - Required - Raw ELM327 lines to parse - **context** (Context) - Required - Parsing context ### Returns - **List[Frame]** - Parsed KWP frame objects ### Frame Anatomy ISO 9141-2 Frame - fixed 3 byte header ``` 48 6B 11 41 0C 1F 40 70 | | | | | | | | | +-- checksum: sum of all previous bytes % 256 | | | +-- payload: mode (41) + PID (0C) + data (1F 40) | | +-- source address (sender ECU) | +-- target address (receiver) +-- priority ``` ISO 14230-4 Frame (Standard Header) - length inline within FMT byte ``` 84 F1 11 41 0C 1F 44 36 | | | | | | | | | +-- checksum: sum of all previous bytes % 256 | | | +-- payload: mode (41) + PID (0C) + data (1F 44) | | +-- source address (sender ECU) | +-- target address (receiver) +-- FMT: addressing mode (bits 7:6) + payload length (bits 5:0 = 4 bytes) ``` ISO 14230-4 Frame (Extended Header) - length in a separate LEN byte ``` 80 F1 11 04 41 0C 1F 44 32 | | | | | | | | | | | +-- checksum: sum of all previous bytes % 256 | | | | +-- payload: mode (41) + PID (0C) + data (1F 44) | | | +-- LEN: payload length byte (present because bits 5:0 of FMT = 0) | | +-- source address (sender ECU) | +-- target address (receiver) +-- FMT: addressing mode (bits 7:6) + length flag (bits 5:0 = 0) ``` ``` -------------------------------- ### LowPowerWarning Source: https://py-obdii.readthedocs.io/en/latest/api/errors.html Exception raised when the ELM327 is entering Low Power mode in 2 seconds. No interruption possible. ```APIDOC ## LowPowerWarning ### Description The ELM327 is entering Low Power mode in 2 seconds. No interruption possible. ### Constructor `LowPowerWarning(_response: bytes)` ### Parameters - `_response` (bytes) - Required - The response bytes associated with the warning. ### Attributes - `pattern` (bytes | None) - `b'LP ALERT'` ### Inherits - `ResponseWarning` ``` -------------------------------- ### Evaluate a mathematical formula with Formula Source: https://py-obdii.readthedocs.io/en/latest/api/parsers.html Demonstrates using the Formula class to calculate a result from a list of unparsed integers based on a string expression. ```python # 11 (dec) -> A # 64 (dec) -> B unparsed = [11, 64] formula = Formula("(256*A+B)/4") result = formula(unparsed) # (256 * 11 + 64)/4 >>> result 720.0 ``` -------------------------------- ### LowVoltageResetWarning Source: https://py-obdii.readthedocs.io/en/latest/api/errors.html Exception raised to indicate low 5V supply voltage, triggering a reset. ```APIDOC ## LowVoltageResetWarning ### Description Indicates low 5V supply voltage, triggering a reset. ### Constructor `LowVoltageResetWarning(_response: bytes)` ### Parameters - `_response` (bytes) - Required - The response bytes associated with the warning. ### Inherits - `ResponseWarning` ``` -------------------------------- ### SupportedPIDS.__call__ Source: https://py-obdii.readthedocs.io/en/latest/api/parsers.html Parses supported PIDs from the response data. Returns a list of supported PIDs. ```APIDOC ## SupportedPIDS.__call__ ### Description Parses supported PIDs from the response data. Returns a list of supported PIDs. ### Method Callable ### Parameters - **unparsed** (List[int]) - Required - The data to parse. ### Returns - **List[int]** - List of supported PIDs. ### Example ```python unparsed = [190, 31, 168, 19] supported_pids = SupportedPIDS(0x01) result = supported_pids(unparsed) # result = [0x01, 0x03, 0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x13, 0x15, 0x1C, 0x1F, 0x20] ``` ``` -------------------------------- ### SignalFeedbackError Source: https://py-obdii.readthedocs.io/en/latest/api/errors.html Exception raised when output is energized but input signal is not detected, indicating a possible wiring issue. ```APIDOC ## SignalFeedbackError ### Description Output energized, but input signal not detected. Possible wiring issue. Verify connections. ### Constructor `SignalFeedbackError(_response: bytes)` ### Parameters - `_response` (bytes) - Required - The response bytes associated with the error. ### Attributes - `pattern` (bytes | None) - `b'FB ERROR'` ### Inherits - `ResponseError` ``` -------------------------------- ### ModeAT.RESTORE_VOLTAGE Source: https://py-obdii.readthedocs.io/en/latest/api/modes/mode_at.html Restores the ELM327 voltage calibration to the original factory setting. ```APIDOC ## ModeAT.RESTORE_VOLTAGE ### Description Restore the ELM327 voltage calibration to the original factory setting. ### Command ModeAT.RESTORE_VOLTAGE ### Usage ```python from obdii.modes import ModeAT ModeAT.RESTORE_VOLTAGE ``` ### Notes - The command is "CV 0000". ``` -------------------------------- ### ModeAT.LINEFEED_ON Source: https://py-obdii.readthedocs.io/en/latest/api/modes/mode_at.html Enables sending of a linefeed character after each carriage return. ```APIDOC ## ModeAT.LINEFEED_ON ### Description Enable sending of a linefeed character after each carriage return. ### Command ModeAT.LINEFEED_ON ### Usage ```python from obdii.modes import ModeAT ModeAT.LINEFEED_ON ``` ### Notes - The command is "AT L1". ``` -------------------------------- ### BufferFullError Source: https://py-obdii.readthedocs.io/en/latest/api/errors.html Exception raised when the ELM327's 256-byte buffer is full. ```APIDOC ## BufferFullError ### Description The ELM327's 256-byte buffer is full. ### Constructor `BufferFullError(_response: bytes)` ### Parameters - `_response` (bytes) - Required - The response bytes associated with the error. ### Attributes - `pattern` (bytes | None) - `b'BUFFER FULL'` ### Inherits - `ResponseError` ``` -------------------------------- ### PROTOCOL_B_BAUDRATE Source: https://py-obdii.readthedocs.io/en/latest/api/modes/mode_at.html Sets Protocol B parameters xx and yy, overriding PP 2C and PP 2D values for the next initialization without changing stored programmable parameters. ```APIDOC ## PROTOCOL_B_BAUDRATE ### Description Sets Protocol B parameters xx and yy, overriding PP 2C and PP 2D values for the next initialization without changing stored programmable parameters. ### Command AT PB {xx} {yy} ### Parameters - **xx** (hex) - Required - The first Protocol B parameter. - **yy** (hex) - Required - The second Protocol B parameter. ```