Skip to content

Commit

Permalink
version 1.1.15
Browse files Browse the repository at this point in the history
1.1.15
- modified for mobile app
- tariff setting added
  • Loading branch information
oepi-loepi committed Jun 19, 2021
1 parent 560aa22 commit 21dde32
Show file tree
Hide file tree
Showing 5 changed files with 325 additions and 3 deletions.
6 changes: 5 additions & 1 deletion Changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
1.1.15
- modified for mobile app
- tariff setting added

1.1.14
- Lowercased second words on the tiles instead of capitals
- lowerCase instead of Capitals on tile text

1.1.13
- domoticz water quantity error repaired
Expand Down
20 changes: 19 additions & 1 deletion ToonWaterApp.qml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,12 @@ App {
property url thumbnailIcon1: ("qrc://apps/graph/drawables/waterTapTile-thumb.svg") //werkt


property WaterConfigScreen waterConfigScreen
property WaterConfigScreen waterConfigScreen
property url waterConfigScreenUrl : "WaterConfigScreen.qml"

property WaterTariffScreen waterTariffScreen
property url waterTariffScreenUrl : "WaterTariffScreen.qml"

property string popupString : "Water instellen en herstarten als nodig" + "..."
property string configMsgUuid : ""

Expand All @@ -34,6 +38,8 @@ App {
property int dayAvgValue : 200

property bool debugOutput : false
property int waterflowMobile : 0
property int watertodayMobile : 0

property date dateTimeNow
property int dday
Expand Down Expand Up @@ -75,6 +81,7 @@ App {
registry.registerWidget("tile", tileNow, this, null, {thumbLabel: qsTr("Nu"), thumbIcon: thumbnailIcon1, thumbCategory: "general", thumbWeight: 30, baseTileWeight: 10, thumbIconVAlignment: "center"});
registry.registerWidget("tile", tileUrl2, this, null, {thumbLabel: qsTr("Text"), thumbIcon: thumbnailIcon1, thumbCategory: "general", thumbWeight: 30, baseTileWeight: 10, thumbIconVAlignment: "center"});
registry.registerWidget("screen", waterConfigScreenUrl, this, "waterConfigScreen")
registry.registerWidget("screen", waterTariffScreenUrl, this, "waterTariffScreen")
registry.registerWidget("tile", waterTodayTileUrl, this, null, {thumbLabel: qsTr("Vandaag m3"), thumbIcon: thumbnailIcon1, thumbCategory: "general", thumbWeight: 30, baseTileSolarWeight: 10, thumbIconVAlignment: "center"});
registry.registerWidget("tile", waterTodayTileEurUrl, this, null, {thumbLabel: qsTr("Vandaag EUR"), thumbIcon: thumbnailIcon1, thumbCategory: "general", thumbWeight: 30, baseTileSolarWeight: 10, thumbIconVAlignment: "center"});
registry.registerWidget("popup", waterRebootPopupUrl, waterApp, "waterRebootPopup");
Expand All @@ -84,6 +91,7 @@ App {
FileIO {id: water_lastFiveDays; source: "file:///mnt/data/tsc/appData/water_lastFiveDays.txt"}
FileIO {id: water_totalValue; source: "file:///mnt/data/tsc/appData/water_totalValue.txt"}
FileIO {id: pwrusageFile; source: "file:///mnt/data/qmf/config/config_happ_pwrusage.xml"}
FileIO {id: water_mobile; source: "file:///qmf/www/mobile/water_mobile.json"}


Component.onCompleted: {
Expand Down Expand Up @@ -186,6 +194,11 @@ App {
todayValue = waterquantity - yesterdayquantity
//console.log("*********Water todayValue " + todayValue)
waterUpdated()
if (waterflowMobile != waterflow || watertodayMobile != todayValue ){
water_mobile.write("{\"result\":\"ok\",\"water\": {\"flow\":" + waterflow + ", \"value\":" + todayValue + ", \"avgValue\":" + dayAvgValue + "}}")
waterflowMobile = waterflow
watertodayMobile = todayValue
}
if (fivemin){doData()}
} else {
if (debugOutput) console.log("*********Water error: " + http.status)
Expand Down Expand Up @@ -282,6 +295,11 @@ App {
todayValue = waterquantity - yesterdayquantity
if (debugOutput) console.log("*********Water todayValue " + todayValue)
waterUpdated()
if (waterflowMobile != waterflow || watertodayMobile != todayValue ){
water_mobile.write("{\"result\":\"ok\",\"water\": {\"flow\":" + waterflow + ", \"value\":" + todayValue + ", \"avgValue\":" + dayAvgValue + "}}")
waterflowMobile = waterflow
watertodayMobile = todayValue
}
if (fivemin){doData()}
} else {
if (debugOutput) console.log("*********Water error: " + http.status)
Expand Down
42 changes: 42 additions & 0 deletions WaterConfigScreen.qml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Screen {
property string fieldText1 : "Nieuwe waterstand:"
property string tempTotal: app.waterquantity
property bool waterTotalChanged : false
property bool waterTarifffound: false

property string oldConfigQmfFileString
property bool debugOutput : app.debugOutput
Expand All @@ -33,6 +34,7 @@ Screen {

onShown: {
addCustomTopRightButton("Opslaan")
getTariff()
enableDomMode.isSwitchedOn = tempDomMode
inputField1.inputText = tempTotal
espIP.inputText =tempEspURL
Expand Down Expand Up @@ -106,6 +108,29 @@ Screen {
qkeyboard.open(inputField1.leftText, inputField1.inputText, saveFieldData1)
}
}

NewTextLabel {
id: tariffButton
width: isNxt ? 284 : 220
height: isNxt ? 35 : 30
buttonActiveColor: "lightgrey"
buttonHoverColor: "blue"
enabled : true
textColor : "black"
textDisabledColor : "grey"
buttonText: "tarieven"
anchors {
top: mytext1.bottom
topMargin: 6
left: inputField1.right
leftMargin: 30
}
onClicked: {
onClicked: {stage.openFullscreen(app.waterTariffScreenUrl)}
}
visible: waterTarifffound
}


NewTextLabel {
id: savequantityText
Expand Down Expand Up @@ -368,6 +393,23 @@ Screen {
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function getTariff(){

console.log("*********Water check billingInfo in config_happ_pwrusage.xml")
var waterfound = false
var pwrusageString = pwrusageFile.read()
var pwrusageArray = pwrusageString.split("<billingInfo>")
for (var t in pwrusageArray){
var n201 = pwrusageArray[t].indexOf('</billingInfo>')
var partOfString = pwrusageArray[t].substring(0, n201)
if (partOfString.indexOf("water")>-1){
waterTarifffound = true
}
}
}



function modRRDConfig(configChangeStep){
var configfileString
var oldconfigfileString
Expand Down
Loading

0 comments on commit 21dde32

Please sign in to comment.