Skip to content

Refuse lossy writes and handle faulty charger data - #48

Merged
Varitras merged 6 commits into
mainfrom
fix/device-data
Nov 1, 2026
Merged

Varitras merged 6 commits into
mainfrom
fix/device-data

Conversation

@Varitras

@Varitras Varitras commented Nov 1, 2026

Copy link
Copy Markdown
Owner

Two fixes from a review of the integration's handling of charger data.

  • Writes: the client converted each value to the type the API definition declares, even when that changed it. The lock option "Never locked" (3) reached the charger as true, the same as "Locked when car is connected", and a next-trip energy with a fraction was cut off. A conversion that would change the value is now refused; bac declares no type (a bool before firmware 38.5, a number since), and the trip energy is rounded.
  • Faulty data: a value too long for a state reads unknown instead of landing whole in Home Assistant's error log; a short reading list no longer freezes Charging power or the power factors; a true where a number belongs shows as unknown; current presets stay within the model's range (and none for an unknown model); a frame that cannot be read is skipped and the connection stays up.
  • Diagnostics: a Wi-Fi key sent as text, the network name in wss, the load balancing members and the last ID chip read are redacted; every field the definition declares without a type now has a redaction decision.

The lock option "never locked" (3) went out as true, a trip energy
with a fraction lost it.
bac is a number since firmware 38.5, so the definition declares no type
for it; the trip energy is rounded before it is sent.
Texts too long for a state, short reading lists, a true for a number,
presets out of range, frames that fail, and secrets in unknown fields.
A frame that fails is skipped like an unreadable one, and the
diagnostics download decides every field declared without a type.
An unknown charger model, a true for a numbered option, a value nested
too deep, a list too long for a state, and empty values in redaction.
Presets need a known model instead of failing every select, a bool
matches no numbered label, and any value too long for a state is unknown.
@Varitras
Varitras merged commit e3d8f73 into main Nov 1, 2026
7 checks passed
@Varitras
Varitras deleted the fix/device-data branch November 1, 2026 21:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant