MCPcopy Index your code
hub / github.com/MickMake/GoSungrow

github.com/MickMake/GoSungrow @v3.0.7

Chat with this repo
repository ↗ · DeepWiki ↗ · release v3.0.7 ↗ · + Follow
54,463 symbols 113,133 edges 2,138 files 42,417 documented · 78% updated 2y agov3.0.7 · 2023-09-04★ 24495 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

GoSungrow - iSolarCloud API written in GoLang.

Note: The next major release, (v3.0.x), is here! Check out the Latest releases here.

Go Reference

Find this useful? You can support development of this app

image

What is it?

This GoLang package has a complete implementation of the iSolarCloud API. There's been no published specs on this, so I've had to figure it all out based on the Android app, using javascript IDEs and various other means.

Note: - iSolarCloud has no interest in developing a public API. - Their "API" implementation is so broken with security and coding issues, I'm surprised it hasn't been exploited yet. - iSolarCloud reached out to me, (based off this GitHub page), to see what can be done about these security issues. So that's a very good thing. - As of 1st August 2022 I discovered a number of security holes. At which point I notified AusCert, the vendor and a number of other security companies - hopefully they will get patched because my tool makes it very easy.

alt text

alt text

I'm currently using it in my HomeAssistant instance.

alt text

alt text

alt text

alt text

alt text

alt text

alt text

alt text

alt text

What state is it in?

It was originally intended for my needs, (seeing all data in HomeAssistant), but there seems to be a big interest in this tool. So I spent some time working on the v3.0.0 release, adding features.

I have now mapped out all the API calls. All the read-only endpoints are mapped out and fully tested. The write-only calls haven't been tested fully. It's tricky as their "API" changes regularly; however I've accommodated for quick changes in the v3.0.0 release.

Most endpoints contain repeated data. The main endpoints that house most of the data I've provided easy commands to access. Of course, all endpoints are accessible. So go for your life.

+-------------------+-------------------+--------------------+------------+
|       AREAS       | ENABLED ENDPOINTS | DISABLED ENDPOINTS | COVERAGE % |
+-------------------+-------------------+--------------------+------------+
| AliSmsService     |                 1 |                  0 |  100 %     |
| AppService        |               574 |                  0 |  100 %     |
| MttvScreenService |                30 |                  0 |  100 %     |
| NullArea          |                 1 |                  0 |  100 %     |
| PowerPointService |                 1 |                  0 |  100 %     |
| WebAppService     |               190 |                  0 |  100 %     |
| WebIscmAppService |               184 |                  0 |  100 %     |
| ----------------  | ----------------  | -----------------  | ---------  |
| Total             |               981 |                  0 |  100 %     |
+-------------------+-------------------+--------------------+------------+

What does it do?

This GoLang package does several things: 1. Provides ready access to all API calls via a simple get/put framework. 2. MQTT client to push to HomeAssistant. 3. Graphing any data points, over daily, monthly and yearly with 5 minute to 1 hour granularity. 4. Output data to various formats - tables, JSON, CSV, raw, Graphing, XML, XLSX, Markdown, SQL, HTML and GoLang structures.

What is the roadmap?

I've implemented most of the features I've wanted to, except for... 1. IFTTT support.

The most recent version has changed the code-base substantially, making it a lot more robust to changes in the API JSON schema.

Using GoSungrow:

Config and login.

Add your username and password to the config. (See the website) Once done, it's a case of set and forget. GoSungrow will handle the re-authentication for you.

% ./bin/GoSungrow config write --user=USERNAME --password=PASSWORD
Using config file '/Users/mick/.GoSungrow/config.json'

Login to SunGrow website.

% ./bin/GoSungrow api login
Email:  your@email.address
Create Date:    Tue Nov 16 23:30:12 CST 2021
Login Last Date:    2022-03-10 17:14:49
Login Last IP:
Login State:    1
User Account:   mickmake
User Id:    276937
User Name:  MickMake
Is Online:  0
Token:  424242_42424242424242424242424242424242
Token File: /Users/mick/.GoSungrow/AppService_login.json

High level reporting examples.

For more examples see the EXAMPLES.md and examples.txt files. EXAMPLES.md examples.txt

Show all devices on your iSolarCloud account.

% ./bin/GoSungrow show ps list
┏━━━━━━━━━━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┓
┃ Ps Key           ┃ Ps Id   ┃ Device Type ┃ Device Code ┃ Channel Id ┃ Serial #    ┃ Factory Name ┃ Device Model ┃
┣━━━━━━━━━━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━┫
┃ 1129147_14_1_1   │ 1129147 │ 14          │ 1           │ 1          │ B2192301528 │ SUNGROW      │ SH10RT       ┃
┃ 1129147_22_247_1 │ 1129147 │ 22          │ 247         │ 1          │ B2192301528 │ SUNGROW      │ WiNet-S      ┃
┃ 1129147_43_2_1   │ 1129147 │ 43          │ 2           │ 1          │ B2192301528 │ SUNGROW      │ SBR096       ┃
┃ 1171348_14_1_2   │ 1171348 │ 14          │ 1           │ 2          │ B2281302388 │ SUNGROW      │ SH10RT-V112  ┃
┃ 1171348_22_247_2 │ 1171348 │ 22          │ 247         │ 2          │ B2281302388 │ SUNGROW      │ WiNet-S      ┃
┃ 1171348_43_2_2   │ 1171348 │ 43          │ 2           │ 2          │ B2281302388 │ SUNGROW      │ SBR096       ┃
┗━━━━━━━━━━━━━━━━━━┷━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━┛

Show the device tree on your iSolarCloud account.

% ./bin/GoSungrow show ps tree
+   PsId:1129147    PsName:MickMake PsKey:1129147_11_0_0    DeviceName:MickMake Uuid:844763
+-- PsId:1129147    PsName:MickMake PsKey:1129147_14_1_1    DeviceName:SH10RT   Uuid:844775
+----   PsId:1129147    PsName:MickMake PsKey:1129147_43_2_1    DeviceName:Battery_001_002  Uuid:1155386
+-- PsId:1129147    PsName:MickMake PsKey:1129147_22_247_1  DeviceName:WiNet-S  Uuid:844774
+   PsId:1171348    PsName:MickMake42   PsKey:1171348_11_0_0    DeviceName:MickMake42   Uuid:1179860
+-- PsId:1171348    PsName:MickMake42   PsKey:1171348_22_247_2  DeviceName:Communication Module 02_247  Uuid:1179877
+-- PsId:1171348    PsName:MickMake42   PsKey:1171348_14_1_2    DeviceName:Energy Storage System 02_01  Uuid:1179878
+----   PsId:1171348    PsName:MickMake42   PsKey:1171348_43_2_2    DeviceName:Battery 02_02    Uuid:1179879

List all known data points for all PS on your account.

% ./bin/GoSungrow show ps points 
# Available points:
┏━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Id       ┃ Name                                                     ┃ Unit   ┃ Unit Type ┃ Ps Id   ┃ Device Type ┃ Device Name                 ┃
┣━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫
┃ p83001   │ Inverter AC Power Normalization                          │ kW/kWp │ 43        │ 1129147 │ 11          │ MickMake                    ┃
┃ p83002   │ Inverter AC Power                                        │ kW     │ 3         │ 1129147 │ 11          │ MickMake                    ┃
┃ p83004   │ Inverter Total Yield                                     │ kWh    │ 7         │ 1129147 │ 11          │ MickMake                    ┃
┃ p83005   │ Daily Equivalent Hours of Meter                          │ h      │ 15        │ 1129147 │ 11          │ MickMake                    ┃
┃ p83006   │ Meter Daily Yield                                        │ kWh    │ 7         │ 1129147 │ 11          │ MickMake                    ┃
┃ p83007   │ Meter PR                                                 │ %      │ 10        │ 1129147 │ 11          │ MickMake                    ┃
┃ p83008   │ Daily Equivalent Hours of Inverter                       │ h      │ 15        │ 1129147 │ 11          │ MickMake                    ┃
┃ p83009   │ Daily Yield by Inverter                                  │ kWh    │ 7         │ 1129147 │ 11          │ MickMake                    ┃
┃ p83010   │ Inverter PR                                              │ %      │ 10        │ 1129147 │ 11          │ MickMake                    ┃
┃ p83011   │ Meter E-daily Consumption                                │ kWh    │ 7         │ 1129147 │ 11          │ MickMake                    ┃

...

┃ p58630   │ Min. Cell Voltage of Module 5                            │ mV     │ 31        │ 1171348 │ 43          │ Battery 02_02               ┃
┃ p58631   │ Min. Cell Voltage of Module 6                            │ mV     │ 31        │ 1171348 │ 43          │ Battery 02_02               ┃
┃ p58632   │ Min. Cell Voltage of Module 7                            │ mV     │ 31        │ 1171348 │ 43          │ Battery 02_02               ┃
┃ p58633   │ Min. Cell Voltage of Module 8                            │ mV     │ 31        │ 1171348 │ 43          │ Battery 02_02               ┃
┃ p58635   │ DC Contactor State                                       │        │ 999       │ 1171348 │ 43          │ Battery 02_02               ┃
┃ p58636   │ Fault Module ID                                          │        │ 999       │ 1171348 │ 43          │ Battery 02_02               ┃
┗━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━┷━━━━━━━━━━━┷━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛

Produce data table of device_type 22 on ps_id 1171348 between 20221001 and 20221002 at 60 minute increments.

% ./bin/GoSungrow show ps data 1171348 22 20221001 20221002 60

# DataTable AppService.queryMutiPointDataList.ResultData.Data - PsKeys:1171348_22_247_2,1171348_22_247_2,1171348_22_247_2,1171348_22_247_2,1171348_22_247_2,1171348_22_247_2,1171348_22_247_2,1171348_22_247_2 Points:p23001,p23014,p23019,p23020,p23021,p23022,p23023,p23024 PsId:1171348 StartTimeStamp:20221001000000 EndTimeStamp:20221002000000 MinuteInterval:60 
┏━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Timestamp              ┃ Ps Key              ┃ 1171348_22_247_2.p23014    ┃
┣━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫
┃ 2022-10-01 00:00:00    ┃ 1171348_22_247_2    ┃ --                         ┃
┃ 2022-10-01 01:00:00    ┃ 1171348_22_247_2    ┃ --                         ┃
┃ 2022-10-01 02:00:00    ┃ 1171348_22_247_2    ┃ --                         ┃
┃ 2022-10-01 03:00:00    ┃ 1171348_22_247_2    ┃ --                         ┃
┃ 2022-10-01 04:00:00    ┃ 1171348_22_247_2    ┃ --                         ┃
┃ 2022-10-01 05:00:00    ┃ 1171348_22_247_2    ┃ --                         ┃
┃ 2022-10-01 06:00:00    ┃ 1171348_22_247_2    ┃ --                         ┃
┃ 2022-10-01 07:00:00    ┃ 1171348_22_247_2    ┃ --                         ┃
┃ 2022-10-01 08:00:00    ┃ 1171348_22_247_2    ┃ --                         ┃
┃ 2022-10-01 09:00:00    ┃ 1171348_22_247_2    ┃ --                         ┃
┃ 2022-10-01 10:00:00    ┃ 1171348_22_247_2    ┃ --                         ┃
┃ 2022-10-01 11:00:00    ┃ 1171348_22_247_2    ┃ --                         ┃
┃ 2022-10-01 12:00:00    ┃ 1171348_22_247_2    ┃ --                         ┃
┃ 2022-10-01 13:00:00    ┃ 1171348_22_247_2    ┃ --                         ┃
┃ 2022-10-01 14:00:00    ┃ 1171348_22_247_2    ┃ -68                        ┃
┃ 2022-10-01 15:00:00    ┃ 1171348_22_247_2    ┃ -82                        ┃
┃ 2022-10-01 16:00:00    ┃ 1171348_22_247_2    ┃ -81                        ┃
┃ 2022-10-01 17:00:00    ┃ 1171348_22_247_2    ┃ -81                        ┃
┃ 2022-10-01 18:00:00    ┃ 1171348_22_247_2    ┃ -86                        ┃
┃ 2022-10-01 19:00:00    ┃ 1171348_22_247_2    ┃ -82                        ┃
┃ 2022-10-01 20:00:00    ┃ 1171348_22_247_2    ┃ -90                        ┃
┃ 2022-10-01 21:00:00    ┃ 1171348_22_247_2    ┃ -89                        ┃
┃ 2022-10-01 22:00:00    ┃ 1171348_22_247_2    ┃ -88                        ┃
┃ 2022-10-01 23:00:00    ┃ 1171348_22_247_2    ┃ -86                        ┃
┃ 2022-10-02 00:00:00    ┃ 1171348_22_247_2    ┃ -83                        ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛

Do the same, but with a graph! ``` % ./bin/GoSungrow show ps graph 1171348 22 20221001 20221002 60 Found ps_keys: 112

Extension points exported contracts — how you extend this code

EndPoint (Interface)
(no doc) [981 implementers]
iSolarCloud/api/interface_endpoint.go
DynamicColumn (FuncType)
DynamicColumn represents a function that can be evaluated dynamically when exporting to a predefined format.
tablib/tablib_dataset.go
SunGrowDataFunction (FuncType)
(no doc)
iSolarCloud/data.go
Unknown (Interface)
(no doc)
iSolarCloud/Common/invalid.go
Area (Interface)
(no doc)
iSolarCloud/api/interface_area.go
ColumnConstraint (FuncType)
ColumnConstraint represents a function that is bound as a constraint to the column so that it can validate its value
tablib/tablib_dataset.go
Parser (FuncType)
(no doc)
iSolarCloud/api/GoStruct/gojson/struct.go

Core symbols most depended-on inside this repo

IsValid
called by 3926
iSolarCloud/api/interface_area.go
GetAsPrettyJson
called by 1964
iSolarCloud/api/GoStruct/output/struct_json.go
GetName
called by 1962
iSolarCloud/api/utils.go
GetRequestString
called by 1962
iSolarCloud/api/GoStruct/output/struct_json.go
i
called by 1273
docs/data/js/chunk-58ab.9ad9549d.js
i
called by 1218
docs/data/js/chunk-f7a0.cf7e90ce.js
New
called by 1065
iSolarCloud/data.go
n
called by 1041
docs/data/js/chunk-echarts.44267f0d.2.js

Shape

Method 43,549
Function 5,764
Struct 4,969
TypeAlias 168
Class 6
FuncType 4
Interface 3

Languages

Go95%
TypeScript5%

Modules by API surface

docs/data/js/chunk-echarts.44267f0d.js348 symbols
docs/data/js/chunk-echarts.44267f0d.2.js348 symbols
docs/data/js/chunk-sungrowUtils.fb8bd9a6.js289 symbols
docs/data/js/chunk-sungrowUtils.558f6665.js277 symbols
docs/data/js/chunk-58ab.9ad9549d.js230 symbols
docs/data/js/chunk-f7a0.cf7e90ce.js228 symbols
docs/data/js/chunk-d500.bcf00f23.js190 symbols
docs/data/js/chunk-d500.bcf00f23.2.js189 symbols
docs/data/js/chunk-elementUI.adbc7cae.2.js177 symbols
iSolarCloud/api/GoStruct/struct_reflect.go79 symbols
iSolarCloud/api/GoStruct/valueTypes/uv.go75 symbols
docs/data/js/chunk-7961.0a3e86b0.js64 symbols

For agents

$ claude mcp add GoSungrow \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact