|
| 1 | +# Contributing to LuxCloud |
| 2 | + |
| 3 | +Thank you for taking the time to contribute! This guide explains how to get set up and what to expect when submitting changes. |
| 4 | + |
| 5 | +--- |
| 6 | + |
| 7 | +## Table of contents |
| 8 | + |
| 9 | +- [Reporting bugs](#reporting-bugs) |
| 10 | +- [Requesting features](#requesting-features) |
| 11 | +- [Development setup](#development-setup) |
| 12 | +- [Running tests](#running-tests) |
| 13 | +- [Submitting a pull request](#submitting-a-pull-request) |
| 14 | +- [Code style](#code-style) |
| 15 | + |
| 16 | +--- |
| 17 | + |
| 18 | +## Reporting bugs |
| 19 | + |
| 20 | +Before opening a bug report, please: |
| 21 | + |
| 22 | +1. Check the [troubleshooting section](README.md#troubleshooting) in the README |
| 23 | +2. Search [existing issues](https://github.com/BeardedTech0o/ha-luxcloud/issues) to avoid duplicates |
| 24 | +3. Collect your HA logs: **Settings → System → Logs** — filter by `luxcloud` |
| 25 | + |
| 26 | +Then open a [Bug Report](https://github.com/BeardedTech0o/ha-luxcloud/issues/new?template=bug_report.yml) and fill in the template. |
| 27 | + |
| 28 | +--- |
| 29 | + |
| 30 | +## Requesting features |
| 31 | + |
| 32 | +Open a [Feature Request](https://github.com/BeardedTech0o/ha-luxcloud/issues/new?template=feature_request.yml) describing the use case and what you'd like to see. |
| 33 | + |
| 34 | +--- |
| 35 | + |
| 36 | +## Development setup |
| 37 | + |
| 38 | +### Prerequisites |
| 39 | + |
| 40 | +- Python 3.12+ |
| 41 | +- A LuxPower inverter and cloud account (or willingness to mock the API) |
| 42 | + |
| 43 | +### Getting started |
| 44 | + |
| 45 | +```bash |
| 46 | +# Clone the repo |
| 47 | +git clone https://github.com/BeardedTech0o/ha-luxcloud.git |
| 48 | +cd ha-luxcloud |
| 49 | + |
| 50 | +# Create a virtual environment |
| 51 | +python -m venv venv |
| 52 | +source venv/bin/activate # Windows: venv\Scripts\activate |
| 53 | + |
| 54 | +# Install test dependencies |
| 55 | +pip install -r requirements_test.txt |
| 56 | +``` |
| 57 | + |
| 58 | +### Folder structure |
| 59 | + |
| 60 | +``` |
| 61 | +custom_components/luxcloud/ ← integration source |
| 62 | +tests/ ← pytest test suite |
| 63 | +.github/ ← CI workflows and issue templates |
| 64 | +``` |
| 65 | + |
| 66 | +--- |
| 67 | + |
| 68 | +## Running tests |
| 69 | + |
| 70 | +```bash |
| 71 | +pytest tests/ -v |
| 72 | +``` |
| 73 | + |
| 74 | +To run with coverage: |
| 75 | + |
| 76 | +```bash |
| 77 | +pytest tests/ --cov=custom_components/luxcloud --cov-report=term-missing |
| 78 | +``` |
| 79 | + |
| 80 | +### Validators |
| 81 | + |
| 82 | +```bash |
| 83 | +# hassfest — checks manifest, strings, and HA conventions |
| 84 | +docker run --rm -v "$(pwd)":/github/workspace homeassistant/hassfest |
| 85 | + |
| 86 | +# HACS — checks repo structure for HACS compatibility |
| 87 | +docker run --rm -v "$(pwd)":/github/workspace ghcr.io/hacs/action |
| 88 | +``` |
| 89 | + |
| 90 | +--- |
| 91 | + |
| 92 | +## Submitting a pull request |
| 93 | + |
| 94 | +1. **Fork** the repository and create a branch from `main`: |
| 95 | + ```bash |
| 96 | + git checkout -b feature/my-improvement |
| 97 | + ``` |
| 98 | + |
| 99 | +2. **Make your changes** — keep commits focused and atomic |
| 100 | + |
| 101 | +3. **Add or update tests** for any changed behaviour |
| 102 | + |
| 103 | +4. **Run the full test suite** and both validators before pushing |
| 104 | + |
| 105 | +5. **Update [CHANGELOG.md](CHANGELOG.md)** under `[Unreleased]` |
| 106 | + |
| 107 | +6. **Open a PR** against the `main` branch and fill in the pull request template |
| 108 | + |
| 109 | +PRs that break existing tests, fail the validators, or lack a changelog entry will not be merged until those are resolved. |
| 110 | + |
| 111 | +--- |
| 112 | + |
| 113 | +## Code style |
| 114 | + |
| 115 | +- Follow existing patterns in the codebase |
| 116 | +- Use `from __future__ import annotations` in all Python files |
| 117 | +- Keep functions small and focused |
| 118 | +- Add a comment only when the **why** is non-obvious — avoid restating what the code already says |
| 119 | +- Entity descriptions should include `translation_key` so names are translatable |
| 120 | +- All new entities need a corresponding entry in `strings.json`, `translations/en.json`, and `icons.json` |
| 121 | + |
| 122 | +--- |
| 123 | + |
| 124 | +## Questions? |
| 125 | + |
| 126 | +Open a [Discussion](https://github.com/BeardedTech0o/ha-luxcloud/discussions) for anything that doesn't fit a bug report or feature request. |
0 commit comments