Implementing Remote Car Lock/Unlock via Mobile App
Remote car lock control—seems simpler than remote engine start, but has technical nuances: different TCU types control central lock differently, GSM command delays critical when user stands by car, and wrong lock status handling creates situations where app shows one thing, car does another.
Control via TCU: Relays and CAN Bus
Simple way—TCU with relay on central lock wires (signal wire for lock/unlock). Works on any car, no CAN adapter needed. Downside: no feedback on actual lock state—only "command sent".
Advanced way—CAN integration (Teltonika FMB003 + CAN adapter, LAWIG, Fortin EVO). TCU reads CAN bus and knows real state of doors, locks, hood. Feedback: send lock command → status "doors locked" from CAN.
data class VehicleLockStatus(
val frontLeftDoor: DoorState,
val frontRightDoor: DoorState,
val rearLeftDoor: DoorState,
val rearRightDoor: DoorState,
val trunk: DoorState,
val centralLock: LockState,
val lastUpdated: Instant,
)
enum class DoorState { OPEN, CLOSED }
enum class LockState { LOCKED, UNLOCKED, UNKNOWN }
Lock Command and Confirmation
Lock command—simplified confirmation vs engine start, but not absence of protection:
suspend fun lockDoors(carId: Long): LockCommandResult {
val status = api.getVehicleStatus(carId)
// Warning if door open—locking with open door is odd
if (status.anyDoorOpen) {
return LockCommandResult.Warning(
message = "Open: ${status.openDoors.joinToString()}",
canProceed = true,
)
}
val command = LockCommand(
carId = carId,
action = LockAction.LOCK,
userId = currentUser.id,
timestamp = Instant.now().epochSecond,
)
return api.sendLockCommand(command)
}
UX: Response in Poor GSM
User stands by car and taps "Lock"—command goes through cellular and may delay 5-20 seconds. Optimistic UI doesn't work here—can't show "Locked" before confirmation: user leaves thinking car is locked.
Right model: button → "Sending..." → "Delivered" → await lock status change (from CAN) → "Locked" or "Timeout - check car".
Stream<LockCommandState> watchLockCommand(String commandId) async* {
yield LockCommandState.sending;
final delivered = await api.awaitCommandDelivery(commandId,
timeout: const Duration(seconds: 15));
if (!delivered) { yield LockCommandState.deliveryFailed; return; }
yield LockCommandState.delivered;
// Wait for lock status change
final confirmed = await vehicleStatusStream
.where((s) => s.centralLock == LockState.LOCKED)
.first
.timeout(const Duration(seconds: 30));
yield LockCommandState.confirmed;
}
Digital Key: UWB and NFC
Apple CarKey (iOS 14+) and Google Digital Car Key (Android 12+)—standards for remote lock via UWB (Ultra Wideband) for passive entry and NFC for fallback. Require automaker support (BMW, Hyundai, Genesis). Custom apps—CCC (Car Connectivity Consortium) Digital Key spec, via PassKit on iOS and DigitalKeyService in Google Wallet API.
Developing remote car lock control with status feedback: 3–5 weeks (within telematics app). Cost individually quoted after TCU API analysis.







