# mickmake/gosungrow architecture

> Architecture diagram of the GitHub repository mickmake/gosungrow, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mickmake/gosungrow
- Repository: https://github.com/mickmake/gosungrow

## Overview

GoSungrow is a Go client and CLI for iSolarCloud, with higher-level plant/device queries and integrations for Home Assistant and Modbus. The main workflow is CLI command dispatch, cloud authentication and API access, then display or export of plant data. The README also documents graphing, broad API endpoint coverage, multiple output formats, and MQTT publishing. The sampled source confirms authentication, query, endpoint-catalog, and MQTT behavior; wiring for unsampled features is shown only where the README establishes the capability.

Main entry points: [`cmd/commands.go`](https://github.com/mickmake/gosungrow/blob/master/cmd/commands.go) (Command dispatch), [`iSolarCloud/highlevel_ps.go`](https://github.com/mickmake/gosungrow/blob/master/iSolarCloud/highlevel_ps.go) (Cloud client), [`iSolarCloud/AppService/login/auth.go`](https://github.com/mickmake/gosungrow/blob/master/iSolarCloud/AppService/login/auth.go) (Cloud login), [`main.go`](https://github.com/mickmake/gosungrow/blob/master/main.go) (Program entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI workflows"]
  node_entry["Program entry<br/>[main.go]"]
  node_commands["Command dispatch<br/>[commands.go]"]
end

subgraph group_cloud["iSolarCloud access"]
  node_auth["Cloud login<br/>[auth.go]"]
  node_api["Cloud client<br/>[highlevel_ps.go]"]
  node_appservice["App endpoints<br/>[struct.go]"]
  node_webapp["Web endpoints<br/>[struct.go]"]
  node_webisc["ISCM endpoints<br/>[struct.go]"]
end

subgraph group_data["Data presentation"]
  node_reporting["Plant queries<br/>[highlevel_ps.go]"]
  node_show["Show commands<br/>[cmd_show.go]"]
  node_dataout["Data output<br/>[cmd_data.go]"]
  node_tables["Tabular data<br/>[tablib_dataset.go]"]
end

subgraph group_integrations["Integrations"]
  node_mqttcmd["MQTT command<br/>[cmd_mqtt.go]"]
  node_hassio["HA entities<br/>[lights.go]"]
  node_modbuscmd["Modbus command<br/>[cmd_modbus.go]"]
  node_modbus["Modbus decoding<br/>[struct.go]"]
end

node_user(("CLI user"))
node_sungrow["iSolarCloud"]
node_token["Token file"]
node_ha["Home Assistant"]
node_broker["MQTT broker"]

node_user -->|"runs"| node_entry
node_entry -->|"executes"| node_commands
node_commands -->|"logs in"| node_auth
node_auth -->|"authenticates"| node_sungrow
node_auth -->|"reads/writes"| node_token
node_commands -->|"queries"| node_api
node_api -->|"uses endpoints"| node_appservice
node_api -->|"uses endpoints"| node_webapp
node_api -->|"uses endpoints"| node_webisc
node_appservice -->|"calls API"| node_sungrow
node_webapp -->|"calls API"| node_sungrow
node_webisc -->|"calls API"| node_sungrow
node_api -->|"provides queries"| node_reporting
node_commands -->|"dispatches"| node_show
node_show -->|"requests data"| node_reporting
node_commands -->|"dispatches"| node_dataout
node_dataout -->|"formats data"| node_tables
node_commands -->|"dispatches"| node_mqttcmd
node_mqttcmd -->|"publishes entities"| node_hassio
node_hassio -->|"publishes topics"| node_broker
node_ha -->|"subscribes"| node_broker
node_commands -->|"dispatches"| node_modbuscmd
node_modbuscmd -->|"decodes values"| node_modbus

click node_entry "https://github.com/mickmake/gosungrow/blob/master/main.go"
click node_commands "https://github.com/mickmake/gosungrow/blob/master/cmd/commands.go"
click node_auth "https://github.com/mickmake/gosungrow/blob/master/iSolarCloud/AppService/login/auth.go"
click node_api "https://github.com/mickmake/gosungrow/blob/master/iSolarCloud/highlevel_ps.go"
click node_appservice "https://github.com/mickmake/gosungrow/blob/master/iSolarCloud/AppService/struct.go"
click node_webapp "https://github.com/mickmake/gosungrow/blob/master/iSolarCloud/WebAppService/struct.go"
click node_webisc "https://github.com/mickmake/gosungrow/blob/master/iSolarCloud/WebIscmAppService/struct.go"
click node_reporting "https://github.com/mickmake/gosungrow/blob/master/iSolarCloud/highlevel_ps.go"
click node_show "https://github.com/mickmake/gosungrow/blob/master/cmd/cmd_show.go"
click node_dataout "https://github.com/mickmake/gosungrow/blob/master/cmd/cmd_data.go"
click node_tables "https://github.com/mickmake/gosungrow/blob/master/tablib/tablib_dataset.go"
click node_mqttcmd "https://github.com/mickmake/gosungrow/blob/master/cmd/cmd_mqtt.go"
click node_hassio "https://github.com/mickmake/gosungrow/blob/master/cmdHassio/lights.go"
click node_modbuscmd "https://github.com/mickmake/gosungrow/blob/master/cmd/cmd_modbus.go"
click node_modbus "https://github.com/mickmake/gosungrow/blob/master/cmdModbus/struct.go"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_entry,node_commands,node_user toneBlue
class node_auth,node_api,node_appservice,node_webapp,node_webisc toneAmber
class node_reporting,node_show,node_dataout,node_tables toneMint
class node_mqttcmd,node_hassio,node_modbuscmd,node_modbus toneRose
class node_sungrow,node_token,node_ha,node_broker toneIndigo
```

## Components

### CLI workflows

- [Program entry](https://github.com/mickmake/gosungrow/blob/master/main.go): `main.go`
- [Command dispatch](https://github.com/mickmake/gosungrow/blob/master/cmd/commands.go): `cmd/commands.go`

### iSolarCloud access

- [Cloud login](https://github.com/mickmake/gosungrow/blob/master/iSolarCloud/AppService/login/auth.go): `iSolarCloud/AppService/login/auth.go`
- [Cloud client](https://github.com/mickmake/gosungrow/blob/master/iSolarCloud/highlevel_ps.go): `iSolarCloud/highlevel_ps.go`
- [App endpoints](https://github.com/mickmake/gosungrow/blob/master/iSolarCloud/AppService/struct.go): `iSolarCloud/AppService/struct.go`
- [Web endpoints](https://github.com/mickmake/gosungrow/blob/master/iSolarCloud/WebAppService/struct.go): `iSolarCloud/WebAppService/struct.go`
- [ISCM endpoints](https://github.com/mickmake/gosungrow/blob/master/iSolarCloud/WebIscmAppService/struct.go): `iSolarCloud/WebIscmAppService/struct.go`

### Data presentation

- [Plant queries](https://github.com/mickmake/gosungrow/blob/master/iSolarCloud/highlevel_ps.go): `iSolarCloud/highlevel_ps.go`
- [Show commands](https://github.com/mickmake/gosungrow/blob/master/cmd/cmd_show.go): `cmd/cmd_show.go`
- [Data output](https://github.com/mickmake/gosungrow/blob/master/cmd/cmd_data.go): `cmd/cmd_data.go`
- [Tabular data](https://github.com/mickmake/gosungrow/blob/master/tablib/tablib_dataset.go): `tablib/tablib_dataset.go`

### Integrations

- [MQTT command](https://github.com/mickmake/gosungrow/blob/master/cmd/cmd_mqtt.go): `cmd/cmd_mqtt.go`
- [HA entities](https://github.com/mickmake/gosungrow/blob/master/cmdHassio/lights.go): `cmdHassio/lights.go`
- [Modbus command](https://github.com/mickmake/gosungrow/blob/master/cmd/cmd_modbus.go): `cmd/cmd_modbus.go`
- [Modbus decoding](https://github.com/mickmake/gosungrow/blob/master/cmdModbus/struct.go): `cmdModbus/struct.go`

### Other components

- **CLI user**
- **iSolarCloud**
- **Token file**
- **Home Assistant**
- **MQTT broker**

## Connections

- CLI user → Program entry: runs
- Program entry → Command dispatch: executes
- Command dispatch → Cloud login: logs in
- Cloud login → iSolarCloud: authenticates
- Cloud login → Token file: reads/writes
- Command dispatch → Cloud client: queries
- Cloud client → App endpoints: uses endpoints
- Cloud client → Web endpoints: uses endpoints
- Cloud client → ISCM endpoints: uses endpoints
- App endpoints → iSolarCloud: calls API
- Web endpoints → iSolarCloud: calls API
- ISCM endpoints → iSolarCloud: calls API
- Cloud client → Plant queries: provides queries
- Command dispatch → Show commands: dispatches
- Show commands → Plant queries: requests data
- Command dispatch → Data output: dispatches
- Data output → Tabular data: formats data
- Command dispatch → MQTT command: dispatches
- MQTT command → HA entities: publishes entities
- HA entities → MQTT broker: publishes topics
- Home Assistant → MQTT broker: subscribes
- Command dispatch → Modbus command: dispatches
- Modbus command → Modbus decoding: decodes values
