https://github.com/afrouper/sungrow-api-client
Java Client for the official Sungrow iSolarCloud API
https://github.com/afrouper/sungrow-api-client
api isolarcloud java pv solar-energy sungrow sungrow-battery sungrow-inverter
Last synced: 25 days ago
JSON representation
Java Client for the official Sungrow iSolarCloud API
- Host: GitHub
- URL: https://github.com/afrouper/sungrow-api-client
- Owner: Afrouper
- License: apache-2.0
- Created: 2024-12-30T20:55:13.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2026-06-02T05:04:31.000Z (about 1 month ago)
- Last Synced: 2026-06-02T07:09:13.709Z (about 1 month ago)
- Topics: api, isolarcloud, java, pv, solar-energy, sungrow, sungrow-battery, sungrow-inverter
- Language: Java
- Homepage: https://developer-api.isolarcloud.com/
- Size: 245 KB
- Stars: 5
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.MD
- License: LICENSE
Awesome Lists containing this project
README
# Sungrow API Client
[](https://github.com/Afrouper/sungrow-api-client/actions/workflows/maven.yml)
[](https://github.com/Afrouper/sungrow-api-client/actions/workflows/github-code-scanning/codeql)
[](https://github.com/Afrouper/sungrow-api-client/actions/workflows/dependabot/dependabot-updates)


API Client which uses the official API from the [sungrow developer portal](https://developer-api.isolarcloud.com/).
The Client is still in development and not finished.
> [!NOTE]
> Pull requests to complete APIs are welcome
> [!IMPORTANT]
> I choose a very simple implementation to get this client used in different environments; without coming to "dependency
> hell".
## ToDos
- [x] Add gitHub actions for compile, dependabot and securiy issues
- [x] Add sample client for basic usage
- [x] Support encrypted API calls (open: Change password for each call)
- [x] Add release action
- [x] Mock JUnit Test
- [x] Deploy via Maven Central
- [x] Complete API Calls for reading
- [x] Add OAuth2 Support
- [ ] Complete API Calls for writing
## Dependency
The JAR is available on [Maven Central](https://central.sonatype.com/artifact/io.github.afrouper/sungrow-api-client)
with the coordinates `io.github.afrouper:sungrow-api-client`:
```xml
io.github.afrouper
sungrow-api-client
[1.1.0,)
```
# Usage
You have to create an account at Sungrows iSolarCloud and on their developer portal and get the needed
credentials (see [Sungrow Developer Portal](https://developer-api.isolarcloud.com))
To access the iSolarCloud API you can either use a variant with an "API key" or via OAuth2.
For a simple configuration approach the needed values can be read via class
[EnvironmentConfiguration](src/main/java/de/afrouper/server/sungrow/api/EnvironmentConfiguration.java).
| SystemProperty / Environment variable | meaning |
|---------------------------------------|--------------------------------------------------------|
| APP_KEY | Your app key from Sungrow Developer Portal |
| SECRET_KEY | Your secret key from Sungrow Developer Portal |
| ACCOUNT_EMAIL | EMailadress used for login to Sungrow Developer Portal |
| ACCOUNT_PASSWORD | Password used for login to Sungrow Developer Portal |
| RSA_PUBLIC_KEY | RSA Public key to call APIs E2E encrypted |
| API_CALL_PASSWORD | Password for payload encryption |
| AUTHORIZE_URL | OAuth2 Authorization URL |
| REDIRECT_URL | OAuth2 Redirect URL |
The URL for accessing the correct cloud service is determined from
the [Region](src/main/java/de/afrouper/server/sungrow/api/SungrowClientBuilder.java) Enum.
## API Key variant
A simple example can be found at [Client.java](src/test/java/de/afrouper/server/sungrow/Client.java).
Its Output (with a german installation) can be seen [here](docs/Output.MD)
```java
sungrowClient = new SungrowClientBuilder()
.builder(SungrowClientBuilder.Region.EUROPE)
.withCredentials(EnvironmentConfiguration.getAppKey(), EnvironmentConfiguration.getSecretKey())
.withLogin(EnvironmentConfiguration.getAccountEmail(), EnvironmentConfiguration.getAccountPassword());
PlantList plants = sungrowClient.getPlants();
// Handle Plants and devices - see de.afrouper.server.sungrow.Client
```
## OAuth2 variant
The OAuth2 auth code flow requires a server to handle the redirect send after login; the server must be implemented or
provided by you 😇
A sample can be found at [OAuth2Client](src/test/java/de/afrouper/server/sungrow/OAuth2Client.java)
```java
sungrowClient = new SungrowClientBuilder()
.builder(SungrowClientBuilder.Region.EUROPE)
.withCredentials(EnvironmentConfiguration.getAppKey(), EnvironmentConfiguration.getSecretKey())
.withOAuth2(EnvironmentConfiguration.getAuthorizeUrl(), EnvironmentConfiguration.getRedirectUrl())
.build();
String authCode = "xxxxx"; //TODO: Replace with correct auth code
sungrowClient.authCodeFlow(authCode);
PlantList plants = sungrowClient.getPlants();
// Handle Plants and devices...
sungrowClient.close(); // Stop thread for refreshing the access token
```
# Sungrow Developer Portal
Use your sungrow credentials to login at "https://developer-api.isolarcloud.com".
You need to create an application; go to you applications in the top menu:

Click 'Create Application'. This is the sample for a "normal" application - used via "API key" variant.

# API Usage
Please read the docs at
the [Developer Portal](https://developer-api.isolarcloud.com/#/document/md?id=10942&project_id=2&version=V1). THe are
some hints and documentation of the measurement points, etc.