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:
@@ -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,
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user