Skip to content

Value Returned Only on First Request - Then All Requests Lead to None. #268

@mrbean26

Description

@mrbean26

Title describes the issue. Interestingly, the OBD&ELM connections read false even before the first query, however CAR connection reads true. here is the code I am using.
`
import obd
import time

obd.logger.setLevel(obd.logging.DEBUG)
print("1")
ports=obd.scan_serial()
print(ports)
connection=obd.OBD(ports[1], fast=False)
print("2")

while True:
        print("Car connected", connection.status()==obd.OBDStatus.CAR_CONNECTED)

        newCommand=obd.commands.RPM
        newQuery = connection.query(newCommand)
        print(newQuery.value)
    
        time.sleep(1.5)

`

and here is the debug log

============================================================= RESTART: C:\Users\Diag\Desktop\newscript.py ============================================================= 1 ['\\.\\COM3', '\\.\\COM4'] [obd.obd] ======================= python-OBD (v0.7.1) ======================= [obd.obd] Explicit port defined [obd.elm327] Initializing ELM327: PORT=\.\COM4 BAUD=auto PROTOCOL=auto [obd.elm327] Response from baud 38400: b'?\r\r>' [obd.elm327] Choosing baud 38400 [obd.elm327] write: b'ATZ\r' [obd.elm327] wait: 1 seconds [obd.elm327] read: b'\xfc\r\rELM327 v1.5\r\r>' [obd.elm327] write: b'ATE0\r' [obd.elm327] wait: 0 seconds [obd.elm327] read: b'ATE0\rOK\r\r>' [obd.elm327] write: b'ATH1\r' [obd.elm327] wait: 1 seconds [obd.elm327] read: b'OK\r\r>' [obd.elm327] write: b'ATL0\r' [obd.elm327] wait: 0 seconds [obd.elm327] read: b'OK\r\r>' [obd.elm327] write: b'AT RV\r' [obd.elm327] wait: 0 seconds [obd.elm327] read: b'14.3V\r\r>' [obd.elm327] write: b'ATSP0\r' [obd.elm327] wait: 0 seconds [obd.elm327] read: b'OK\r\r>' [obd.elm327] write: b'0100\r' [obd.elm327] wait: 0 seconds [obd.elm327] read: b'SEARCHING...\r48 6B 10 41 00 BE 3E B8 11 C9 \r\r>' [obd.elm327] write: b'ATDPN\r' [obd.elm327] wait: 0 seconds [obd.elm327] read: b'A3\r\r>' [obd.protocols.protocol] map ECU 16 --> ENGINE [obd.elm327] Connected Successfully: PORT=\.\COM4 BAUD=38400 PROTOCOL=3 [obd.obd] querying for supported commands [obd.obd] Sending command: b'0100': Supported PIDs [01-20] [obd.elm327] write: b'0100\r' [obd.elm327] wait: 0 seconds [obd.elm327] read: b'48 6B 10 41 00 BE 3E B8 11 C9 \r\r>' [obd.obd] Sending command: b'0120': Supported PIDs [21-40] [obd.elm327] write: b'0120\r' [obd.elm327] wait: 0 seconds [obd.elm327] read: b'48 6B 10 41 20 80 00 00 00 A4 \r\r>' [obd.obd] finished querying with 43 commands supported [obd.obd] =================================================================== 2 [obd.obd] Sending command: b'010C': Engine RPM [obd.elm327] write: b'010C\r' [obd.elm327] wait: 0 seconds [obd.elm327] read: b'48 6B 10 41 0C 0B 74 8F \r\r>' 733.0 revolutions_per_minute [obd.obd] Sending command: b'010C': Engine RPM [obd.elm327] write: b'010C\r' [obd.elm327] wait: 0 seconds [obd.elm327] read: b'NO DATA\r\r>' [obd.OBDCommand] b'010C': Engine RPM did not receive any acceptable messages None

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions