diff --git a/.coveragerc b/.coveragerc index 6b08179..890dd1b 100644 --- a/.coveragerc +++ b/.coveragerc @@ -1,2 +1,3 @@ [run] -branch = True \ No newline at end of file +branch = True +relative_files = True \ No newline at end of file diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index f51ae3d..9061986 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -18,10 +18,11 @@ on: - '**.dockerfile' # Do no build on *.dockerfile changes - '**.sh' # Do no build on *.sh changes pull_request: - branches: [ "main" ] + branches: [ "main", "dev-*" ] permissions: contents: read + pull-requests: read # allows SonarCloud to decorate PRs with analysis results jobs: build: @@ -29,7 +30,15 @@ jobs: runs-on: ubuntu-latest steps: + - name: Set timezone + uses: szenius/set-timezone@v2.0 + with: + timezoneLinux: "Europe/Berlin" + timezoneMacos: "Europe/Berlin" + timezoneWindows: "Europe/Berlin" - uses: actions/checkout@v4 + with: + fetch-depth: 0 # Fetch all history for all tags and branches - name: Set up Python 3.12 uses: actions/setup-python@v5 with: @@ -47,4 +56,19 @@ jobs: flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - name: Test with pytest run: | - python -m pytest app + pip install pytest pytest-cov + #pytest app --doctest-modules --junitxml=junit/test-results.xml --cov=com --cov-report=xml --cov-report=html + python -m pytest app --cov=app/src --cov-report=xml + - name: Analyze with SonarCloud + uses: SonarSource/sonarcloud-github-action@v2.2.0 + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + with: + projectBaseDir: . + args: + -Dsonar.projectKey=s-allius_tsun-gen3-proxy + -Dsonar.organization=s-allius + -Dsonar.python.version=3.12 + -Dsonar.python.coverage.reportPaths=coverage.xml + -Dsonar.tests=system_tests,app/tests + -Dsonar.source=app/src diff --git a/.sonarlint/connectedMode.json b/.sonarlint/connectedMode.json new file mode 100644 index 0000000..4a9cc82 --- /dev/null +++ b/.sonarlint/connectedMode.json @@ -0,0 +1,4 @@ +{ + "sonarCloudOrganization": "s-allius", + "projectKey": "s-allius_tsun-gen3-proxy" +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index 42fb2c2..dd2d0cf 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -11,5 +11,9 @@ "python.testing.pytestEnabled": true, "flake8.args": [ "--extend-exclude=app/tests/*.py system_tests/*.py" - ] + ], + "sonarlint.connectedMode.project": { + "connectionId": "s-allius", + "projectKey": "s-allius_tsun-gen3-proxy" + } } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 934a71e..ffe1250 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,29 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [unreleased] +## [0.10.0] - 2024-08-09 + +- bump aiohttp to version 3.10.2 +- add SonarQube and code coverage support +- don't send MODBUS request when state is note up; adapt timeouts [#141](https://github.com/s-allius/tsun-gen3-proxy/issues/141) +- build multi arch images with sboms [#144](https://github.com/s-allius/tsun-gen3-proxy/issues/144) +- add timestamp to MQTT topics [#138](https://github.com/s-allius/tsun-gen3-proxy/issues/138) +- improve the message handling, to avoid hangs +- GEN3: allow long timeouts until we received first inverter data (not only device data) +- bump aiomqtt to version 2.2.0 +- bump schema to version 0.7.7 +- Home Assistant: improve inverter status value texts +- GEN3: add inverter status +- fix flapping registers [#128](https://github.com/s-allius/tsun-gen3-proxy/issues/128) +- register OUTPUT_COEFFICIENT at HA +- GEN3: INVERTER_STATUS, +- add config option to disable the MODBUS polling [#120](https://github.com/s-allius/tsun-gen3-proxy/issues/120) +- make the maximum output coefficient configurable [#123](https://github.com/s-allius/tsun-gen3-proxy/issues/123) +- cleanup shutdown +- add preview build +- MODBUS: the last digit of the inverter version is a hexadecimal number [#119](https://github.com/s-allius/tsun-gen3-proxy/issues/119) +- GEN3PLUS: add client_mode connection on port 8899 [#117](https://github.com/s-allius/tsun-gen3-proxy/issues/117) + ## [0.9.0] - 2024-07-01 - fix exception in MODBUS timeout callback diff --git a/README.md b/README.md index 67a6ead..1ec2294 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@

License: BSD-3-Clause Supported Python versions - Supported aiomqtt versions + Supported aiomqtt versions Supported aiocron versions Supported toml versions

@@ -165,6 +165,9 @@ pv2 = {type = 'RSM40-8-405M', manufacturer = 'Risen'} # Optional, PV module de monitor_sn = 2000000000 # The "Monitoring SN:" can be found on a sticker enclosed with the inverter node_id = 'inv_3' # MQTT replacement for inverters serial number suggested_area = 'garage' # suggested installation place for home-assistant +# if your inverter supports SSL connections you must use the client_mode. Pls, uncomment +# the next line and configure the fixed IP of your inverter +#client_mode = {host = '192.168.0.1', port = 8899} pv1 = {type = 'RSM40-8-410M', manufacturer = 'Risen'} # Optional, PV module descr pv2 = {type = 'RSM40-8-410M', manufacturer = 'Risen'} # Optional, PV module descr pv3 = {type = 'RSM40-8-410M', manufacturer = 'Risen'} # Optional, PV module descr @@ -188,8 +191,20 @@ The standard web interface of the inverter can be accessed at `http://