Commit 3a4ca23
committed
feat(eu-data-act): adopt 4 fixes from HA_VAG fork (sentinel filter, aliases, sum-fallback)
Cherry-picked from mikrohard/HA_VAG-EU-Data-Act (the active Cupra-specific
fork with substantially more curation than the original mikrohard repo).
#1 Sentinel value filtering (lib/euDataAct.js isSentinelReading)
Portal emits 65535 / 2147483647 / 4294967295 when a sensor has no
current reading, plus field-specific sentinels: -1 for
remaining_charging_time, 0/1 for tyre_pressure_*. Without this an
odometer can read 4 billion km and tyre pressure 0 bar. Filtered
values are skipped entirely — better an absent state than garbage.
#4 Usability filter in the duplicate tie-break
When the same dataFieldName arrives multiple times in one dataset, a
usable reading now always beats a sentinel regardless of monotonic
or last-occurrence semantics. Builds on #1.
#5 sum_fallback for cruising_range_combined
PHEVs (Passat GTE, Golf GTE, Cupra Terramar) often leave the combined
range empty while reporting cruising_range_primary_engine and
cruising_range_secondary_engine individually. Fill the combined
total from the two components, but only when the portal omits it.
#6 Field-name aliases
remaining_climatisation_time -> remaining_climate_time
charging_plug1_connectionstate -> plug_state
Cupra Terramar PHEV uses non-standard names for these; aliasing keeps
the state path consistent with ID.x cars so vis scripts work cross-
model.
Verified with 9 test cases including the real VW_connect.json dataset:
mileage still resolves to 82 (the prior monotonic fix), sentinels are
filtered, aliases land at the canonical path, sum_fallback only fires
when the primary field is missing.
Explicitly NOT adopted from the fork:
- unit conversions (deci-kWh, hectometers) — risk of double-halving when
a vehicle reports in normal units and our heuristic gets it wrong.
- value/state field renames — would break user scripts referencing
existing state paths without migration.
- local dataset cache — ioBroker's history recorder already retains the
last value across restarts.
- freshness-aware merge / escalating backoff — pure polish, no end-user
data-correctness impact.1 parent 3c9af4d commit 3a4ca23
1 file changed
Lines changed: 91 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
324 | 324 | | |
325 | 325 | | |
326 | 326 | | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
327 | 373 | | |
328 | 374 | | |
329 | 375 | | |
330 | 376 | | |
331 | 377 | | |
332 | 378 | | |
| 379 | + | |
333 | 380 | | |
334 | 381 | | |
335 | 382 | | |
| |||
347 | 394 | | |
348 | 395 | | |
349 | 396 | | |
350 | | - | |
| 397 | + | |
351 | 398 | | |
| 399 | + | |
352 | 400 | | |
| 401 | + | |
353 | 402 | | |
354 | | - | |
| 403 | + | |
355 | 404 | | |
356 | 405 | | |
357 | 406 | | |
358 | 407 | | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
359 | 419 | | |
360 | 420 | | |
361 | 421 | | |
| |||
371 | 431 | | |
372 | 432 | | |
373 | 433 | | |
| 434 | + | |
374 | 435 | | |
375 | 436 | | |
376 | 437 | | |
377 | 438 | | |
378 | 439 | | |
379 | 440 | | |
| 441 | + | |
380 | 442 | | |
381 | 443 | | |
382 | 444 | | |
383 | 445 | | |
384 | 446 | | |
385 | | - | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
386 | 453 | | |
387 | 454 | | |
388 | 455 | | |
| |||
397 | 464 | | |
398 | 465 | | |
399 | 466 | | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
400 | 488 | | |
401 | 489 | | |
402 | 490 | | |
| |||
0 commit comments