Skip to content

refactor: architecture cleanup with protocol abstraction layer#16

Open
srleach wants to merge 1 commit intomainfrom
refactor/architecture-cleanup
Open

refactor: architecture cleanup with protocol abstraction layer#16
srleach wants to merge 1 commit intomainfrom
refactor/architecture-cleanup

Conversation

@srleach
Copy link
Copy Markdown
Owner

@srleach srleach commented Apr 9, 2026

Summary

  • Add protocol abstraction layer for cleaner spa-type isolation
  • Standardize YAML config schemas
  • Add 17 tests and architecture documentation

Changes

Protocol Layer (NEW)

  • spa2mqtt/protocols/__init__.py - Protocol abstraction with Plaintext and JacuzziEncrypted implementations

YAML Standardization

  • Fixed binary_sensor: Truetype: binary_sensor in jacuzzi_j335_unencrypted_farenheit.yml

Base Class Refactoring

  • Renamed JacuzziUnencryptedMessageFactoryMessageFactory
  • Added protocol injection to Spa base class
  • Added with_protocol() method to Packet

Tests & Docs

  • 17 passing tests in tests/
  • Architecture documentation in docs/ARCHITECTURE.md

Testing

All 17 tests pass:

pytest tests/ -v

- Phase 1: Standardize YAML config (binary_sensor: True -> type: binary_sensor)
- Phase 2: Add protocol abstraction (Protocol, PlaintextProtocol, JacuzziEncryptedProtocol)
- Phase 3: Refactor base classes (MessageFactory rename, protocol injection in Spa)
- Phase 4: Add tests and docs (17 tests, ARCHITECTURE.md)

The protocol layer now cleanly separates decoding logic from packet parsing,
making it easy to add new spa types without duplicating infrastructure.
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