data_model: add extract_all() using Dashboard instruments as primary snapshot

Replaces the domain-based collect_snapshot with extract_all(), which iterates
all supported instruments via vw_dashboard.Dashboard. Each entry is stored as
{value, unit, str_state} grouped by component type. Units are validated against
a whitelist and normalised (d→days, °C→degC); unrecognised units are dropped.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-29 20:55:07 +02:00
co-authored by Claude Sonnet 4.6
parent f9dd96269e
commit 6e340a9582
2 changed files with 71 additions and 2 deletions
+2 -2
View File
@@ -6,7 +6,7 @@ from datetime import datetime, timezone
from pathlib import Path
from . import log_config, network, we_connect
from .data_model import ALL_DOMAINS, collect_snapshot, apply_procedural
from .data_model import ALL_DOMAINS, apply_procedural, extract_all
from .storage_helpers import auto_out_path, load_last_24h_records, load_store, save_store
from jaydiff.diff import diff_full as jay_diff_full
@@ -85,7 +85,7 @@ def run(args: argparse.Namespace) -> None:
try:
we_connect.update(wc)
snapshot = collect_snapshot(vehicle, domains)
snapshot = extract_all(vehicle)
apply_procedural(snapshot)
store["records"].append(snapshot)
save_store(out, store, args.max_records)