Repository navigation
fix(sniffer): history raw per address; annotation wins over template - #122
Merged
madejackson merged 1 commit intoOct 19, 2026
Merged
Conversation
…over template - getRegisterHistoryFlat: a block read (e.g. addr 0..7) is now split into one row PER register address, each carrying only its own word for raw and value interpretation. Previously the whole word block was attached to the first address, so 'raw' showed values of neighbouring registers. - The manual annotation (pencil: converter/uom/description) is now carried from the stored register row into history rows and takes precedence over the template spec - previously it was only honoured when no template owned the register. A parseable formula is applied directly; a bare uom/description annotation falls through to the template interpretation but keeps the annotated unit/description. - add unit tests for both behaviours.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
1. History „Raw" zeigt zu viele Wörter
Ein Block-Read (z.B. addr 0–7, 8 Regs) wurde als eine Zeile mit
address = t.addressgespeichert.rawValuewar der komplette Wort-String (249 0 0 0 0 521 0 0) — auf der Zeile von addr 0. Der User will in der History jede Adresse als eigene Zeile sehen, deren Raw exakt das Wort an dieser Adresse ist.2. Annotation (Bleistift) wurde vom Template überschrieben
enrichRegisterließ eine manuelle Annotation nur gelten, wenn kein Template (specKey) die Adresse besitzt (row.annotated && !row.specKey). War einem Register ein Template zugeordnet (z.B. thermokon-wrf06), gewann das Template immer — die vom User über den Stift gesetzte UOM (°F) und Converter-Formel wurden ignoriert. Außerdem trug der History-Pfad die Annotation gar nicht erst aus dem Store in die Zeile.Lösung
getRegisterHistoryFlat: ein Response-Telegramm wird pro Wort in eine Zeile pro Adresse gesplittet (address = base + idx,words = [word],rawValue = String(word)). Die Adressen-Filterung (&address=) wird auf die aufgelöste Adresse angewendet.converter/uom/description/annotated) wird aus der gespeicherten Register-Zeile in die History-Zeile übernommen und inenrichRegistervor dem Template ausgewertet:number * 2) → wird direkt angewendet;°F) → fällt zur Template-Interpretation durch, behält aber die annotierte Einheit/Beschreibung.backend/tests/server/snifferService_history_test.ts).Tests
npx vitest run --config vitest.config.mts→ 646 passed / 7 skipped, keine Failuresnpx tsc --project tsconfig.production.json→ okeslintauf geänderte Dateien → 0 Errors (nur vorbestehende Warning)Verhalten nach dem Fix (History, Slave 5, thermokon-wrf06, 8-Wort-Read)
24924.9°C0%000521521ppm00Annotierte °F-Zeile (addr 0,
uom: °F,converter: number, Template zugeordnet):raw 250,value 25,uom °F,description Temperature.