SuspiciousRepair/drive_assist
حول
Free, open-source dashboard for the Geely EX2 / Geometry E. Remembers your drive settings, records trips, charging and dashcam, and sends car data only where you choose (Home Assistant, MQTT, ABRP). No account, no tracking.
الأنظمة والبنية التحتيةما يمكنك فعله
- Drive Modes & Regeneration: Configures drive modes (Eco, Comfort, Sport) and regenerative braking levels (Low, Mid, High). On boot, mode reapplication is handled by the privileged helper app com.geely.modehelper.
- Telemetry & MQTT: Publishes vehicle metrics (battery, odometer, range, speed, gear, climate, charging) to Home Assistant via MQTT with auto-discovery, and handles remote actions (smart gate trigger, climate commands, OTA updates).
النمو المقاس للنجوم
- خلال 24 ساعة
- ٠
- خلال 7 أيام
- +٢
- خلال 15 يومًا
- +٤
- خلال شهر
- جارٍ جمع السجل
تغيّر صافي النجوم خلال فترات متداخلة، وليس مجموعًا يوميًا. تبقى القياسات المفقودة فارغة. النجوم تقيس الاهتمام لا جودة البرمجيات.
README.md
الأصلDrive Assist
English · Português (Brasil)
A better everyday dashboard for the Geely EX2 / Geometry E.
Drive Assist is an app for the Geely EX2 / Geometry E. It installs on the car's own screen and gives you the things the factory software leaves out: controls that stay the way you set them, a clear record of driving and charging, and useful vehicle data on the car screen and in services you already use.
If you want to see the app before reading about installation or engineering, start with the illustrated Guide for Drivers.
[!WARNING] Root ADB gives administrator access to the head unit and can expose location, credentials, cameras, vehicle data, and your home network. Read the plain-language root ADB safety notice before enabling it.
What it fixes
- The car forgets your settings. Pick Eco, Comfort or Sport and it goes back to default the next time you switch on. Drive Assist remembers your choice and puts it back for you every time.
- The climate controls are fiddly. Instead of juggling temperature, fan speed and the A/C button, there is a single slider that runs from cold to warm. Slide one way if you feel too hot, the other way if you feel too cold. The app works out the rest.
- Your car's data is locked away. Battery level, range, charging, and location can be sent to your own Home Assistant. Drive Assist sends data only to the services you configure, including Home Assistant and, when enabled, A Better Routeplanner.
- Charging costs disappear into memory. Every recharge becomes part of a history with energy, duration, battery change, and price. Earlier prices can be corrected later, and free charging is recorded properly.
- Daily driving deserves more than one number. See trips, parking intervals, recharges, energy use, regeneration, elevation change, and efficiency by speed range. Parked climate use does not distort driving efficiency.
- Long trips are a guessing game. Live battery and elevation data can be fed to A Better Routeplanner, so its charging stops are based on how your car is actually doing right now.
- OBD2 ready. You can connect the head unit directly to an OBD2 dongle for fresh battery-management data.
What you see on the screen
The main screen gives you a simple cooler-to-warmer comfort control, outdoor temperature, and large climate shortcuts that work at a glance.
The statistics screens keep a diary of your driving and charging: how far you went, where energy was spent or recovered, how much you climbed and descended, what every recharge delivered, and what it cost. There is also an optional dashcam that records with telemetry subtitles and can copy clips to a USB stick.
A connection to Home Assistant opens up a whole new world of automations. You can open your gate and send timely information from Home Assistant to the car. If someone rings your doorbell, for example, the dashboard can show the doorbell image.
What it will not do
Drive Assist mostly touches comfort and convenience: climate, drive mode, cabin lights, windows, charging. It has no ability to steer, brake, accelerate, lock or unlock your doors, or open the boot. Two of its switches do affect safety systems, and both are your choice: one can turn off AEB (automatic emergency braking), and one can mute AVAS (the pedestrian warning sound). The full, plain-language list of everything the app can read, change and send is in the safety and privacy guide.
Who it is for
Owners of a Geely EX2 / Geometry E who are comfortable installing an app on the car themselves. It is a spare-time project, not an official Geely product, and it comes with no warranty — please read the Vehicle Security & Sideloading Guide before you start.
Technical details, for those who want them: the head unit is an IHU629G running Android 9 (API 28, ECARX 250060) with a 1920x1080 screen at 160 dpi. Everything below this point is written for developers.
Live Vehicle Interface Previews
Captured directly from the physical vehicle head unit display via ADB (1920x1080 native resolution):
| Comfort View & Thermal Effort Ruler | Daily Statistics & Altimetry Feed |
|---|---|
![]() |
![]() |
| Charging history & energy balance | Drive mode and regeneration |
|---|---|
![]() |
![]() |
Quick Start
Getting Drive Assist running on your vehicle head unit:
Standalone USB Installer (
drive_assist_installer.apk, recommended): Copy the single installer APK to a FAT32 USB flash drive, insert it into the vehicle USB port, open the vehicle's File Manager, and tap to install. The installer bundles both packages, installs them with platform privileges, and self-uninstalls on completion.One-Shot Wireless Installation: If your laptop is on the same Wi-Fi network as the vehicle, run:
./install.sh <CAR_IP>Provisions
modehelper.apk, installsdrive_assist.apk, and launches Drive Assist. It does not change Bluetooth settings or any file under/system.Bluetooth OBD2 pairing is optional. The separate, temporary PIN workaround is documented with its risks in the installation guide.
Interactive Configuration Wizard (
configure-car.sh): After ADB is available, configure MQTT broker credentials, mTLS certificates, ABRP tokens, and defaults from an interactive terminal:./tools/configure-car.sh
For detailed step-by-step instructions and troubleshooting, see the Post-Unlock Installation Guide.
Documentation
Full architectural documentation and reverse-engineering guides are located in the docs/ directory:
User & Operation Guides
- Guide for Drivers — An illustrated explanation of the app
- Welcome & Transparency Guide — What the app sees, does, controls, risks, and privacy safeguards
- Short Installation Guide — The one-file USB method for owners
- Technical Installation Guide — ADB setup, scripts, verification, and troubleshooting
- Home Assistant Guide — Connection, permissions, verification, and privacy
- A Better Routeplanner Guide — Live-data connection, location choice, and optional OBD2
- MQTT Technical Reference — Broker setup, mTLS security, topics, and automations
- ABRP & OBD2 Technical Reference — Payloads, generic tokens, and Bluetooth BMS
- Vehicle Security & Sideloading Guide — Sideloading risks, platform test keys, APK repackaging, and data exposure
Audits, Quality & Governance
- Software Architecture & Vehicle Safety Audit — Audit of UID separation, Park invariants, and VHAL safety (snapshot, September 2026)
- Open-source Head-unit Software Review — Maintainability, architecture, performance, safety, and community recommendations (snapshot, September 2026)
- Code Quality & Test Coverage Report — JaCoCo, Lint, Checkstyle, and SpotBugs findings (snapshot, September 2026)
- Contributing Guidelines — Branching rules (
next/master), Conventional Commits, and pull request checklist - Changelog — Full version history, release notes, and unreleased enhancements
- License — GNU General Public License v3.0 terms
- Car data: what is available, and when — every hub key, its source, update rate and conditions (CAN, OBD2, VHAL)
- Third-party notices and credits — roadcast and Capy by Timoteo Sousa, libuv
Engineering References
- Field Catalog — Exhaustive hardware signals, probes, and VHAL references
- Climate & Comfort Ruler — Thermal effort scale and HVAC state machine
- Cameras & EVS HAL — Extended View System architecture and binder interface
- Dashcam Subsystem — Recording modes (Off, Events, Continuous), telemetry subtitles, and streaming
- Status Bar Icons — System overlay mechanism and icon IDs
- ADB Setup Guide — Sideloading, networking, and root environment
- ModeHelper Companion App — Privileged system companion app (
android.uid.system) for mode persistence, silent OTA, dashcam, and ADB guard
Core Features
- Drive Modes & Regeneration: Configures drive modes (Eco, Comfort, Sport) and regenerative braking levels (Low, Mid, High). On boot, mode reapplication is handled by the privileged helper app
com.geely.modehelper. - Comfort Ruler (Climate Control): The car hardware does not expose cabin temperature via VHAL (
HVAC_IN_OUT_TEMPisNOT_AVAILABLE). The driver is the sensor: the climate is one list of small moves (EffortTable/ComfortRuler, C10..0..W5), and one tap is one move. The list steps over 0 (the mode boundary between cooling and heating) to avoid reversing the HVAC state machine at the neutral point. See COMFORT-TABLE.md. - Telemetry & MQTT: Publishes vehicle metrics (battery, odometer, range, speed, gear, climate, charging) to Home Assistant via MQTT with auto-discovery, and handles remote actions (smart gate trigger, climate commands, OTA updates).
How It Works
The vehicle controls use functionIds from a Geely adaptation layer (VehicleModules.getAdaptValue), not direct VHAL property IDs. CarPropertyManager inside an installed APK (via Car.createCar) resolves and translates these IDs; standalone binder clients (app_process) fail to resolve them. Drive Assist is therefore built and installed as an APK.
Car permissions (CAR_POWERTRAIN, CAR_ENERGY) are signature|privileged. They are granted to debug-signed APKs on this head unit because ro.control_privapp_permissions is non-enforcing (empty).
Vehicle Data Catalog
A consolidated reference of confirmed vehicle properties and Geely adaptation layer function IDs on the IHU629G. All properties are accessed via CarPropertyManager inside the installed APK. For detailed probing methodologies, logs, and historical investigations, see field-catalog.md and field-catalog.md.
Architecture: CarActor & EntityBus
All vehicle I/O is centralized in CarActor, which manages a dedicated HandlerThread and a single CarAccess connection for the process lifecycle.
- Cached Reads:
CarActor.get(ctx).get(key)returns the latest cached property value synchronously without blocking on vehicle binder I/O. - Subscriptions:
EntityBus.subscribe(key, listener)notifies in-app consumers when property values change.EntityBus.publish()is restricted toCarActor. - Thread Safety: All car read/write calls must execute on
CarActor's thread.
Polling Loops & Event Cadence
- Always-On Keys: Registered at startup and polled continuously:
car.is_charging(2s): Derived fromcharge_a > 0.5Arather than the charge switch read-back.telemetry.outside_temp(15s): Outside ambient temperature.telemetry.ambient_color&telemetry.ambient_brightness(4s): Cabin strip state.car.phone_projection(4s): CarPlay or Android Auto link (CarplayState): the OEM phone app's CarPlay or Android Auto broadcast, or an Apple USB device on the cable, re-published ontoEntityBus.
- Screen-Scoped Keys: Polled only while requested by an active UI:
telemetry.speed(1s): Active duringComfortActivityforeground lifecycle (onResume→onPause) to drive visualizer animations.
- Snapshot Cadence (
telemetry.tick): Published every 15 seconds unconditionally (not diffed) carrying the full vehicle snapshot. This un-diffed tick prevents heartbeat starvation for MQTT and ensures periodic sampling for internal listeners (ChargeSessionandOdoStats).
Dedicated Subsystems
Stateful features requiring independent lifecycle management run dedicated listener interfaces seeded from EntityBus events: ChargeSession, TripSession, ParkSession, CarState, GateState, Obd2Reader, and AbrpUploader.
Home Assistant & MQTT Integration
TelemetryService publishes vehicle metrics to Mosquitto with Home Assistant auto-discovery (homeassistant/<comp>/drivemem_<vin>/<key>/config), registering the vehicle device under Geely EX2 (<last 6 of VIN>) (deduced dynamically from sys.ecarx.vin, or Geely EX2 as fallback).
- Payload scaling: Values from the Geely adaptation layer (battery %, odometer km) are pre-scaled;
div=1is used across fields.ac_onis an adapted boolean. - Transports: Supports TCP LAN (
tcp://<host>:1883) or remote WebSocket (wss://<host>:<port>via Tailscale Funnel). - Validation:
helpers/mqtt_test.pyvalidates discovery and telemetry payloads from an external machine:python3 helpers/mqtt_test.py <broker-ip> <user> <pass>
Smart Gate Controller
Coordinates gate availability and triggers via Home Assistant over two MQTT topics:
drivemem/<vin>/gate/available HA -> app, retained, "online"/"offline"
drivemem/<vin>/gate/open app -> HA, QoS 1, NEVER retained
State & Network Invariants:
- HA computes proximity: The app does not evaluate GPS boundaries. HA evaluates the vehicle's
device_trackerlocation and publishesgate/available. - Availability lifecycle: Gate visibility requires
available && connected.connectionLostimmediately resetsavailableto false to prevent displaying a stale gate button during reconnection before HA pushes fresh state. - Replayed retained messages are ignored: On reconnect/resubscribe, the MQTT broker replays retained messages with the
RETAINflag set.MqttReporterdrops replayed retained"online"messages and waits for a live push to prevent triggering gate visibility from pre-trip state. - Immediate fix on reconnect:
subscribePanel()publishes an immediate GPS position upon reconnection so HA can evaluate proximity without waiting for the next telemetry interval. - Actuation delivery:
gate/openis published with QoS 1 andretained=false(retained actuation commands would re-trigger physical gates upon broker restarts or reconnects). UI taps are debounced for 3 seconds.
Testing gate topics manually:
mosquitto_pub -r -t drivemem/<vin>/gate/available -m online # Show gate button
mosquitto_pub -r -t drivemem/<vin>/gate/available -m offline # Hide gate button
mosquitto_sub -t 'drivemem/<vin>/gate/#' -v # Observe gate open commands
Note on LAN isolation: Access Point / Client Isolation on the local Wi-Fi router blocks TCP between the head unit and broker on port 1883.
UI & Screens
ComfortActivity(LAUNCHER): Three-column dashboard:- Climate: Outside temperature display, comfort ruler (
ComfortRuler), and warmer/colder buttons. - Controls: Recirculation toggle and smart gate opener.
- Visualizer & Context: Full-bleed art view (
SkylineArtView) framing the Home Assistant WebView card (PanelCardView).
- Climate: Outside temperature display, comfort ruler (
TelemetryActivity: Settings screen for MQTT parameters, drive mode/regen defaults, status bar icons, and theme selection.HvacProbe/HvacSet: Diagnostic activities for HVAC reverse engineering and property testing.
Styling & Display
Display Geometry & Sizing
- Native Resolution: 1920x1080 at density 1.00 (
1 dp = 1 px = 1 sp). Screen width is 1920 dp (~5x standard phone width), viewed at ~75 cm. - Layout Implications: Typography and touch targets must account for the 1.00 density and viewing distance. Gesture thresholds and touch boundaries must be defined as fractions of the view or screen dimensions, not fixed dp values (e.g. 44 dp represents only 44 pixels).
Vehicle Hardware Traps
- Property Write Confirmation:
setIntPropertycan return success even if the ECU drops the write.setAmbientColorsweeps candidate area IDs{5, 0, 1}, reads the property back to confirm execution, and caches the working area. - Ambient Light Order of Operations: Brightness
0is the ECU's off state. Setting color while brightness is 0 causes the ECU to discard the color command. Brightness must always be set to non-zero before updating color. CarAccess.connect()Threading: Never invokeCarAccess.connect()on the Android main thread. It blocks waiting forServiceConnection, whose callbacks are dispatched on the main thread, resulting in a deadlock.
Lifecycle & Boot
BootReceiver: Listens forBOOT_COMPLETED(handled viagoAsync()). Re-enables Wi-Fi and starts configured background services.- Head Unit Sleep Behavior: The head unit suspends to RAM rather than performing full shutdowns on short stops.
BOOT_COMPLETEDdoes not fire on resume from sleep, andSCREEN_ONis not delivered to manifest receivers. - Watchdog Timer: A 10-minute
ELAPSED_REALTIME_WAKEUPalarm counts suspended time and triggersensureAllupon wake-up to verify Wi-Fi connectivity and ensure services are running. - Package Updates & Process Kills: APK installation and force-stops cancel pending alarms.
BootReceiverlistens forMY_PACKAGE_REPLACED, andComfortActivity.onResumeinvokesscheduleWatchdog/ensureAllto restore watchdog alarms. - Drive Mode Persistence: Persistent drive mode and regen reapplication is executed by the privileged companion app
com.geely.modehelper(android.uid.system). Drive Assist broadcasts preference updates tomodehelper.
Build & Installation
The build environment requires JDK 17, Android SDK (build-tools 34.0.0, platform-28), hand-crafted compilation stubs (car-stubs/car-stubs.jar), and debug.ks.
Building
To run Gradle directly or run unit tests, execute from the repository root:
./gradlew :drivemem:assembleRelease # compile only from repo root
./gradlew test # run unit tests
- Version Code:
versionCodeis computed from wall-clock minutes since the epoch and injected byaapt2to ensure monotonic increases, preventingpm install -rdowngrade errors. - OTA Publication:
build.shuploadsdrive_assist.apkto Home Assistant's/config/wwwdirectory and broadcasts the update notification ondrivemem/<vin>/update/set.
Installation
adb connect <CAR_IP>:5555
adb install -r drive_assist.apk
Vehicle Configuration CLI Wizard (configure-car.sh)
Instead of typing MQTT credentials, mTLS certificates and ABRP tokens on the car touchscreen, use the interactive terminal wizard:
./tools/configure-car.sh
- Interactive Prompts: Enter values or press
[Enter]to retain existing values. - Multi-Broker: Configures up to 3 MQTT URIs with automatic fallback.
- mTLS Integration: Automatically pushes
.p12client certificates and.crtCA certificates to the app's protected storage with correct Unix permissions (UID 10048). - Safety: Automatically creates timestamped XML backups in
../prefs-backup/and force-stops the app before writing to prevent Android's in-memory SharedPreferences cache from overwriting changes. - CLI Commands:
./tools/configure-car.sh --show # Display current active settings on vehicle ./tools/configure-car.sh --backup-only # Export current car settings to a timestamped file ./tools/configure-car.sh --restore <file> # Restore previous preferences XML backup
Testing Boot Flow Without Rebooting
Do not run adb reboot (it restarts the audio amplifier and causes a loud speaker pop). Simulate boot broadcast instead:
adb shell am broadcast -a android.intent.action.BOOT_COMPLETED -n com.geely.drivemem/.util.BootReceiver
Contributing & Governance
Drive Assist welcomes contributions from automotive software developers and the Geely community!
- Contributing Guidelines: Review CONTRIBUTING.md for the public
next/ release-branch workflow, pre-push PII checks, Conventional Commits, local validation, and vehicle safety rules. - Audits: The dated audits and quality reports are in docs/archive/. They describe the code as it was in September 2026.
- Changelog: See CHANGELOG.md for release notes across all versions and unreleased staging features.
- License: Drive Assist is licensed under the GNU General Public License v3.0. Any distributed modified version must also stay open source under GPLv3.
Credits
- roadcast and Capy, by Timoteo Sousa (Apache-2.0). "Exact energy" runs Timoteo's roadcast CAN reader, unchanged, and starts it the way Capy showed. Capy proved on EX2 cars that this works.
- libuv (MIT), the event loop under roadcast.
Details and licenses: THIRD-PARTY-NOTICES.md.
استكشف مشاريع مشابهة ومرتبطة
جارٍ التحميل…



