OBD data: logging set-up
How the readings get from the car into Home Assistant. A thin logger in the car, and the thinking done at home: the ESP32 only reads and stores, a small server decodes. Everything stays on your own network unless you add the 4G path.
- Reads a list of items from the modules whenever the car is on: about 45 fast ones (speeds, gear, torque, doors, lock, windows, brake) every 0.6 seconds, three to a request, the rest in rotation, and the 112 cell voltages and battery temperatures every 30 seconds.
- Writes everything to its own flash, about 0.5–0.7 MB per hour of driving, in a loop of about 7 MB (some 10 hours of driving), so days away from home lose nothing.
- When parked with the car on, it explores item numbers nobody has tried yet and adds what it finds to the list.
- Has its own web page for status, live values, guided tests and updates over Wi-Fi. A list of allowed requests is built into the firmware: anything that isn't a read is refused.
- A small program in a Docker container on a home server (ours runs on an Unraid box; any Docker host will do), with its own PostgreSQL database. A used office PC or an old laptop is plenty: see "where to run the collector" in build your own logger.
- When the car is home it fetches the live values every 5 seconds and the log files every minute over Wi-Fi, and keeps every reading. The full history means items can be decoded again later as we learn more.
- Works out each trip (distance from the wheel speeds, energy from the battery's own counters, share of regenerative braking) and serves its own web page: overview, trips, items, charts and the trip replay.
The collector publishes 46 sensors to Home Assistant over MQTT with automatic discovery, so they appear on their own: each door and the boot, locked or unlocked, four windows, four tyre pressures and temperatures, battery charge, health and voltage, highest / lowest / average cell and the spread, battery temperatures, energy in and out, speed, gear, brake pedal, motor temperature, A/C, 12 V, an estimated odometer and the last trip. Raw readings stay in the collector's database, so Home Assistant's own database doesn't fill up.
With the ESP32-S3 + A7670E board the logger can send its files over HTTPS from anywhere, to an upload address on the home server reached through a secure tunnel (for example Cloudflare Tunnel or WireGuard). The home Wi-Fi path stays as it is. Parts and SIM notes: build your own logger.