Skip to content

Commit

Permalink
Update GROW1.plugin.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
oepi-loepi committed Jun 17, 2022
1 parent 2c9a134 commit 9bdd1b5
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions GROW1.plugin.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
///////// <version>1.0.12</version>
///////// <version>1.0.13</version>
///////// GROW1 /////////////
///////// Plugin to extract Growatt Solar data for Toon ///////////////
///////// By Oepi-Loepi ///////////////
Expand Down Expand Up @@ -31,9 +31,7 @@
var JsonString = http.responseText
if (debugOutput) console.log("*********SolarPanel JsonString " + JsonString)
var JsonObject= JSON.parse(JsonString)
var plantID = parseInt(JsonObject.back.data[0].plantId)
if (debugOutput) console.log("plantID " + plantID)
getGrowattStep2(plantID);
getGrowattStep2();
} else {
if (debugOutput) console.log("*********SolarPanel getGrowattStep2 http.status " + http.status)
currentPower = 0
Expand All @@ -46,13 +44,13 @@



function getGrowattStep2(plantID){
function getGrowattStep2(){
if (debugOutput) console.log("*********SolarPanel Start getGrowattStep3")
var http = new XMLHttpRequest()
var params = "language=5&plantId=" + plantID
var url2 = "https://server-api.growatt.com/newTwoPlantAPI.do?op=getUserCenterEnertyDataByPlantid"
console.log("*********SolarPanel url2" + url2)
http.open("POST", url2, true)
var params = "language=5"
var url2 = "https://server-api.growatt.com/newPlantAPI.do?action=getUserCenterEnertyDataTwo"
console.log("*********SolarPanel url2 " + url2)
http.open("GET", url2, true)
http.setRequestHeader("Content-type", "application/x-www-form-urlencoded")
http.setRequestHeader("Content-length", params.length)
http.setRequestHeader("Connection", "keep-alive")
Expand All @@ -70,17 +68,18 @@
if (debugOutput) console.log("today2: " + today2)
totalValue= Math.floor((JsonObject.totalValue)*1000)
if (debugOutput) console.log("totalValue: " + totalValue)
//getGrowattStep3()
parseReturnData(currentPower,totalValue,today2,0,0,0,0,http.status,"succes")
}
catch (e){
currentPower = 0
parseReturnData(0,totalValue,todayValue,0,0,0,0, http.status,"error")
parseReturnData(0,totalValue,0,0,0,0,0, http.status,"error")
}
} else {
if (debugOutput) console.log("*********SolarPanel getGrowattStep3 http.status " + http.status)
parseReturnData(0,totalValue,0,0,0,0,0, http.status,"error")
}
}
}
http.send(params);
}
http.send(params);
}

0 comments on commit 9bdd1b5

Please sign in to comment.