From a7a7978821664b4a580633f1b276fa12e71e6d31 Mon Sep 17 00:00:00 2001 From: Michael Zanetti Date: Tue, 13 Jul 2021 11:13:11 +0200 Subject: [PATCH] Add some more sensor support to inlinecontrols --- nymea-app/images.qrc | 1 + nymea-app/ui/Nymea.qml | 2 + nymea-app/ui/StyleBase.qml | 3 +- nymea-app/ui/delegates/InterfaceTile.qml | 22 ++- nymea-app/ui/delegates/ThingTile.qml | 10 + nymea-app/ui/images/sensors/orp.svg | 226 +++++++++++++++++++++++ 6 files changed, 256 insertions(+), 8 deletions(-) create mode 100644 nymea-app/ui/images/sensors/orp.svg diff --git a/nymea-app/images.qrc b/nymea-app/images.qrc index 1e060b4d..cb1c6dc2 100644 --- a/nymea-app/images.qrc +++ b/nymea-app/images.qrc @@ -267,5 +267,6 @@ ui/images/zigbee-router.svg ui/images/sensors/o2.svg ui/images/sensors/ph.svg + ui/images/sensors/orp.svg diff --git a/nymea-app/ui/Nymea.qml b/nymea-app/ui/Nymea.qml index 38e4a7b1..65f987d0 100644 --- a/nymea-app/ui/Nymea.qml +++ b/nymea-app/ui/Nymea.qml @@ -301,6 +301,8 @@ ApplicationWindow { return Qt.resolvedUrl("images/sensors/o2.svg") case "phsensor": return Qt.resolvedUrl("images/sensors/ph.svg") + case "orpsensor": + return Qt.resolvedUrl("images/sensors/orp.svg") case "media": case "mediacontroller": case "mediaplayer": diff --git a/nymea-app/ui/StyleBase.qml b/nymea-app/ui/StyleBase.qml index 4abcb79b..53ce2dd3 100644 --- a/nymea-app/ui/StyleBase.qml +++ b/nymea-app/ui/StyleBase.qml @@ -89,7 +89,8 @@ Item { "ventilation": "lightblue", "watersensor": "aqua", "phsensor": "green", - "o2sensor": "lightblue" + "o2sensor": "lightblue", + "orpsensor": "yellow" } property var stateColors: { diff --git a/nymea-app/ui/delegates/InterfaceTile.qml b/nymea-app/ui/delegates/InterfaceTile.qml index b68f8238..c399b828 100644 --- a/nymea-app/ui/delegates/InterfaceTile.qml +++ b/nymea-app/ui/delegates/InterfaceTile.qml @@ -191,6 +191,7 @@ MainPageTile { case "irrigation": case "ventilation": case "cleaningrobot": + case "evcharger": return buttonComponent case "media": return mediaControlComponent @@ -289,6 +290,7 @@ MainPageTile { case "irrigation": case "ventilation": case "powersocket": + case "evcharger": var count = 0; for (var i = 0; i < thingsProxy.count; i++) { var thing = thingsProxy.get(i); @@ -307,7 +309,7 @@ MainPageTile { return "" // return qsTr("%1 installed").arg(thingsProxy.count) } - console.warn("InterfaceTile, inlineButtonControl: Unhandled interface", model.name) + console.warn("InterfaceTile, inlineButtonControl 1: Unhandled interface", model.name) } font.pixelSize: app.smallFont elide: Text.ElideRight @@ -346,7 +348,7 @@ MainPageTile { var robotState = thing.stateByName("robotState") return robotState.value == "cleaning" ? "../images/media-playback-pause.svg" : "../images/media-playback-start.svg" default: - console.warn("InterfaceTile", "inlineButtonControl image: Unhandled interface", iface.name) + console.warn("InterfaceTile", "inlineButtonControl 1 image: Unhandled interface", iface.name) } return "" } @@ -394,7 +396,7 @@ MainPageTile { } break; default: - console.warn("InterfaceTile:", "inlineButtonControl clicked: Unhandled interface", iface.name) + console.warn("InterfaceTile:", "inlineButtonControl 1 clicked: Unhandled interface", iface.name) } } } @@ -434,7 +436,7 @@ MainPageTile { case "cleaningrobot": return "../images/media-playback-stop.svg" default: - console.warn("InterfaceTile, inlineButtonControl image: Unhandled interface", iface.name) + console.warn("InterfaceTile, inlineButtonControl 2 image: Unhandled interface", iface.name) } return ""; } @@ -445,6 +447,7 @@ MainPageTile { case "media": case "irrigation": case "ventilation": + case "evcharger": break; case "garagedoor": for (var i = 0; i < thingsProxy.count; i++) { @@ -477,7 +480,7 @@ MainPageTile { engine.thingManager.executeAction(thing.id, thing.thingClass.actionTypes.findByName("stopCleaning").id) break; default: - console.warn("InterfaceTile, inlineButtonControl clicked: Unhandled interface", iface.name) + console.warn("InterfaceTile, inlineButtonControl 2 clicked: Unhandled interface", iface.name) } } } @@ -504,6 +507,7 @@ MainPageTile { case "powersocket": case "irrigation": case "ventilation": + case "evcharger": return "../images/system-shutdown.svg" case "garagedoor": var dev = thingsProxy.get(0) @@ -525,7 +529,7 @@ MainPageTile { case "extendedshutter": return "../images/down.svg" default: - console.warn("InterfaceTile, inlineButtonControl image: Unhandled interface", iface.name) + console.warn("InterfaceTile, inlineButtonControl 3 image: Unhandled interface", iface.name) } } @@ -535,6 +539,7 @@ MainPageTile { case "powersocket": case "irrigation": case "ventilation": + case "evcharger": var allOff = true; for (var i = 0; i < thingsProxy.count; i++) { var thing = thingsProxy.get(i); @@ -607,7 +612,7 @@ MainPageTile { default: - console.warn("InterfaceTile, inlineButtonControl clicked: Unhandled interface", iface.name) + console.warn("InterfaceTile, inlineButtonControl 3 clicked: Unhandled interface", iface.name) } } } @@ -663,6 +668,9 @@ MainPageTile { ListElement { ifaceName: "thermostat"; stateName: "targetTemperature" } ListElement { ifaceName: "heating"; stateName: "power" } ListElement { ifaceName: "extendedHeating"; stateName: "percentage" } + ListElement { ifaceName: "o2sensor"; stateName: "o2saturation" } + ListElement { ifaceName: "orpsensor"; stateName: "orp" } + ListElement { ifaceName: "phsensor"; stateName: "ph" } } function findSensors(thingClass) { var ret = [] diff --git a/nymea-app/ui/delegates/ThingTile.qml b/nymea-app/ui/delegates/ThingTile.qml index 975c2fcd..a5581b8d 100644 --- a/nymea-app/ui/delegates/ThingTile.qml +++ b/nymea-app/ui/delegates/ThingTile.qml @@ -192,6 +192,15 @@ MainPageTile { if (thing.thingClass.interfaces.indexOf("presencesensor") >= 0) { tmp.push({iface: "presencesensor", state: "isPresent"}); } + if (thing.thingClass.interfaces.indexOf("phsensor") >= 0) { + tmp.push({iface: "phsensor", state: "ph"}) + } + if (thing.thingClass.interfaces.indexOf("orpsensor") >= 0) { + tmp.push({iface: "orpsensor", state: "orp"}) + } + if (thing.thingClass.interfaces.indexOf("o2sensor") >= 0) { + tmp.push({iface: "o2sensor", state: "o2saturation"}) + } if (thing.thingClass.interfaces.indexOf("weather") >= 0) { tmp.push({iface: "temperaturesensor", state: "temperature"}); @@ -235,6 +244,7 @@ MainPageTile { horizontalAlignment: Text.AlignRight text: Types.toUiUnit(sensorsRoot.currentStateType.unit) font.pixelSize: app.smallFont + visible: text !== "" } Label { Layout.fillWidth: true diff --git a/nymea-app/ui/images/sensors/orp.svg b/nymea-app/ui/images/sensors/orp.svg new file mode 100644 index 00000000..c2384718 --- /dev/null +++ b/nymea-app/ui/images/sensors/orp.svg @@ -0,0 +1,226 @@ + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + +