
InDriver Platform supports the integration of millions of Huawei devices, accessible through the SmartPVMS V600R024C00 Northern Interface (FusionSolar SmartPVMS, Current version 6).

With a simple JavaScript code, InDriver tasks execute continuous PV data acquisition, processing, and logging to SQL databases. This makes Huawei PV devices available for analysis in no time.
Look at this code example:
Every 5 minutes (300000ms), InDriver calls the getStationRealKpi and logs data to SQL Server.
if (InDriver.isHook(300000)) {
/*getStationRealKpi*/
restApiSend('getStationRealKpi',
'{ "url": "https://eu5.fusionsolar.huawei.com/thirdData/getStationRealKpi","rawData":'+JSON.stringify('{"stationCodes":"STATION_CODE"}')+', "timeout": 5000, "type": "post", "headers": { "ContentTypeHeader": "application/json", "XSRF-TOKEN":"'+ token+'" }}');
const json= RestApi.getData('getStationRealKpi');
InDriver.sqlExecute("azureserver", "select tsapiinsert('public','shelly','huawei','"+ts.toISOString()+"',$$"+json+"$$);");
}
/*send RestAPI with some debug info*/
function restApiSend( qname, q) {
InDriver.debug(qname + " > " + q)
RestApi.sendRequest(qname, q);
if (RestApi.isSucceeded()) {
const text = RestApi.getData(qname);
const pairs = RestApi.getRawHeaderPairs(qname);
InDriver.debug(qname + "<data> " + text );
InDriver.debug(qname + "<pairs> " + pairs);
}
}
Example JSON data returned by getStationRealKpi function
{
"data": [
{
"stationCode": "XXXXXXX",
"dataItemMap": {
"total_income": 0.0,
"total_power": 16901.02,
"day_power": 27.76,
"day_income": 16.656000000000702,
"real_health_state": 3,
"month_power": 163.95
}
}
],
"failCode": 0,
"message": null,
"params": {
"currentTime": 1715019600319,
"stationCodes": "XXXXXXX"
},
"success": true
}
Next steps?
Download InDriver from https://inanalytics.io
Use the full-ready code example.
Contact support when needed: contact@inanalytics.io
Remember: InDriver Platform is always free for non-commercial applications
Helpful links:
SmartPVMS V600R024C00 Northbound Interface Reference-V6 (FusionSolar SmartPVMS)
The full-ready task code example:
onHookScript:
let ts= InDriver.hookTs();
if (InDriver.isHook(1200000)) {
restApiSend('login','{ "url": "https://eu5.fusionsolar.huawei.com/thirdData/login","rawData":'+JSON.stringify('{"userName":"USER_NAME","systemCode":"PASSWORD"}')+', "timeout": 5000, "type": "post", "headers": { "ContentTypeHeader": "application/json" }}');
token = RestApi.getRawHeader('login',"xsrf-token");
InDriver.debug("<token> " + token);
}
if (InDriver.isHook(300000)) {
/*getStationRealKpi*/
restApiSend('getStationRealKpi','{ "url": "https://eu5.fusionsolar.huawei.com/thirdData/getStationRealKpi","rawData":'+JSON.stringify('{"stationCodes": "STATION_CODE"}')+', "timeout": 5000, "type": "post", "headers": { "ContentTypeHeader": "application/json", "XSRF-TOKEN":"'+ token+'" }}');
const json= RestApi.getData('getStationRealKpi');
InDriver.sqlExecute("azureserver", "select tsapiinsert('public','TABLE_NAME','Huawei','"+ts.toISOString()+"',$$"+json+"$$);");
}
onStartupScript:
InDriver.import("RestApi");
InDriver.installHook(1200000); // 20min relogin to obtain fresh xsrf-token
InDriver.installHook(300000); // 5min read data
/*login*/
var token = ""
restApiSend('login','{ "url": "https://eu5.fusionsolar.huawei.com/thirdData/login","rawData":'+JSON.stringify('{"userName":"USERN_NAME","systemCode":"PASSWORD"}')+', "timeout": 5000, "type": "post", "headers": { "ContentTypeHeader": "application/json" }}');
token = RestApi.getRawHeader('login',"xsrf-token");
InDriver.debug("<token> " + token);
/*stations*/
restApiSend('stations','{ "URL": "https://eu5.fusionsolar.huawei.com/thirdData/stations","rawData":'+JSON.stringify('{"pageNo":"1"}')+', "timeout": 5000, "type": "post", "headers": { "ContentTypeHeader": "application/json", "XSRF-TOKEN":"'+ token+'" }}');
/*getDevList*/
restApiSend('getDevList','{ "url": "https://eu5.fusionsolar.huawei.com/thirdData/getDevList","rawData":'+JSON.stringify('{"stationCodes":"STATION_CODE"}')+', "timeout": 5000, "type": "post", "headers": { "ContentTypeHeader": "application/json", "XSRF-TOKEN":"'+ token+'" }}');
/*getStationRealKpi*/
restApiSend('getStationRealKpi','{ "url": "https://eu5.fusionsolar.huawei.com/thirdData/getStationRealKpi","rawData":'+JSON.stringify('{"stationCodes" "STATION_CODE"}')+', "timeout": 5000, "type": "post", "headers": { "ContentTypeHeader": "application/json", "XSRF-TOKEN":"'+ token+'" }}');
function restApiSend( qname, q) {
InDriver.debug(qname + " > " + q)
RestApi.sendRequest(qname, q);
if (RestApi.isSucceeded()) {
const text = RestApi.getData(qname);
const pairs = RestApi.getRawHeaderPairs(qname);
InDriver.debug(qname + "<data> " + text );
InDriver.debug(qname + "<pairs> " + pairs);
}
}
Comments