Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions SolarGeneralProc.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ function getSettings(){
apiKey = solarpanelSettingsJson['apiKey']
siteID = solarpanelSettingsJson['siteID']
urlString = solarpanelSettingsJson['urlString']
if (solarpanelSettingsJson['useSSL'] == "No") {useSSL = false} else {useSSL = true}
if (solarpanelSettingsJson['enableSleep'] == "Yes") {enableSleep = true} else {enableSleep = false}
if (solarpanelSettingsJson['enablePolling'] == "No") {enablePolling = false} else {enablePolling = true}
//if (solarpanelSettingsJson['DebugOn'] == "Yes") {debugOutput = true} else {debugOutput = false}
if (solarpanelSettingsJson['DebugOn'] == "Yes") {debugOutput = true} else {debugOutput = false}
} catch(e) {
}

Expand All @@ -34,6 +35,7 @@ function getSettings(){
siteID2 = solarpanelSettingsJson['siteID2']
urlString2 = solarpanelSettingsJson['urlString2']
idx2 = solarpanelSettingsJson['idx2']
if (solarpanelSettingsJson['useSSL2'] == "No") {useSSL2 = false} else {useSSL2 = true}
onlinePluginFileName2 = solarpanelSettingsJson['onlinePluginFileName2']
inverterCount = parseInt(solarpanelSettingsJson['inverterCount'])
} catch(e) {
Expand Down Expand Up @@ -67,11 +69,15 @@ function getSettings(){

if (debugOutput) console.log("*********SolarPanel Savedata Started" )
var tmpDebugOn = ""
if (debugOutput == true) {tmpDebugOn = "Yes";} else {tmpDebugOn = "No"; }
if (debugOutput == true) {tmpDebugOn = "Yes";} else {tmpDebugOn = "No";}
var tmpenableSleep = ""
if (enableSleep == true) {tmpenableSleep = "Yes";} else {tmpenableSleep = "No"; }
if (enableSleep == true) {tmpenableSleep = "Yes";} else {tmpenableSleep = "No";}
var tmpenablePolling = ""
if (enablePolling == true) {tmpenablePolling = "Yes";} else {tmpenablePolling = "No"; }
if (enablePolling == true) {tmpenablePolling = "Yes";} else {tmpenablePolling = "No";}
var tmpUseSSL = ""
if (useSSL == true) {tmpUseSSL = "Yes";} else {tmpUseSSL = "No";}
var tmpUseSSL2 = ""
if (useSSL2 == true) {tmpUseSSL2 = "Yes";} else {tmpUseSSL2 = "No";}
var setJson = {
"inverterCount" : inverterCount,
"selectedInverter-v2" : selectedInverter,
Expand All @@ -80,6 +86,7 @@ function getSettings(){
"apiKey" : apiKey,
"siteID" : siteID,
"urlString" : urlString,
"useSSL" : tmpUseSSL,
"idx" : idx,
"onlinePluginFileName" : onlinePluginFileName,
"selectedInverter2-v2" : selectedInverter2,
Expand All @@ -88,6 +95,7 @@ function getSettings(){
"apiKey2" : apiKey2,
"siteID2" : siteID2,
"urlString2" : urlString2,
"useSSL2" : tmpUseSSL2,
"idx2" : idx2,
"onlinePluginFileName2" : onlinePluginFileName2,
"enableSleep" : tmpenableSleep,
Expand Down
2 changes: 1 addition & 1 deletion SolarObjectPlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
///////// Plugin to extract Growatt Solar data for Toon ///////////////
///////// By Oepi-Loepi ///////////////

function getSolarData(passWord,userName,apiKey,siteid,urlString,totalValue){
function getSolarData(passWord,userName,apiKey,siteid,urlString,useSSL,totalValue){
if (debugOutput) console.log("*********SolarPanel Start getGrowattStep1")
//modified hash : if first of pairs is 0 then replace by c
var newpass= Qt.md5(passWord)
Expand Down
2 changes: 1 addition & 1 deletion SolarObjectPlugin2.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
///////// Plugin to extract Growatt Solar data for Toon ///////////////
///////// By Oepi-Loepi ///////////////

function getSolarData(passWord,userName,apiKey,siteid,urlString,totalValue){
function getSolarData(passWord,userName,apiKey,siteid,urlString,useSSL,totalValue){
if (debugOutput) console.log("*********SolarPanel Start getGrowattStep1")
//modified hash : if first of pairs is 0 then replace by c
var newpass= Qt.md5(passWord)
Expand Down
13 changes: 8 additions & 5 deletions SolarPanelApp.qml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ App {

property url pluginUrl : "https://raw.githubusercontent.com/ToonSoftwareCollective/solarpanel-plugins/main/"


property string currentPowerProd : "0"
property string currentUsage : "0"
property string dtime : "0"
Expand Down Expand Up @@ -118,14 +117,16 @@ App {
property string userName : ""
property string siteID : ""
property string apiKey : ""
property string urlString : ""
property string urlString : ""
property string idx : ""
property bool useSSL : true
property string passWord2 : ""
property string userName2 : ""
property string siteID2 : ""
property string apiKey2 : ""
property string urlString2 : ""
property string urlString2 : ""
property string idx2 : ""
property bool useSSL2 : true

property bool zonneplan : false
property bool zonneplan2 : false
Expand All @@ -152,13 +153,15 @@ App {
'apiKey' : "",
'siteID' : "",
'urlString' : "",
'useSSL' : true,
'idx' : "",
'selectedInverter2': "",
'passWord2' : "",
'userName2' : "",
'apiKey2' : "",
'siteID2' : "",
'urlString2' : "",
'useSSL2' : true,
'idx2' : "",
'enableSleep' : "",
'enablePolling' : "",
Expand Down Expand Up @@ -223,10 +226,10 @@ App {
inverter1CurrentPower = 0
inverter1Day = 0
inverter1Total = 0
Solar.getSolarData(passWord,userName,apiKey,siteID,urlString, parseInt(totalValue))
Solar.getSolarData(passWord,userName,apiKey,siteID,urlString,useSSL,parseInt(totalValue))
}
if (getDataCount == 1){
Solar2.getSolarData(passWord2,userName2,apiKey2,siteID2,urlString2, parseInt(totalValue))
Solar2.getSolarData(passWord2,userName2,apiKey2,siteID2,urlString2,useSSL2,parseInt(totalValue))
}
}

Expand Down
59 changes: 54 additions & 5 deletions SolarPanelConfigScreen.qml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ Screen {
property string fieldText4 : "API Key:"
property string fieldText5 : "URL like \"192.168.10.5\":"
property string fieldText6 : "IDX:"
property string fieldText7 : "Use SSL:"

property string pluginFile2: ""
property string fieldText21 : "Wachtwoord :"
Expand All @@ -42,13 +43,15 @@ Screen {
property string fieldText24 : "API Key:"
property string fieldText25 : "URL like \"192.168.10.5\":"
property string fieldText26 : "IDX:"
property string fieldText27 : "Use SSL:"

property bool field1visible : false
property bool field2visible : false
property bool field3visible : false
property bool field4visible : false
property bool field5visible : false
property bool field6visible : false
property bool field7visible : false


property bool field1visible2 : false
Expand All @@ -57,13 +60,15 @@ Screen {
property bool field4visible2 : false
property bool field5visible2 : false
property bool field6visible2 : false
property bool field7visible2 : false


property string tempPassWord : app.passWord
property string tempUserName: app.userName
property string tempSiteID: app.siteID
property string tempApiKey: app.apiKey
property string tempURL: app.urlString
property bool tempUseSSL: app.useSSL
property string tempIDX: app.idx
property string onlinePluginFileName : ""

Expand All @@ -72,6 +77,7 @@ Screen {
property string tempSiteID2: app.siteID2
property string tempApiKey2: app.apiKey2
property string tempURL2: app.urlString2
property bool tempUseSSL2: app.useSSL2
property string tempIDX2: app.idx2
property string onlinePluginFileName2 : ""

Expand Down Expand Up @@ -135,20 +141,21 @@ Screen {
sendMailText2 = "mail versturen"
getPasseText2 = "Eerst mail versturen"


enableSleepToggle.isSwitchedOn = app.enableSleep
enablePollingToggle.isSwitchedOn = app.enablePolling
inputField1.inputText = tempPassWord
inputField2.inputText = tempUserName
inputField3.inputText = tempSiteID
inputField4.inputText = tempApiKey
inputField5.inputText = tempURL
useSSLToggle.isSwitchedOn = tempUseSSL
inputField6.inputText = tempApiKey
inputField21.inputText = tempPassWord2
inputField22.inputText = tempUserName2
inputField23.inputText = tempSiteID2
inputField24.inputText = tempApiKey2
inputField25.inputText = tempURL2
useSSLToggle2.isSwitchedOn = tempUseSSL2
inputField26.inputText = tempApiKey2
if (app.inverterCount >1){tempInverterCount = 2 ;inverterCountToggle.isSwitchedOn = true}else{tempInverterCount = 1;inverterCountToggle.isSwitchedOn = false}
}
Expand Down Expand Up @@ -241,24 +248,25 @@ Screen {
if (invertersNameArray[x2].toLowerCase()==selectedInverter.toLowerCase()){listview1.currentIndex = x2 }
}
field1visible = ((inputDataType[listview1.currentIndex]).toString().toLowerCase().indexOf('ass')>-1)
field2visible = ((inputDataType[listview1.currentIndex]).toString().toLowerCase().indexOf('use')>-1)
field2visible = ((inputDataType[listview1.currentIndex]).toString().toLowerCase().indexOf('user')>-1)
field3visible = ((inputDataType[listview1.currentIndex]).toString().toLowerCase().indexOf('iteid')>-1)
field4visible = ((inputDataType[listview1.currentIndex]).toString().toLowerCase().indexOf('api')>-1)
field5visible = ((inputDataType[listview1.currentIndex]).toString().toLowerCase().indexOf('url')>-1)
field6visible = ((inputDataType[listview1.currentIndex]).toString().toLowerCase().indexOf('idx')>-1)
field7visible = ((inputDataType[listview1.currentIndex]).toString().toLowerCase().indexOf('usessl')>-1)
}

function setFieldText2() {
for(var x2 = 0;x2 < invertersNameArray.length;x2++){
if (invertersNameArray[x2].toLowerCase()==selectedInverter2.toLowerCase()){ listview1.currentIndex = x2}
}
field1visible2 = ((inputDataType[listview1.currentIndex]).toString().toLowerCase().indexOf('ass')>-1)
field2visible2 = ((inputDataType[listview1.currentIndex]).toString().toLowerCase().indexOf('use')>-1)
field2visible2 = ((inputDataType[listview1.currentIndex]).toString().toLowerCase().indexOf('user')>-1)
field3visible2 = ((inputDataType[listview1.currentIndex]).toString().toLowerCase().indexOf('iteid')>-1)
field4visible2 = ((inputDataType[listview1.currentIndex]).toString().toLowerCase().indexOf('api')>-1)
field5visible2 = ((inputDataType[listview1.currentIndex]).toString().toLowerCase().indexOf('url')>-1)
field6visible2 = ((inputDataType[listview1.currentIndex]).toString().toLowerCase().indexOf('idx')>-1)
field7visible2 = ((inputDataType[listview1.currentIndex]).toString().toLowerCase().indexOf('info')>-1)
field7visible2 = ((inputDataType[listview1.currentIndex]).toString().toLowerCase().indexOf('usessl')>-1)
}

/////////////////////////////////////////////////////// SAVE DATA TO TEMPS WHEN SAVE IS CLICKED ON AN INPUTFIELD ///////////////////////////////////////////////
Expand Down Expand Up @@ -935,6 +943,26 @@ Screen {
id: inputField6 ; width: isNxt? parent.width - mytext1.left - 40 : parent.width - mytext1.left - 32; height: isNxt? 35:28; leftTextAvailableWidth: isNxt? 100:80;
leftText: "";visible: (inputField6Text.visible);onClicked: {qkeyboard.open(fieldText6, inputField6.inputText, saveFieldData6)}
}
//usessl
Row {
id: toggleField7Row
spacing: 5
visible: field7visible
Text {id: inputField7Text;font.pixelSize: isNxt ? 18:14; font.family: qfont.semiBold.name ;text:fieldText7;visible: (toggleField7Row.visible)}
OnOffToggle {
id: useSSLToggle
visible: (toggleField7Row.visible)
height: 30
leftIsSwitchedOn: false
onSelectedChangedByUser: {
if (isSwitchedOn) {
tempUseSSL = true
} else {
tempUseSSL = false
}
}
}
}

}

Expand Down Expand Up @@ -1104,7 +1132,26 @@ Screen {
id: inputField26 ; width: isNxt? parent.width - mytext12.left - 40 : parent.width - mytext12.left - 32; height: isNxt? 35:28; leftTextAvailableWidth: isNxt? 100:80;
leftText: "";visible: (inputField6Text2.visible);onClicked: {qkeyboard.open(fieldText26, inputField26.inputText, saveFieldData26)}
}

//usessl
Row {
id: toggleField7Row2
spacing: 5
visible: field7visible2
Text {id: inputField7Text2;font.pixelSize: isNxt ? 18:14; font.family: qfont.semiBold.name ;text:fieldText7;visible: (toggleField7Row2.visible)}
OnOffToggle {
id: useSSLToggle2
visible: (toggleField7Row2.visible)
height: 30
leftIsSwitchedOn: false
onSelectedChangedByUser: {
if (isSwitchedOn) {
tempUseSSL2 = true
} else {
tempUseSSL2 = false
}
}
}
}
}

Grid {
Expand Down Expand Up @@ -1521,6 +1568,7 @@ Screen {
if(selectedInverter.toLowerCase() == "Enphase T"){tempApiKey = ""}
app.apiKey = tempApiKey
app.urlString = tempURL
app.useSSL = tempUseSSL
app.idx = tempApiKey
app.onlinePluginFileName = onlinePluginFileName
app.selectedInverter2 = selectedInverter2
Expand All @@ -1531,6 +1579,7 @@ Screen {
if(selectedInverter2.toLowerCase() == "Enphase T"){tempApiKey2 = ""}
app.apiKey2 = tempApiKey2
app.urlString2 = tempURL2
app.useSSL2 = tempUseSSL2
app.idx2 = tempApiKey2
app.onlinePluginFileName2 = onlinePluginFileName2
app.saveSettings()
Expand Down