Files
openhmi-nx/CLAUDE.md
T
mangavalkandClaude Opus 5.5 69e22cfb06 openhmi-nx: decode, encode, render Nextion HMI projects; .tft research
Black-box reverse-engineered .HMI format (container, three checksums,
pages, all 31 component types, pictures, fonts), readable JSON, page
renderer matching Nextion Editor, demo project built from code and a
test suite (66 tests). See docs/COVERAGE.md for status.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 15:11:02 +01:00

2.7 KiB

Working on this repo

Python package nxhmi (in src/): read, verify, edit, write and render Nextion Editor .HMI projects, plus research on .tft firmware. No runtime dependencies; Pillow for pictures, fonts and rendering.

Layout

src/nxhmi/
  checksum.py     the three CRCs (page, main.HMI, file table)
  container.py    .HMI file system: tables, entries, Editor-style replace, fresh files
  page.py         pages, components, attributes, event code
  components.py   create components from templates_basic/intelligent.json (Editor defaults)
  enums.py        readable attribute values (names, #rrggbb)
  models.py       display models (id, series, resolution)
  project.py      new projects, add page/picture/font, decode to folder / encode back
  pictures.py     N.i / N.is
  fonts.py        .zi v6 fonts, generation from TrueType
  render.py       page renderer matching the Editor canvas
  tft.py          .tft research helpers (layout table, same-length trailer patch)
  cli.py          python -m nxhmi ...
examples/make_demo.py   builds demo/ (demo.HMI, decoded/, render/)
tests/                  unittest suite; fixtures/demo_editor_saved.HMI = the demo re-saved by the Editor
tools/                  template generator
docs/                   FORMAT.md (spec), RENDER.md, COVERAGE.md, NOTES.md (open points, what was tried)

Commands

python -m unittest discover -s tests          # all tests (run from the repo root)
python examples/make_demo.py                  # rebuild demo/ after changing writers or the renderer
PYTHONPATH=src python -m nxhmi verify demo/demo.HMI

After rebuilding the demo, tests/test_project.py::Demo must still pass: the generated demo has to stay byte-identical to the Editor's re-save in tests/fixtures/. If a deliberate change breaks that, re-save the demo with Nextion Editor (open, File > Save As) and replace the fixture.

Rules

  • Black-box only. Formats are worked out by changing projects in Nextion Editor and comparing files, or by asking the Editor whether a hand-made file loads. Never decompile, decrypt or patch Nextion software.
  • Never commit Nextion's files: no .tft output (it embeds Nextion firmware), nothing from the Editor's install folder, no third-party projects. Test data is generated (examples/) or is our own demo re-saved by the Editor.
  • Every format claim in docs/FORMAT.md needs evidence (byte-identical Editor output, or the Editor accepting a file we wrote). Mark guesses as OPEN.
  • Keep docs/COVERAGE.md and the README coverage table current when something is added.
  • Writers must stay byte-identical to the Editor where we have samples; add a test when a new rule is learned (see tests/test_render.py for the style: one rule, one measured expectation).