data_model: split windows out of doors into own domain

- Add extract_windows() and register 'windows' in ALL_DOMAINS
- Remove windows extraction from extract_doors; no more double keys
- extract_windows also captures the overall windows.open_state

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-27 21:53:26 +02:00
co-authored by Claude Sonnet 4.6
parent 4dcf2ee6aa
commit 63e807bdb0
2 changed files with 10 additions and 1 deletions
+9
View File
@@ -198,7 +198,15 @@ def extract_doors(vehicle) -> dict | None:
except Exception:
log.debug("vehicle.doors unavailable", exc_info=True)
return result or None
def extract_windows(vehicle) -> dict | None:
result: dict = {}
try:
if vehicle.windows.open_state.value is not None:
result["open_state"] = _str(vehicle.windows.open_state)
window_entries = {}
for name, win in vehicle.windows.windows.items():
if win.open_state.value is not None:
@@ -219,6 +227,7 @@ ALL_DOMAINS: dict[str, Callable] = {
"vehicle": extract_vehicle,
"position": extract_position,
"doors": extract_doors,
"windows": extract_windows,
}
+1 -1
View File
@@ -18,7 +18,7 @@ Usage examples
# Override domains on the CLI:
python -m server.main -c credentials/alex.json -d charging,measurements
Available domains: charging, climatisation, electric_drive, connectivity, vehicle, position, doors
Available domains: charging, climatisation, electric_drive, connectivity, vehicle, position, doors, windows
Credentials file format (JSON)
-------------------------------