Skip to content

Commit 946be29

Browse files
BeardedTech0oclaude
andcommitted
Fix API connectivity: update login endpoint and authentication for new LuxCloud backend
Rewrites api.py to use the SaToken-based login endpoint with form-encoded credentials and a token header, and fixes API_URLS in const.py to point to the correct servers (server.luxpowertek.com/WManage and eu.luxpowertek.com/WManage). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 86a3ff1 commit 946be29

34 files changed

Lines changed: 2494 additions & 1 deletion
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
name: Bug Report
2+
description: Something isn't working as expected
3+
title: "[Bug]: "
4+
labels: ["bug", "needs-triage"]
5+
body:
6+
- type: markdown
7+
attributes:
8+
value: |
9+
Thanks for taking the time to report a bug. Please fill in as much detail as possible to help us diagnose the issue quickly.
10+
11+
- type: checkboxes
12+
id: preflight
13+
attributes:
14+
label: Before you submit
15+
options:
16+
- label: I have searched existing issues and this is not a duplicate
17+
required: true
18+
- label: I have read the [troubleshooting guide](https://github.com/BeardedTech0o/ha-luxcloud#troubleshooting)
19+
required: true
20+
- label: I am using the latest version of LuxCloud
21+
required: true
22+
23+
- type: input
24+
id: ha_version
25+
attributes:
26+
label: Home Assistant version
27+
placeholder: e.g. 2024.5.3
28+
validations:
29+
required: true
30+
31+
- type: input
32+
id: integration_version
33+
attributes:
34+
label: LuxCloud version
35+
placeholder: e.g. 1.0.0
36+
validations:
37+
required: true
38+
39+
- type: input
40+
id: inverter_model
41+
attributes:
42+
label: Inverter model
43+
placeholder: e.g. LXP 5kW Hybrid
44+
validations:
45+
required: false
46+
47+
- type: textarea
48+
id: description
49+
attributes:
50+
label: What happened?
51+
description: A clear description of the bug.
52+
validations:
53+
required: true
54+
55+
- type: textarea
56+
id: expected
57+
attributes:
58+
label: What did you expect to happen?
59+
validations:
60+
required: true
61+
62+
- type: textarea
63+
id: steps
64+
attributes:
65+
label: Steps to reproduce
66+
placeholder: |
67+
1. Go to ...
68+
2. Click on ...
69+
3. See error
70+
validations:
71+
required: true
72+
73+
- type: textarea
74+
id: logs
75+
attributes:
76+
label: Relevant log output
77+
description: |
78+
Paste any relevant lines from **Settings → System → Logs** filtered by `luxcloud`.
79+
These will be automatically formatted as code.
80+
render: text
81+
validations:
82+
required: false
83+
84+
- type: textarea
85+
id: additional
86+
attributes:
87+
label: Additional context
88+
description: Anything else that might be relevant.
89+
validations:
90+
required: false

‎.github/ISSUE_TEMPLATE/config.yml‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
blank_issues_enabled: false
2+
contact_links:
3+
- name: Ask a question
4+
url: https://github.com/BeardedTech0o/ha-luxcloud/discussions
5+
about: Use Discussions for questions, ideas, and general conversation
6+
- name: Home Assistant Community Forum
7+
url: https://community.home-assistant.io
8+
about: General Home Assistant help and discussion
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Feature Request
2+
description: Suggest an idea or improvement
3+
title: "[Feature]: "
4+
labels: ["enhancement"]
5+
body:
6+
- type: markdown
7+
attributes:
8+
value: |
9+
Thanks for suggesting an improvement! Please describe your use case clearly so we can understand the value it would bring.
10+
11+
- type: checkboxes
12+
id: preflight
13+
attributes:
14+
label: Before you submit
15+
options:
16+
- label: I have searched existing issues and this has not been requested before
17+
required: true
18+
19+
- type: textarea
20+
id: problem
21+
attributes:
22+
label: What problem does this solve?
23+
description: Describe the use case or limitation you're running into.
24+
placeholder: "I'd like to be able to... because..."
25+
validations:
26+
required: true
27+
28+
- type: textarea
29+
id: solution
30+
attributes:
31+
label: Proposed solution
32+
description: How would you like this to work? What would the new entity, service, or behaviour look like?
33+
validations:
34+
required: true
35+
36+
- type: textarea
37+
id: alternatives
38+
attributes:
39+
label: Alternatives considered
40+
description: Have you found any workarounds or alternative approaches?
41+
validations:
42+
required: false
43+
44+
- type: textarea
45+
id: additional
46+
attributes:
47+
label: Additional context
48+
description: Screenshots, links, or anything else that helps explain the request.
49+
validations:
50+
required: false

‎.github/PULL_REQUEST_TEMPLATE.md‎

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
## Summary
2+
3+
<!-- What does this PR do? Why is it needed? -->
4+
5+
## Type of change
6+
7+
- [ ] Bug fix
8+
- [ ] New feature / entity
9+
- [ ] Improvement to existing functionality
10+
- [ ] Documentation update
11+
- [ ] CI / tooling change
12+
13+
## Changes
14+
15+
<!-- List the key changes made -->
16+
17+
-
18+
-
19+
20+
## Testing
21+
22+
- [ ] I have run `pytest tests/` and all tests pass
23+
- [ ] I have run hassfest validation
24+
- [ ] I have run HACS validation
25+
- [ ] I have tested the change against a real LuxPower inverter *(if applicable)*
26+
27+
## Checklist
28+
29+
- [ ] I have updated [CHANGELOG.md](../CHANGELOG.md) under `[Unreleased]`
30+
- [ ] New entities have `translation_key`, entries in `strings.json` / `translations/en.json`, and `icons.json`
31+
- [ ] No new dependencies added without updating `manifest.json`
32+
- [ ] PR targets the `main` branch
33+
34+
## Related issues
35+
36+
<!-- Closes #123 -->

‎.github/workflows/release.yml‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Release
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
release:
9+
name: Attach release asset
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
14+
- name: Zip custom component
15+
run: |
16+
cd custom_components
17+
zip -r ../luxpower.zip luxpower/
18+
19+
- name: Upload release asset
20+
uses: softprops/action-gh-release@v2
21+
with:
22+
files: luxpower.zip

‎.github/workflows/validate.yml‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Validate
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
hacs:
9+
name: HACS validation
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
- uses: hacs/action@main
14+
with:
15+
category: integration
16+
17+
hassfest:
18+
name: hassfest
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v4
22+
- uses: home-assistant/actions/hassfest@master

‎CHANGELOG.md‎

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
---
9+
10+
## [Unreleased]
11+
12+
---
13+
14+
## [1.0.0] — 2025-05-22
15+
16+
### Added
17+
- Initial release
18+
- Cloud API client for LuxPower inverters (Global and EU regions)
19+
- 30+ sensor entities: solar power, battery power & SOC, grid import/export, load power, PV string voltages & currents, temperatures, daily and lifetime energy totals, inverter status and work mode
20+
- AC charge switch
21+
- Number controls: AC charge current limit, discharge cutoff SOC, charge cutoff SOC
22+
- Work mode select: Self-use, Feed-in Priority, Backup, Manual
23+
- Config flow with credential validation and duplicate-entry protection
24+
- Reauthentication flow for expired sessions
25+
- Reconfiguration flow to update credentials or region without re-adding
26+
- `luxcloud.refresh` service for on-demand data refresh
27+
- Diagnostics support with redacted credential output
28+
- Entity categories: `DIAGNOSTIC` for technical sensors, `CONFIG` for controls
29+
- Entity and icon translations
30+
- HACS support via `hacs.json`
31+
- GitHub Actions: HACS validation, hassfest validation, release asset upload
32+
- Config flow test suite
33+
34+
[Unreleased]: https://github.com/BeardedTech0o/ha-luxcloud/compare/v1.0.0...HEAD
35+
[1.0.0]: https://github.com/BeardedTech0o/ha-luxcloud/releases/tag/v1.0.0

‎CONTRIBUTING.md‎

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
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

Comments
 (0)