Skip to content

Commit

Permalink
Merge pull request #34 from shadow578/ennexos
Browse files Browse the repository at this point in the history
Full Overhaul for use with SMA ennexOS devices
  • Loading branch information
shadow578 authored Feb 28, 2025
2 parents 7aa6279 + 584d728 commit 9f5f9fa
Show file tree
Hide file tree
Showing 59 changed files with 4,337 additions and 1,561 deletions.
35 changes: 21 additions & 14 deletions .devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ludeeus/integration_blueprint",
"image": "mcr.microsoft.com/vscode/devcontainers/python:0-3.10-bullseye",
"image": "mcr.microsoft.com/devcontainers/python:3.13",
"postCreateCommand": "scripts/setup",
"forwardPorts": [
8123
Expand All @@ -14,29 +14,36 @@
"customizations": {
"vscode": {
"extensions": [
"ms-python.python",
"charliermarsh.ruff",
"github.vscode-pull-request-github",
"ryanluker.vscode-coverage-gutters",
"ms-python.vscode-pylance"
"ms-python.python",
"ms-python.vscode-pylance",
"ryanluker.vscode-coverage-gutters"
],
"settings": {
"files.eol": "\n",
"editor.tabSize": 4,
"python.pythonPath": "/usr/bin/python3",
"python.analysis.autoSearchPaths": false,
"python.linting.pylintEnabled": true,
"python.linting.enabled": true,
"python.formatting.provider": "black",
"python.formatting.blackPath": "/usr/local/py-utils/bin/black",
"editor.formatOnPaste": false,
"editor.formatOnPaste": true,
"editor.formatOnSave": true,
"editor.formatOnType": true,
"files.trimTrailingWhitespace": true
"editor.formatOnType": false,
"files.trimTrailingWhitespace": true,
"python.analysis.typeCheckingMode": "basic",
"python.analysis.autoImportCompletions": true,
"python.defaultInterpreterPath": "/usr/local/bin/python",
"[python]": {
"editor.defaultFormatter": "charliermarsh.ruff"
}
}
}
},
"remoteUser": "vscode",
"features": {
"ghcr.io/devcontainers/features/rust:1": {}
"ghcr.io/devcontainers-extra/features/apt-packages:1": {
"packages": [
"ffmpeg",
"libturbojpeg0",
"libpcap-dev"
]
}
}
}
6 changes: 3 additions & 3 deletions .github/ISSUE_TEMPLATE/bug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ body:
- type: textarea
attributes:
label: "System Health details"
description: "Paste the data from the System Health card in Home Assistant (https://www.home-assistant.io//more-info/system-health#github-issues)"
description: "Paste the data from the System Health card in Home Assistant (https://www.home-assistant.io/more-info/system-health#github-issues)"
validations:
required: true
- type: checkboxes
Expand All @@ -22,7 +22,7 @@ body:
required: true
- label: This issue only contains 1 issue (if you have multiple issues, open one issue for each issue).
required: true
- label: This issue is not a duplicate issue of currently [previous issues](/~https://github.com/ludeeus/integration_blueprint/issues?q=is%3Aissue+label%3A%22Bug%22+)..
- label: This issue is not a duplicate issue of any [previous issues](/~https://github.com/shadow578/homeassistant_sma-ennexos/issues?q=is%3Aissue+label%3A%22Bug%22+)..
required: true
- type: textarea
attributes:
Expand All @@ -33,7 +33,7 @@ body:
- type: textarea
attributes:
label: Reproduction steps
description: "Without steps to reproduce, it will be hard to fix, it is very important that you fill out this part, issues without it will be closed"
description: "Without steps to reproduce, it will be hard to fix. It is very important that you fill out this part. Issues without it will be closed."
value: |
1.
2.
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ body:
required: true
- label: This only contains 1 feature request (if you have multiple feature requests, open one feature request for each feature request).
required: true
- label: This issue is not a duplicate feature request of [previous feature requests](/~https://github.com/ludeeus/integration_blueprint/issues?q=is%3Aissue+label%3A%22Feature+Request%22+).
- label: This issue is not a duplicate feature request of [previous feature requests](/~https://github.com/shadow578/homeassistant_sma-ennexos/issues?q=is%3Aissue+label%3A%22Feature+Request%22+).
required: true

- type: textarea
Expand Down
36 changes: 31 additions & 5 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "Lint"
name: "Lint and Format"

on:
push:
Expand All @@ -12,18 +12,44 @@ jobs:
ruff:
name: "Ruff"
runs-on: "ubuntu-latest"
permissions:
contents: read
steps:
- name: "Checkout the repository"
uses: "actions/checkout@v4.1.1"
uses: "actions/checkout@v4.2.2"

- name: "Set up Python"
uses: actions/setup-python@v5.0.0
uses: actions/setup-python@v5.4.0
with:
python-version: "3.10"
python-version: "3.13"
cache: "pip"

- name: "Install requirements"
run: python3 -m pip install -r requirements.txt

- name: "Run"
- name: "Run Format"
run: python3 -m ruff format --check .

- name: "Run Check"
run: python3 -m ruff check .

pyright:
name: "Pyright"
runs-on: "ubuntu-latest"
permissions:
contents: read
steps:
- name: "Checkout the repository"
uses: "actions/checkout@v4.2.2"

- name: "Set up Python"
uses: actions/setup-python@v5.4.0
with:
python-version: "3.13"
cache: "pip"

- name: "Install requirements"
run: python3 -m pip install -r requirements.txt

- name: "Run Pyright"
run: python3 -m pyright --warnings
12 changes: 6 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,21 @@ jobs:
contents: write
steps:
- name: "Checkout the repository"
uses: "actions/checkout@v4.1.1"
uses: "actions/checkout@v4.2.2"

- name: "Adjust version number"
shell: "bash"
run: |
yq -i -o json '.version="${{ github.event.release.tag_name }}"' \
"${{ github.workspace }}/custom_components/integration_blueprint/manifest.json"
"${{ github.workspace }}/custom_components/sma_ennexos/manifest.json"
- name: "ZIP the integration directory"
shell: "bash"
run: |
cd "${{ github.workspace }}/custom_components/integration_blueprint"
zip integration_blueprint.zip -r ./
cd "${{ github.workspace }}/custom_components/sma_ennexos"
zip sma_ennexos.zip -r ./
- name: "Upload the ZIP file to the release"
uses: softprops/action-gh-release@v0.1.15
uses: softprops/action-gh-release@c95fe1489396fe8a9eb87c0abf8aa5b2ef267fda # 2.2.1
with:
files: ${{ github.workspace }}/custom_components/integration_blueprint/integration_blueprint.zip
files: ${{ github.workspace }}/custom_components/sma_ennexos/sma_ennexos.zip
19 changes: 13 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,28 @@ on:
- "main"

jobs:
ruff:
name: "PyTest"
test:
name: "Test"
runs-on: "ubuntu-latest"
permissions:
contents: read
steps:
- name: "Checkout the repository"
uses: "actions/checkout@v4.1.1"
uses: "actions/checkout@v4.2.2"

- name: "Set up Python"
uses: actions/setup-python@v5.0.0
uses: actions/setup-python@v5.4.0
with:
python-version: "3.10"
python-version: "3.13"
cache: "pip"

- name: "Install requirements"
run: python3 -m pip install -r requirements.txt

- name: "Run"
run: python3 -m pytest
run: python3 -m pytest --cov=./ --cov-report=xml --cov-fail-under=80 -v

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@13ce06bfc6bbe3ecf90edbbf1bc32fe5978ca1d3 # 5.3.1
with:
token: ${{ secrets.CODECOV_TOKEN }}
8 changes: 6 additions & 2 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,23 @@ jobs:
hassfest: # https://developers.home-assistant.io/blog/2020/04/16/hassfest
name: "Hassfest Validation"
runs-on: "ubuntu-latest"
permissions:
contents: read
steps:
- name: "Checkout the repository"
uses: "actions/checkout@v4.1.1"
uses: "actions/checkout@v4.2.2"

- name: "Run hassfest validation"
uses: "home-assistant/actions/hassfest@master"

hacs: # /~https://github.com/hacs/action
name: "HACS Validation"
runs-on: "ubuntu-latest"
permissions:
contents: read
steps:
- name: "Checkout the repository"
uses: "actions/checkout@v4.1.1"
uses: "actions/checkout@v4.2.2"

- name: "Run HACS validation"
uses: "hacs/action@main"
Expand Down
14 changes: 11 additions & 3 deletions .ruff.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
# The contents of this file is based on /~https://github.com/home-assistant/core/blob/dev/pyproject.toml

# Python 3.10
target-version = "py310"

# Exclude files auto-generated by pyright
exclude = [
"typings"
]

[lint]
select = [
"B007", # Loop control variable {name} not used within loop body
"B014", # Exception handler with duplicate exception
Expand All @@ -24,6 +31,7 @@ select = [
"RUF006", # Store a reference to the return value of asyncio.create_task
"UP", # pyupgrade
"W", # pycodestyle
"I", # isort
]

ignore = [
Expand All @@ -38,11 +46,11 @@ ignore = [
"E731", # do not assign a lambda expression, use a def
]

[flake8-pytest-style]
[lint.flake8-pytest-style]
fixture-parentheses = false

[pyupgrade]
[lint.pyupgrade]
keep-runtime-typing = true

[mccabe]
[lint.mccabe]
max-complexity = 25
6 changes: 6 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@
"command": "scripts/test",
"problemMatcher": []
},
{
"label": "Run Unit Tests with Coverage (Once)",
"type": "shell",
"command": "scripts/test --coverage",
"problemMatcher": []
},
{
"label": "Run Unit Tests (Watch)",
"type": "shell",
Expand Down
53 changes: 31 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,62 +1,71 @@
# SMA ennexOS for Homeassistant

> [!WARNING]
> Deprecation Notice: This integration will not receive any further updates as i no longer have access to a SMA Data Manager to test with.
[![GitHub Release][releases-shield]][releases]
[![codecov](https://codecov.io/github/shadow578/homeassistant_xmltv-epg/graph/badge.svg?token=HGS6DNA4LE)](https://codecov.io/github/shadow578/homeassistant_xmltv-epg)
[![License][license-shield]](LICENSE)
![Project Maintenance][maintenance-shield]


# SMA Data Manager
_Integration to integrate with [SMA ennexOS](sma_ennexos) devices._

[![GitHub Release][releases-shield]][releases]
[![GitHub Activity][commits-shield]][commits]
[![License][license-shield]](LICENSE)

[![hacs][hacsbadge]][hacs]
![Project Maintenance][maintenance-shield]
## Supported Devices

This integration should work with all SMA ennexOS devices.
These devices are known to be compatible.

_Integration to integrate with the [SMA Data Manager][sma_data_manager]._
- [SMA Data Manager M][sma_data_manager_m]
- [SMA Sunny Tripower X15 and X25](sma_sunny_tripower_x)


## Installation

## HACS (recommended)

1. Add `/~https://github.com/shadow578/homeassistant_sma_data_manager` as a custom repository, choose `Integration` as Category and add.
2. In the HACS UI, search for `SMA Data Manager` and install it.
1. Add `/~https://github.com/shadow578/homeassistant_sma-ennexos` as a custom repository, choose `Integration` as Category and add.
2. In the HACS UI, search for `SMA ennexOS` and install it.
3. Restart Home Assistant
4. In the HA UI go to "Configuration" -> "Integrations" click "+" and search for "SMA Data manager"
4. In the HA UI go to "Configuration" -> "Integrations" click "+" and search for "SMA ennexOS"

## Manual

1. Using the tool of choice open the directory for your HA configuration (where you find `configuration.yaml`).
1. If you do not have a `custom_components` directory there, you need to create it.
2. In the `custom_components` directory create a new folder called `sma_data_manager`.
3. Download _all_ the files from the `custom_components/sma_data_manager/` directory in this repository.
2. In the `custom_components` directory create a new folder called `sma_ennexos`.
3. Download _all_ the files from the `custom_components/sma_ennexos/` directory in this repository.
4. Place the files you downloaded in the new directory you created.
5. Restart Home Assistant
6. In the HA UI go to "Configuration" -> "Integrations" click "+" and search for "Integration blueprint"
6. In the HA UI go to "Configuration" -> "Integrations" click "+" and search for "SMA ennexOS"

# Configuration

Configuration is done using the UI.
You'll be prompted to enter the IP and credentials to the SMA Data Manager.
After the initial setup, you'll have to configure the channels you want to use in the integration options.
To find available channels, take a look in the "Instantaneous Values" menu of the SMA Data Manager web interface.
Configuration is done using the UI.
You'll be prompted to enter the IP and credentials to the SMA ennexOS Device.
After the initial setup, you'll have to configure the channels you want to use in the integration options.
To find available channels, refer to the "Instantaneous Values" menu of the ennexOS web interface.


> [!TIP]
> To Improve reliability, using the installer password is recommended.
> Using the login to the ennexOS Portal works too, but may be less stable as it requires the ennexOS device to maintain a cloud connection.
# Contributions are welcome!

If you want to contribute to this please read the [Contribution guidelines](CONTRIBUTING.md)


# Notice

This integration is not affiliated with SMA Solar Technology AG in any way.
The SMA and SMA Data Manager names and logos are trademarks of SMA Solar Technology AG.
This integration is not affiliated with SMA Solar Technology AG in any way.
Use at your own risk.

The SMA, SMA ennexOS, SMA Data Manager and SMA Sunny Tripower X names and logos are trademarks of SMA Solar Technology AG.

***

[sma_data_manager]: https://www.sma.de/en/products/monitoring-control/data-manager-m
[sma_ennexos]: https://www.sma.de/produkte/apps-software/ennexos
[sma_data_manager_m]: https://www.sma.de/en/products/monitoring-control/data-manager-m
[sma_sunny_tripower_x]: https://www.sma.de/en/products/solarinverters/sunny-tripower-x
[commits-shield]: https://img.shields.io/github/commit-activity/y/shadow578/homeassistant_sma_data_manager.svg?style=for-the-badge
[commits]: /~https://github.com/shadow578/homeassistant_sma_data_manager/commits/main
[hacs]: /~https://github.com/hacs/integration
Expand Down
10 changes: 10 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
coverage:
status:
project:
default:
target: auto
threshold: 5%
patch:
default:
target: auto
threshold: 5%
Loading

0 comments on commit 9f5f9fa

Please sign in to comment.