Skip to content

Commit 9bdd1b5

Browse files
author
oepi-loepi
committed
Update GROW1.plugin.txt
1 parent 2c9a134 commit 9bdd1b5

1 file changed

Lines changed: 11 additions & 12 deletions

File tree

GROW1.plugin.txt

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
///////// <version>1.0.12</version>
1+
///////// <version>1.0.13</version>
22
///////// GROW1 /////////////
33
///////// Plugin to extract Growatt Solar data for Toon ///////////////
44
///////// By Oepi-Loepi ///////////////
@@ -31,9 +31,7 @@
3131
var JsonString = http.responseText
3232
if (debugOutput) console.log("*********SolarPanel JsonString " + JsonString)
3333
var JsonObject= JSON.parse(JsonString)
34-
var plantID = parseInt(JsonObject.back.data[0].plantId)
35-
if (debugOutput) console.log("plantID " + plantID)
36-
getGrowattStep2(plantID);
34+
getGrowattStep2();
3735
} else {
3836
if (debugOutput) console.log("*********SolarPanel getGrowattStep2 http.status " + http.status)
3937
currentPower = 0
@@ -46,13 +44,13 @@
4644

4745

4846

49-
function getGrowattStep2(plantID){
47+
function getGrowattStep2(){
5048
if (debugOutput) console.log("*********SolarPanel Start getGrowattStep3")
5149
var http = new XMLHttpRequest()
52-
var params = "language=5&plantId=" + plantID
53-
var url2 = "https://server-api.growatt.com/newTwoPlantAPI.do?op=getUserCenterEnertyDataByPlantid"
54-
console.log("*********SolarPanel url2" + url2)
55-
http.open("POST", url2, true)
50+
var params = "language=5"
51+
var url2 = "https://server-api.growatt.com/newPlantAPI.do?action=getUserCenterEnertyDataTwo"
52+
console.log("*********SolarPanel url2 " + url2)
53+
http.open("GET", url2, true)
5654
http.setRequestHeader("Content-type", "application/x-www-form-urlencoded")
5755
http.setRequestHeader("Content-length", params.length)
5856
http.setRequestHeader("Connection", "keep-alive")
@@ -70,17 +68,18 @@
7068
if (debugOutput) console.log("today2: " + today2)
7169
totalValue= Math.floor((JsonObject.totalValue)*1000)
7270
if (debugOutput) console.log("totalValue: " + totalValue)
71+
//getGrowattStep3()
7372
parseReturnData(currentPower,totalValue,today2,0,0,0,0,http.status,"succes")
7473
}
7574
catch (e){
7675
currentPower = 0
77-
parseReturnData(0,totalValue,todayValue,0,0,0,0, http.status,"error")
76+
parseReturnData(0,totalValue,0,0,0,0,0, http.status,"error")
7877
}
7978
} else {
8079
if (debugOutput) console.log("*********SolarPanel getGrowattStep3 http.status " + http.status)
8180
parseReturnData(0,totalValue,0,0,0,0,0, http.status,"error")
8281
}
8382
}
8483
}
85-
http.send(params);
86-
}
84+
http.send(params);
85+
}

0 commit comments

Comments
 (0)