Skip to content

feat: add packet capture mode for field discovery#18

Open
srleach wants to merge 2 commits intomainfrom
feat/packet-capture-mode
Open

feat: add packet capture mode for field discovery#18
srleach wants to merge 2 commits intomainfrom
feat/packet-capture-mode

Conversation

@srleach
Copy link
Copy Markdown
Owner

@srleach srleach commented Apr 9, 2026

Summary

Add a capture mode to spa2mqtt that logs packets with decoded fields for field discovery.

Usage

Option 1: Environment variable

CAPTURE_MODE=true python -m spa2mqtt.main

Option 2: YAML config

spa:
  capture_mode: true
  # ... other config

Output

Creates a CSV file with columns:

  • timestamp (ISO format)
  • raw_hex (full packet as hex)
  • packet_type (enum name or hex)
  • channel (channel number)
  • decoded_fields (dict of decoded values from config)

Use Case

Run with the spa in different states (heater on/off, pumps on different settings, different temperatures) to capture packets. Then use dev/field_discovery.py to analyze the CSV and identify unknown fields.

srleach added 2 commits April 9, 2026 23:32
- 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.
- Add capture_mode flag (env var CAPTURE_MODE=true or config option)
- Capture mode writes CSV with: timestamp, raw_hex, packet_type, channel, decoded_fields
- Useful for debugging new spa models and discovering unknown fields
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