SkillAgentSearch skills...

Growatt

No description available

Install / Use

/learn @PLCHome/Growatt
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

Logo

NPM version Downloads week Downloads month Downloads year

NPM

Logorowatt API for Inverter

this is an Node for the API on the Growatt© Shine Webserver. (Shine provided by Growatt©. I'm not affiliated.)

This implementation is based on the refectured eebinterface from Growatt&copy Shine.

Install

npm install growatt

Debug

This API supported debugging. you have to set the environment variable DEBUG

set DEBUG=growatt:*
set DEBUG=growatt:api
set DEBUG=growatt:verbose
set DEBUG=growatt:queue

In code: there are the following functions:

setDebugApi

| Parameter | Type | Default | Description | | --------- | ------- | ------- | ------------------------------------------------------------ | | enable | boolean | | "true" enables API debugging, "false" disables all debugging |

setDebugVerbose

| Parameter | Type | Default | Description | | --------- | ------- | ------- | ------------------------------------------------------------------------ | | enable | boolean | | "true" enables API and Verbose debugging, "false" disables all debugging |

"use strict"
const api = require('growatt')
api.setDebugApi(true);

or

"use strict"
const api = require('growatt')
api.setDebugVerbose(true); //

...

api.setDebugApi(false); //All debug is always turned off. So it's similar to api.setDebugVerbose(false)

Promise

This NODE-Implementation works with promise.

Understanding javascript promises

Modern Asynchronous JavaScript with Async and Await

Simple Impemation

"use strict"
const api = require('growatt')

const user="xxx"
const passwort="xx"
const options={}

async function test() {
  const growatt = new api({})
  let login = await growatt.login(user,passwort).catch(e => {console.log(e)})
  console.log('login:',login)
  let getAllPlantData = await growatt.getAllPlantData(options).catch(e => {console.log(e)})
  console.log('getAllPlatData:',JSON.stringify(getAllPlantData,null,' '));
  let logout = await growatt.logout().catch(e => {console.log(e)})
  console.log('logout:',logout)
}

test()

Constructor

Please note that you have to create an instance since version 0.2.0.

| Parameter | Type | Default | Description | | --------- | ------ | --------- | ----------------------- | | config | Object | See below | Controls the processing |

The constructor has a config object as parameter. This is optional.

Config

| config | Type | Default | Description | | ---------------- | -------- | ---------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | | server | String | 'https://server.growatt.com' | The Growatt server | | indexCandI | Boolean | false | Set to true if your Growatt page Plant is a C&I Plant page with indexbC or plantDo in the Path from the Growatt webinterface. | | timeout | Integer | 5000 | Session timeout in ms. | | headers | Object | {} | custom header like {'X-Custom-Header': 'foobar'}. | | lifeSignCallback | function | undefined | Called before each Axios call. |

const api = require('growatt')
const growatt = new api()

Login

There are several options for logging in:

Login with user and password

| Parameter | Type | Default | Description | | --------- | ------ | ------- | ------------ | | user | String | - | The username | | passord | String | - | The password |

  let login = await growatt.login(user,passwort).catch(e => {console.log(e)})

With resolve, the response from the website is returned. Usually the object: { result: 1, msg: 'OK' }

With reject an exception is thrown which contains the error object with result less then 1.

Login with key

| Parameter | Type | Default | Description | | --------- | ------ | ------- | ----------- | | key | String | - | The key |

You can get the key by having an email sent to you on the Grwatt website for a third party to display the data. The key is the combination of numbers and letters in the link. It has 96 characters.

  let login = await growatt.sharePlantLogin(key).catch(e => {console.log(e)})

With resolve, the response from the website is returned. Usually the object: { result: 1, msg: 'OK' }

With reject an exception is thrown which contains the error object with result less then 1.

Login to Demo

| Parameter | Type | Default | Description | | --------- | ---- | ------- | ----------- | | | |

This plugin is intended for testing. On the Growatt page you can view the data from many systems. The problem is that the ID of the system is different here every time you login.

I needed it so that I could see how the messages to the different inverters are structured.

  let login = await growatt.demoLogin().catch(e => {console.log(e)})

Get all plant data

| Parameter | Type | Default | Description | | --------- | ------ | --------- | ----------------------- | | option | Object | See below | Controls the processing |

This function knows the individual types of the inverter and calls up the data.

This function can be controlled via an option so that you don't always have to call up all the data that is possible:

Option

| Option | Type | Default | Description | | -------------------- | ---------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | plantData | Boolean | true | True calls the description dataset of the plant. | | deviceData | Boolean | true | True calls the description dataset of the plantdevice. | | weather | Boolean | true | True calls the weather dataset of the plant. | | faultlog | Boolean | false | True retrieves the plant's fault logs. An array with the most recent event first is returned. | | faultlogdate | String | 'YYYY' | It is only taken into account if faultlog is true. It must be a string with the date in 'YYYY', 'YYYY-MM', 'YYYY-MM-DD'. | | faultlogdateindex | Boolean | true | It is only taken into account if faultlog is true. The array is converted into timestampsobjects. | | plantId | Integer | undefined | The ID of a plant. So that the output can be restricted. Attention, the ID is constantly changing on demologin. | | totalData | Boolean | true | Retrieves the data integrals. The sums since start time. | | statusData | Boolean | true | This is not available for all systems. Here, the current operating status, fuel injection, battery charge and generation is called up. However, the data is also contained in historyLast. | | deviceTyp | Boolean | false | Add the device type to the Output. | | historyLast | Boolean | true | The last data record from the system history table is called up here. | | historyAll | Boolean | false | All data records from the system history table is called up here.

View on GitHub
GitHub Stars45
CategoryDevelopment
Updated1mo ago
Forks11

Languages

JavaScript

Security Score

70/100

Audited on Feb 9, 2026

No findings