diff --git a/Changelog.txt b/Changelog.txt index 864e5e1..b43099f 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,3 +1,6 @@ +1.0.2 +- check on existance of data + 1.0.1 - first diff --git a/VariEnergyApp.qml b/VariEnergyApp.qml index 66ba956..d6a621f 100644 --- a/VariEnergyApp.qml +++ b/VariEnergyApp.qml @@ -173,10 +173,19 @@ App { var JsonString = xhr.responseText var JsonObject= JSON.parse(JsonString) var priceVari - for (var a in JsonObject.Prices){ + for (var i = 0; i < 24; i++) { + if(JsonObject.Prices[i]){ + priceVari = JsonObject.Prices[i].price + }else{ + priceVari = 0 + } + pricesToday10.push(priceVari*10) + } +/* for (var a in JsonObject.Prices){ priceVari = JsonObject.Prices[a].price pricesToday10.push(priceVari*10) } +*/ if (debugOutput) console.log("*********variEnergy pricesToday10 getVaripricesToday: " + JSON.stringify(pricesToday10)); valuesUpdated() } @@ -204,12 +213,30 @@ App { var JsonString = xhr.responseText var JsonObject= JSON.parse(JsonString) var priceVari - for (var a in JsonObject.Prices) + for (var i = 0; i < 24; i++) { + if (debugOutput) console.log("*********variEnergy xhr.responseText checking : " + "Prices["+i+"].price") + if(JsonObject.Prices[i]){ + if (debugOutput) console.log("*********variEnergy found : " + "Prices["+i+"].price") + priceVari = JsonObject.Prices[i].price + }else{ + if (debugOutput) console.log("*********variEnergy not found : " + "Prices["+i+"].price") + priceVari = 0 + } + prices.push(priceVari) + prices10.push(priceVari*10) + } + + /* for (var a in JsonObject.Prices) { priceVari = JsonObject.Prices[a].price prices.push(priceVari) prices10.push(priceVari*10) } +*/ + + + + if (debugOutput) console.log("*********variEnergy prices10 getVaripricesToday: " + JSON.stringify(prices10)); currentPriceRaw = JsonObject.Prices[0].price currentPrice = currentPriceRaw currentPrice = currentPrice.replace(".",",") diff --git a/VariTile1.qml b/VariTile1.qml index a2d7b04..8c781f0 100644 --- a/VariTile1.qml +++ b/VariTile1.qml @@ -69,7 +69,7 @@ Tile { } color: !dimState? "black" : "white" text: "(" + app.lastUpdate + ")" - visible: app.currentPrice.length>1 + visible: debugOutput } diff --git a/version.txt b/version.txt index 7dea76e..6d7de6e 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -1.0.1 +1.0.2