Skip to content

v0.78.1 — Nivona brand profile refactored into per-family package

Choose a tag to compare

@dzerik dzerik released this 28 May 10:39
· 29 commits to main since this release
af9e0ee

Pure-refactor release. No user-facing behavior changes.

Refactored

brands/nivona.py split into a package. The 1277-line monolith becomes brands/nivona/ with one module per concern and per coffee-machine family:

brands/nivona/
  __init__.py          NivonaProfile + dispatch loop
  _crypto.py           NIVONA_RC4_KEY, NIVONA_HU_TABLE (brand-wide)
  _options.py          Setting-option enums (hardness, auto-off, …)
  _registers.py        RECIPE/TEMP/MYCOFFEE register bases + helpers
  _stats_helpers.py    _count / _pct / _flag factories
  _prefixes.py         serial→family + MODEL_OVERRIDES + EXCLUDE
  _family_600.py       NICR 6xx
  _family_700.py       NICR 7xx + 79x
  _family_900.py       NICR 9xx + 9xx-light
  _family_1030.py      NICR 1030 + 1040
  _family_8000.py      NIVO 8xxx + chilled-brew selectors

Each family module exposes a single EXPORTS = {family_key: {...}} dict; nivona/__init__.py merges them in a loop and slices off per-aspect dispatch tables. Adding a new family is now: drop in _family_NEW.py with an EXPORTS entry, add the module to the loop tuple, register the serial-prefix in _prefixes.py.

External imports through brands.nivona (NivonaProfile, mycoffee_layout, mycoffee_register, MY_COFFEE_BASE_REGISTER, MY_COFFEE_SLOT_STRIDE, TEMP_RECIPE_TYPE_REGISTER) are preserved unchanged.

Fixed

NivonaProfile.parse_status lazy-import regression. Its from ..const import … / from ..protocol import MachineStatus referenced the wrong relative path after the file moved one level deeper into the new package, so any HX status frame would have crashed with ModuleNotFoundError. Re-pointed at ...const / ...protocol and added two regression tests pinning the 8000 (process=3 → READY) and 700 (process=11 → PRODUCT) process-code dispatch. The previous test suite never exercised parse_status at all.

Tests

  • 992 passed (was 990 on v0.78.0).
  • 2 new regression tests in tests/test_brands.py for parse_status.

Files

  • 1 file deleted (brands/nivona.py), 11 files added (brands/nivona/*.py).
  • __init__.py is now 368 lines; the largest family module is _family_1030.py at 248 lines.

Full changelog · PR #27