👨💻 Development Guide
Architecture
This integration follows the standard custom_component structure but employs modern “Hexagonal” principles where possible:
api.py: Acts as the interface (Port) to the WhatsApp Protocol. Currently a mock, but designed to be swapped with a real library (e.g.,whatsapp-web.jswrapper or python alternative).config_flow.py: Handles the UI-based setup using Home Assistant’s Data Entry Flow.__init__.py: The composition root. Wired up services and event listeners.
Tooling
We use a strict DevOps pipeline:
- Ruff: For linting and formatting (Fast, Rust-based).
- Mypy: For static type checking (Strict mode).
- Pytest: For unit testing.
Commands
Run Linter:
ruff check .
Run Tests:
pytest tests/
Contributing
- Fork the repository.
- Create a branch:
feat/amazing-feature. - Commit your changes (we use Conventional Commits!).
feat: add button supportfix: crash on image upload
- Open a Pull Request.
- Our “Janitor” bot will automatically check your code and even fix simple linting errors for you!