Closed nahuelnm23 closed 10 months ago
I'm not having faults on my system so I can't really see what's wrong, but I just added this method to the growatt class:
getNewPlantFaultLog(plantId, date, deviceSn='') {
return new Promise((resolve, reject) => {
const type = 4 - date.toString().split("-").length; // type = 1-day, 2-month, 3-year
const params = new Url.URLSearchParams({
plantId,
date, // can be YYYY, YYYY-MM, YYYY-MM-DD
deviceSn, // to filter by device serial number
toPageNum: 1, // page of the logs
type
});
if (this.lifeSignCallback) this.lifeSignCallback();
this.axios
.post(this.getUrl('/log/getNewPlantFaultLog'), params.toString(), { headers: this.makeCallHeader() })
.then(res => {
debugVerbose('getNewPlantFaultLog result:', res);
if (res.data && res.data.result && res.data.result === 1) {
debugApi('getNewPlantFaultLog resolve:', res);
resolve(res.data);
} else if (res.data && res.data.result) {
debugApi('getPlantData reject:', res.data);
reject(new Error(JSON.stringify(res.data, getJSONCircularReplacer())));
} else {
debugApi('getNewPlantFaultLog reject');
if (res.request.path.match('errorMess')) {
reject(new Error(`The server sent an unexpected response: ${res.request.path}`));
} else {
reject(new Error('The server sent an unexpected response, a fatal error has occurred'));
}
}
})
.catch(e => {
this.connected = false;
debugApi('getPlantData err:', JSON.stringify(e, getJSONCircularReplacer(), ' '));
reject(e);
});
});
}
And it's now returning something like:
{ result: 1, obj: { pages: 1, currPage: 1, datas: [], count: 0 } }
deviceSn=''
Sure that's optional
I didn't try to not send that, but it probably is
Implemented
Hi, i need get data about "Malfunction" and i see this link in the dashboard "https://server.growatt.com/log/getNewPlantFaultLog" but i can't login to get this data.
Exaple for the response: { alias:"SN" batSn:"" deviceSn:"SN" deviceType:"Inverter" eventId:"18" eventName:"Relay fault.Relay replacement is required." eventSolution:"1:Restart inverter 2:If error message still exists,contact manufacturer." sn:"SN" solution:"1:Restart inverter 2:If error message still exists,contact manufacturer." time:"2023-09-04 07:30:48" }