Files
yaris-obd/deploy/yaris-obd.service
T
Mathieu MoranandCopilot 10dea22f9a fix: Yaris 2013 OBD compatibility hardening
- _decode_odometer: catch all exceptions and return None instead of raising.
  PID 0xA6 (odometer) is not guaranteed on 2013 Toyota Yaris — a garbage
  response or unsupported PID previously raised ValueError through python-obd's
  decoder, which app_obd._query() caught and treated as a lost connection,
  killing the entire OBD session. Now it gracefully returns None.

- connect_obd: reset all sensor globals (rpm, coolant_temp, fuel_level,
  throttle_position, mil_on, dtc_codes, odometer, timestamps) on each new
  connection so the UI doesn't display stale readings from the previous
  ignition cycle while fresh polls are completing.

- yaris-obd.service: add commented OBD_PROTOCOL=6 hint for post-confirmation
  pinning (eliminates 3-5s auto-probe delay after first confirmed connection).

Co-authored-by: Copilot <[email protected]>
2026-08-10 05:22:36 -04:00

32 lines
1.2 KiB
Desktop File

[Unit]
Description=Yaris OBD/GPS tracker web UI
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
User=yaris
Group=yaris
WorkingDirectory=/home/yaris/app/yaris-obd
# Unbuffered stdout so print() diagnostics (GPS/GNSS status, etc.) actually reach
# the log file promptly instead of sitting in Python's stdout buffer indefinitely
# when it's redirected to a file instead of a TTY.
Environment=PYTHONUNBUFFERED=1
# Once OBD is confirmed working on this car, pin the protocol to skip the
# 3-5s auto-detect probe on every ignition-on: e.g. OBD_PROTOCOL=6 for
# ISO 15765-4 CAN 11-bit 500kbps (correct for 2013 Toyota Yaris).
# Leave unset during initial setup so auto-detect can find the right value.
#Environment=OBD_PROTOCOL=6
ExecStart=/home/yaris/app/yaris-obd/venv/bin/python app.py
Restart=on-failure
RestartSec=5
# Give the app a few seconds after boot for USB/serial devices to enumerate
# before the first connection attempt - it retries gracefully either way,
# but this avoids needless noisy "no connection" logs on every cold boot.
ExecStartPre=/bin/sleep 5
StandardOutput=append:/home/yaris/app/yaris-obd/yaris-obd.log
StandardError=append:/home/yaris/app/yaris-obd/yaris-obd.log
[Install]
WantedBy=multi-user.target