Skip to content

Commit bcd38ec

Browse files
authored
Update APS1.plugin.txt
1 parent 573e961 commit bcd38ec

1 file changed

Lines changed: 11 additions & 11 deletions

File tree

APS1.plugin.txt

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
///////// <version>1.0.2</version>
1+
///////// <version>1.0.3</version>
22
///////// APS1 /////////////
33
///////// Plugin to extract APS data for Toon ///////////////
44
///////// By Oepi-Loepi ///////////////
@@ -7,16 +7,15 @@
77
if (debugOutput) console.log("*********SolarPanel Start getAPSData")
88
userName = encodeURI(userName)
99
passWord = encodeURI(passWord)
10-
var url = "https://apsystemsema.com:443/ema/loginEMA.action?username=" + userName + "&password=" + passWord
11-
userName = encodeURI(userName)
12-
var http = new XMLHttpRequest()
13-
10+
var url = "https://apsystemsema.com:443/ema/loginEMA.action?username=" + userName + "&password="+ passWord
11+
var http = new XMLHttpRequest()
1412
http.open("POST", url, true);
1513
http.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
1614
http.onreadystatechange = function() {
1715
if (http.readyState === 4) {
1816
if (http.status === 200) {
19-
getAPSData2()
17+
if (debugOutput) console.log(http.responseText)
18+
getAPSData3()
2019
} else {
2120
parseReturnData(currentPower,totalValue,0,0,0,0,0, http.status,"error")
2221
}
@@ -26,7 +25,7 @@
2625
}
2726

2827

29-
function getAPSData2(){
28+
function getAPSData3(){
3029
if (debugOutput) console.log("*********SolarPanel Start getAPSData2")
3130
var http = new XMLHttpRequest()
3231
var url = "https://apsystemsema.com/ema/ajax/getDashboardApiAjax/getDashboardProductionInfoAjax"
@@ -35,13 +34,14 @@
3534
http.onreadystatechange = function() { // Call a function when the state changes.
3635
if (http.readyState === 4) {
3736
if (http.status === 200) {
37+
if (debugOutput)console.log(http.responseText)
3838
var JsonObject= JSON.parse(http.responseText)
3939
currentPower = parseInt(JsonObject.lastPower.replace(".", "")/1000000)
4040
var today2 = parseInt(JsonObject.today.replace(".", "")/1000)
4141
totalValue = parseInt(JsonObject.lifetime.replace(".", "")/1000)
42-
console.log("currentPower: " + currentPower)
43-
console.log("today2: " +today2)
44-
console.log("totalValue: " +totalValue)
42+
if (debugOutput)console.log("currentPower: " + currentPower)
43+
if (debugOutput)console.log("today2: " +today2)
44+
if (debugOutput)console.log("totalValue: " +totalValue)
4545
parseReturnData(currentPower,totalValue,today2,0,0,0,0,http.status,"succes")
4646
} else {
4747
if (debugOutput) console.log("*********SolarPanel error: " + http.status)
@@ -50,4 +50,4 @@
5050
}
5151
}
5252
http.send();
53-
}
53+
}

0 commit comments

Comments
 (0)