solax-summary-fetch

TotalClaw 作者 totalclaw

使用 npm 包 sola-cloud-api 从 Solax Cloud API 获取逆变器摘要数据。当用户提供(或已配置)Solax tokenId 和逆变器序列号 (sn) 并希望当前/摘要能源数据以 JSON(类型为 SolaxSummary)形式返回用于仪表板/自动化时使用。

安装 / 下载方式

TotalClaw CLI推荐
totalclaw install totalclaw:totalclaw~allmightysauron-solax-cloud-api
cURL直接下载,无需登录
curl -fsSL https://skills.taituai.com/api/skills/totalclaw%3Atotalclaw~allmightysauron-solax-cloud-api/file -o allmightysauron-solax-cloud-api.md
## 概述(中文)

使用 npm 包 sola-cloud-api 从 Solax Cloud API 获取逆变器摘要数据。当用户提供(或已配置)Solax tokenId 和逆变器序列号 (sn) 并希望当前/摘要能源数据以 JSON(类型为 SolaxSummary)形式返回用于仪表板/自动化时使用。

## 原文

# solax-summary-fetch

Fetch Solax inverter summary data as JSON.

## Setup (one-time)

This skill uses Node.js and the npm package `solax-cloud-api`.

Install dependencies inside the skill folder:

```bash
cd /home/openclaw/.openclaw/workspace/skills/solax-summary-fetch/scripts
npm install
```

(We use `npm install` instead of `npm ci` because this skill does not ship with a lockfile.)

## Inputs

You need:

- `tokenId` (Solax Cloud API token id)
- `sn` (inverter serial number)

### Recommended: environment variables

Set these in your runtime (preferred so you don’t leak secrets into shell history):

- `SOLAX_TOKENID`
- `SOLAX_SN`

**Do not** hardcode credentials into the skill files.

### Alternate: CLI arguments

Pass them explicitly as:

- `--tokenId <tokenId>`
- `--sn <serial>`

## Command

```bash
cd /home/openclaw/.openclaw/workspace/skills/solax-summary-fetch/scripts
node fetch_summary.mjs --tokenId "$SOLAX_TOKENID" --sn "$SOLAX_SN"
```

## Output

- Prints a single JSON object to stdout.
- The JSON conforms to the **SolaxSummary** interface exposed by `solax-cloud-api` (see `references/solax-summary.d.ts`).
- Under the hood (solax-cloud-api v0.2.0): fetches `getAPIData()` then converts via `SolaxCloudAPI.toSummary()`.

## Guardrails

- Never print or log the tokenId beyond confirming whether it is set (redact it).
- If the API call fails, return a structured error JSON with `ok:false` and a short `error` message.