# 🚗 LumaBMW - BMW Headlight Show Controller

LumaBMW is a Python application that communicates directly with your BMW's ECU (such as **FEM_20**, **BDC_BODY**, or **FRM_70**) using the BMW **EDIABAS COM API** to play custom headlight animations and light shows from JSON sequence files.

It sends official BMW diagnostic jobs to the lighting control module, allowing synchronized control of DRLs, indicators, low beams, high beams, fog lights, brake lights, reverse lights, and many other supported outputs.

> ⚠️ **DISCLAIMER**
>
> This software communicates directly with your vehicle's electronic control units (ECUs). Use it entirely at your own risk.
>
> Always ensure:
>
> - Your vehicle battery is healthy or connected to a battery charger/power supply.
> - The ignition remains ON throughout playback.
> - You understand what each lighting command does before executing it.
>
> The author is **not responsible** for any damage, battery drain, diagnostic faults, or ECU issues resulting from the use of this software.

---

# 📋 Requirements

## Operating System

- Windows 10/11

## Hardware

- ENET Cable (F/G/I Series BMW)
- OR K+DCAN Cable (E Series BMW)

## Software

- BMW Standard Tools 2.12 (EDIABAS, INPA, Tool32)
- Python **3.11 (32-bit ONLY)**

---

# ⚠️ IMPORTANT: 32-Bit Python is REQUIRED

BMW's **EDIABAS COM interface is a 32-bit COM object.**

That means:

✅ 32-bit Python works

❌ 64-bit Python DOES NOT WORK

If you attempt to run LumaBMW using 64-bit Python, you will receive errors similar to:

```text
pywintypes.com_error:
(-2147221164, 'Class not registered', None, None)
```

or

```text
Class not registered
```

This is **not** a bug in LumaBMW.

It simply means Windows cannot load the 32-bit EDIABAS COM server from a 64-bit Python process.

---

# 🚀 Installation Guide

## Step 1 — Install BMW Standard Tools

Install **BMW Standard Tools 2.12**, which includes:

- INPA
- Tool32
- WinKFP
- EDIABAS

After installation, verify these folders exist:

```text
C:\EDIABAS\
```

and

```text
C:\EDIABAS\Ecu\
```

Inside the **Ecu** folder you should have your ECU PRG files, for example:

```text
FEM_20.prg
BDC_BODY.prg
FRM_70.prg
```

depending on your vehicle.

---

## Step 2 — Configure EDIABAS

Open:

```text
C:\EDIABAS\Bin\ediabas.ini
```

Find:

```ini
Interface =
```

Set it according to your cable.

### ENET Cable

```ini
Interface = ENET
```

### K+DCAN Cable

```ini
Interface = STD:OBD
```

Save the file.

---

## Step 3 — Verify Your BMW Connection

Before using LumaBMW, ensure your computer can already communicate with the car.

Open:

- INPA
- OR Tool32

Confirm that:

- Vehicle is detected
- ECU communication works
- You can read data from FEM/BDC/FRM

> **If Tool32 cannot communicate with your car, LumaBMW will not work.**

---

## Step 4 — Install Python 3.11 (32-bit)

Even on a 64-bit Windows installation, install the **32-bit** version of Python.

Download:

https://www.python.org/downloads/windows/

Choose:

> **Windows installer (32-bit)**

During installation:

✅ Check

```text
Add python.exe to PATH
```

---

## Step 5 — Install Required Python Packages

Open Command Prompt.

Install **pywin32** using the **32-bit Python interpreter**.

```cmd
py -3.11-32 -m pip install pywin32
```

Verify installation:

```cmd
py -3.11-32 -m pip show pywin32
```

---

# ▶️ Running LumaBMW

1. Connect your ENET or K+DCAN cable.

2. Turn the vehicle ignition ON.

3. Ensure diagnostic mode is active.

4. Place your JSON sequence inside the project.

Example:

```text
decrypted/headlight_show_beams.json
```

5. Open Command Prompt inside the project folder.

6. Run:

```cmd
py -3.11-32 lumabmw.py
```

The application will:

- Connect to EDIABAS
- Load the selected ECU
- Enter diagnostic mode
- Execute every lighting command from the JSON sequence
- Turn all lights OFF after playback completes

---

# 📁 JSON Sequence Files

Example:

```text
decrypted/
    breathing.json
    police.json
    strobe.json
    startup.json
```

Each JSON file contains timestamped lighting events.

Example:

```json
{
    "time": 250,
    "channel": "LOW_BEAM",
    "state": true
}
```

---

# ⚙️ Configuration

Open:

```text
lumabmw.py
```

Modify the configuration variables.

Example:

```python
JSON_FILE = "decrypted/headlight_show_beams.json"

ECU_MODULE = "FEM_20"
```

Common ECU modules:

| Vehicle | Module |
|----------|---------|
| BMW F30 | `FEM_20` |
| BMW F32 | `BDC_BODY` |
| BMW F80 | `BDC_BODY` |
| BMW E90 | `FRM_70` |
| BMW E60 | `LM2` |

---

# 🔧 Job Names

Different BMW modules expose different diagnostic jobs.

Most vehicles use:

```text
steuern_routine
```

Some require:

```text
steuern_io
```

If the console reports command failures, change the job name inside the script accordingly.

---

# ❓ Troubleshooting

## Class not registered

```text
pywintypes.com_error
Class not registered
```

Cause:

You're running **64-bit Python**.

Solution:

Run using:

```cmd
py -3.11-32 lumabmw.py
```

---

## ModuleNotFoundError: win32com

Example:

```text
ModuleNotFoundError:
No module named 'win32com'
```

Install pywin32:

```cmd
py -3.11-32 -m pip install pywin32
```

---

## Could not connect to EDIABAS

Possible causes:

- BMW Standard Tools not installed
- EDIABAS not configured
- Wrong Interface setting
- ISTA currently using EDIABAS
- Cable disconnected

---

## ECU Not Found

Example:

```text
FEM_20.prg not found
```

Verify:

```text
C:\EDIABAS\Ecu\
```

contains the required PRG file.

---

## Vehicle Rejects Commands

Possible causes:

- Wrong ECU selected
- Wrong job name
- Ignition OFF
- Unsupported vehicle

Try changing:

```text
steuern_routine
```

to

```text
steuern_io
```

inside the script.

---

## Nothing Happens

Check:

- Ignition is ON
- Cable is connected
- EDIABAS interface is correct
- Tool32 successfully communicates with the ECU
- Correct ECU module is selected
- JSON sequence contains valid channels

---

# 🧰 Tested Environment

- Windows 10 / Windows 11
- Python 3.11 (32-bit)
- BMW Standard Tools 2.12
- EDIABAS
- Tool32
- ENET Cable
- BMW F30 (FEM_20)

---

# ❤️ Credits

Built for the BMW enthusiast community.

Powered by:

- BMW EDIABAS
- Tool32
- Python
- pywin32

---

# 📄 License

This project is provided for educational and personal use only.

BMW®, EDIABAS®, INPA®, Tool32®, and related trademarks belong to their respective owners.