Skip to content

Commit 011c2f2

Browse files
authored
Fix setup errors and release v2.0.11 (#28)
Handle duplicate and concurrent setup through normal Home Assistant aborts. Classify cloud API errors and reject malformed detail responses without logging raw response bodies. Add real API and Home Assistant config-flow regression coverage and an explicit test-gated release workflow. Existing credentials, inverter selections, entity IDs, polling and stale-data behaviour remain unchanged. Related to #22; upstream DNS failures and HTTP 502s remain under investigation.
1 parent 4056a2d commit 011c2f2

11 files changed

Lines changed: 612 additions & 158 deletions

File tree

‎.github/workflows/release.yml‎

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Publish release
2+
3+
# Publishing is explicit: create release/vX.Y.Z at the tested main commit.
4+
# Ordinary pushes and pull requests never publish a release.
5+
on: create
6+
7+
permissions:
8+
contents: read
9+
10+
concurrency:
11+
group: release-${{ github.event.ref }}
12+
cancel-in-progress: false
13+
14+
jobs:
15+
checks:
16+
if: github.event.ref_type == 'branch' && startsWith(github.event.ref, 'release/v')
17+
uses: ./.github/workflows/tests.yml
18+
publish:
19+
needs: checks
20+
runs-on: ubuntu-latest
21+
permissions:
22+
contents: write
23+
steps:
24+
- uses: actions/checkout@v4
25+
with:
26+
persist-credentials: false
27+
- name: Validate version and publish tested commit
28+
env:
29+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30+
RELEASE_REF: ${{ github.event.ref }}
31+
shell: bash
32+
run: |
33+
set -euo pipefail
34+
version=$(python -c 'import json; print(json.load(open("custom_components/solis_cloud_monitoring/manifest.json"))["version"])')
35+
[[ "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]
36+
tag="v$version"
37+
[[ "$RELEASE_REF" == "release/$tag" ]]
38+
notes="RELEASE_NOTES_$tag.md"
39+
test -s "$notes"
40+
main_sha=$(gh api "repos/$GITHUB_REPOSITORY/git/ref/heads/main" --jq .object.sha)
41+
[[ "$main_sha" == "$GITHUB_SHA" ]]
42+
if gh release view "$tag" --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1; then
43+
tag_sha=$(gh api "repos/$GITHUB_REPOSITORY/git/ref/tags/$tag" --jq .object.sha)
44+
[[ "$tag_sha" == "$GITHUB_SHA" ]]
45+
echo "Release $tag already exists at the tested commit; leaving it unchanged."
46+
exit 0
47+
fi
48+
gh release create "$tag" --repo "$GITHUB_REPOSITORY" \
49+
--target "$GITHUB_SHA" --title "Solis Cloud Monitoring $tag" \
50+
--notes-file "$notes" --latest

‎.github/workflows/tests.yml‎

Lines changed: 51 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,67 @@ on:
55
paths:
66
- "custom_components/solis_cloud_monitoring/**"
77
- "tests/**"
8+
- "tests_runtime/**"
89
- ".github/workflows/tests.yml"
910
pull_request:
1011
paths:
1112
- "custom_components/solis_cloud_monitoring/**"
1213
- "tests/**"
14+
- "tests_runtime/**"
1315
- ".github/workflows/tests.yml"
16+
workflow_call:
17+
18+
permissions:
19+
contents: read
1420

1521
jobs:
1622
tests:
1723
runs-on: ubuntu-latest
1824
steps:
19-
- name: Checkout
20-
uses: actions/checkout@v4
21-
- name: Set up Python
22-
uses: actions/setup-python@v5
25+
- uses: actions/checkout@v4
26+
with:
27+
persist-credentials: false
28+
- uses: actions/setup-python@v5
2329
with:
2430
python-version: "3.12"
25-
- name: Install test runner
26-
run: python -m pip install pytest
27-
- name: Run tests
28-
run: pytest -q
31+
- name: Install test dependencies
32+
run: python -m pip install pytest==9.0.2 aiohttp==3.13.3
33+
- name: Run existing regressions
34+
run: python -m pytest -q tests
35+
- name: Run API boundary regressions with real aiohttp
36+
# Legacy tests stub sys.modules, so use a separate process.
37+
run: python -m pytest -q tests_runtime/test_api_errors.py
38+
config-flow:
39+
runs-on: ubuntu-latest
40+
strategy:
41+
fail-fast: false
42+
matrix:
43+
include:
44+
- python: "3.12"
45+
homeassistant: "2024.8.3"
46+
- python: "3.14.2"
47+
homeassistant: "2026.9.3"
48+
steps:
49+
- uses: actions/checkout@v4
50+
with:
51+
persist-credentials: false
52+
- uses: actions/setup-python@v5
53+
with:
54+
python-version: ${{ matrix.python }}
55+
- name: Install real Home Assistant
56+
env:
57+
HA_VERSION: ${{ matrix.homeassistant }}
58+
shell: bash
59+
run: |
60+
set -euo pipefail
61+
if [[ "$HA_VERSION" == "2024.8.3" ]]; then
62+
# Recreate the older HA dependency family, not today's unrelated
63+
# transitive versions. These constraints apply only to this CI job.
64+
python -m pip install pytest==9.0.2 "homeassistant==$HA_VERSION" \
65+
-c "https://raw.githubusercontent.com/home-assistant/core/2024.8.3/homeassistant/package_constraints.txt" \
66+
"josepy<2" "pycares<5"
67+
else
68+
python -m pip install pytest==9.0.2 "homeassistant==$HA_VERSION"
69+
fi
70+
- name: Run config-flow regressions with real HA helpers
71+
run: python -m pytest -q tests_runtime/test_config_flow_errors.py

‎RELEASE_NOTES_v2.0.11.md‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Solis Cloud Monitoring v2.0.11
2+
3+
- Fix duplicate and simultaneous setup attempts showing an unexpected error instead of the normal Home Assistant message. These checks now happen before contacting SolisCloud, with a further check before saving the entry.
4+
- Distinguish API access errors, timeouts, server errors, rate limiting, empty accounts and malformed responses during setup and reconfiguration.
5+
- Stop including raw SolisCloud response bodies in API error messages. Validate inverter and station detail responses before passing them to the coordinator.
6+
- Add API boundary tests and config-flow regressions using real Home Assistant helpers.
7+
8+
Update through HACS and restart Home Assistant. Existing credentials, inverter selections and entity IDs are unchanged. There is no storage migration or manual cleanup required.
9+
10+
This release fixes error handling. It does not claim to fix upstream HTTP 502s, DNS failures, or logger disconnections. Polling frequency and the bounded stale-data policy are unchanged. The integration remains cloud-based and read-only.

0 commit comments

Comments
 (0)