diff --git a/libnymea-app/types/deviceclass.cpp b/libnymea-app/types/deviceclass.cpp
index 8f9e116c..d23bf06a 100644
--- a/libnymea-app/types/deviceclass.cpp
+++ b/libnymea-app/types/deviceclass.cpp
@@ -171,6 +171,9 @@ QString DeviceClass::baseInterface() const
if (interface == "evcharger") {
return "evcharger";
}
+ if (interface == "irrigation") {
+ return "irrigation";
+ }
}
return "uncategorized";
}
diff --git a/libnymea-app/types/interfaces.cpp b/libnymea-app/types/interfaces.cpp
index 3e131ec7..3fdc93a7 100644
--- a/libnymea-app/types/interfaces.cpp
+++ b/libnymea-app/types/interfaces.cpp
@@ -209,6 +209,8 @@ Interfaces::Interfaces(QObject *parent) : QAbstractListModel(parent)
addInterface("inputtrigger", tr("Incoming events"));
addEventType("inputtrigger", "triggered", tr("Triggered"), new ParamTypes());
+ addInterface("irrigation", tr("Irrigation"), {"power"});
+
addInterface("lightsensor", tr("Light sensors"), {"sensor"});
addStateType("lightsensor", "lightIntensity", QVariant::Double, false, tr("Light intensity"), tr("Light intensity changed"));
diff --git a/nymea-app/images.qrc b/nymea-app/images.qrc
index 839cac42..054a7add 100644
--- a/nymea-app/images.qrc
+++ b/nymea-app/images.qrc
@@ -167,6 +167,7 @@
ui/images/stock_video.svg
ui/images/sensors/presence.svg
ui/images/powersocket.svg
+ ui/images/irrigation.svg
ui/images/dial.svg
ui/images/ventilation.svg
ui/images/edit-copy.svg
diff --git a/nymea-app/resources.qrc b/nymea-app/resources.qrc
index 4ec8b6e3..3a5d434d 100644
--- a/nymea-app/resources.qrc
+++ b/nymea-app/resources.qrc
@@ -144,6 +144,7 @@
ui/devicepages/BoolSensorDevicePage.qml
ui/devicepages/HeatingDevicePage.qml
ui/devicepages/PowersocketDevicePage.qml
+ ui/devicepages/IrrigationDevicePage.qml
ui/devicelistpages/PowerSocketsDeviceListPage.qml
ui/components/GroupedListView.qml
ui/delegates/statedelegates/LedDelegate.qml
diff --git a/nymea-app/ui/Nymea.qml b/nymea-app/ui/Nymea.qml
index 3c44f655..98d5ac1c 100644
--- a/nymea-app/ui/Nymea.qml
+++ b/nymea-app/ui/Nymea.qml
@@ -106,7 +106,7 @@ ApplicationWindow {
}
property alias _discovery: discovery
- property var supportedInterfaces: ["light", "weather", "media", "garagegate", "awning", "shutter", "blind", "powersocket", "heating", "doorbell", "sensor", "smartmeter", "evcharger", "fingerprintreader", "smartlock", "button", "notifications", "inputtrigger", "outputtrigger", "gateway", "account"]
+ property var supportedInterfaces: ["light", "weather", "media", "garagegate", "awning", "shutter", "blind", "powersocket", "heating", "doorbell", "sensor", "irrigation", "smartmeter", "evcharger", "fingerprintreader", "smartlock", "button", "notifications", "inputtrigger", "outputtrigger", "gateway", "account"]
function interfaceToString(name) {
switch(name) {
case "light":
@@ -171,6 +171,8 @@ ApplicationWindow {
return qsTr("Accounts");
case "smartlock":
return qsTr("Smartlocks")
+ case "irrigation":
+ return qsTr("Irrigation");
case "uncategorized":
return qsTr("Uncategorized")
default:
@@ -281,6 +283,8 @@ ApplicationWindow {
return Qt.resolvedUrl("images/notification.svg")
case "connectable":
return Qt.resolvedUrl("images/stock_link.svg")
+ case "irrigation":
+ return Qt.resolvedUrl("images/irrigation.svg")
case "power":
return Qt.resolvedUrl("images/system-shutdown.svg")
case "account":
@@ -310,7 +314,8 @@ ApplicationWindow {
"extendedsmartmeterproducer": "blue",
"extendedsmartmeterconsumer": "blue",
"heating" : "gainsboro",
- "thermostat": "dodgerblue"
+ "thermostat": "dodgerblue",
+ "irrigation": "lightblue"
}
function interfaceToColor(name) {
@@ -343,6 +348,9 @@ ApplicationWindow {
case "connectable":
//: Select ...
return qsTr("connectable thing")
+ case "irrigation":
+ //: Select ...
+ return qsTr("irrigation");
case "power":
//: Select ...
return qsTr("switchable thing")
@@ -425,6 +433,8 @@ ApplicationWindow {
page = "PowersocketDevicePage.qml";
} else if (interfaceList.indexOf("doorbell") >= 0) {
page = "DoorbellDevicePage.qml";
+ } else if (interfaceList.indexOf("irrigation") >= 0) {
+ page = "IrrigationDevicePage.qml";
} else {
page = "GenericDevicePage.qml";
}
diff --git a/nymea-app/ui/devicepages/IrrigationDevicePage.qml b/nymea-app/ui/devicepages/IrrigationDevicePage.qml
new file mode 100644
index 00000000..31ea182f
--- /dev/null
+++ b/nymea-app/ui/devicepages/IrrigationDevicePage.qml
@@ -0,0 +1,92 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+*
+* Copyright 2013 - 2020, nymea GmbH
+* Contact: contact@nymea.io
+*
+* This file is part of nymea.
+* This project including source code and documentation is protected by
+* copyright law, and remains the property of nymea GmbH. All rights, including
+* reproduction, publication, editing and translation, are reserved. The use of
+* this project is subject to the terms of a license agreement to be concluded
+* with nymea GmbH in accordance with the terms of use of nymea GmbH, available
+* under https://nymea.io/license
+*
+* GNU General Public License Usage
+* Alternatively, this project may be redistributed and/or modified under the
+* terms of the GNU General Public License as published by the Free Software
+* Foundation, GNU version 3. This project is distributed in the hope that it
+* will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+* Public License for more details.
+*
+* You should have received a copy of the GNU General Public License along with
+* this project. If not, see .
+*
+* For any further details and any questions please contact us under
+* contact@nymea.io or see our FAQ/Licensing Information on
+* https://nymea.io/license/faq
+*
+* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+import QtQuick 2.5
+import QtQuick.Controls 2.1
+import QtQuick.Layouts 1.1
+import QtQuick.Controls.Material 2.1
+import Nymea 1.0
+import "../components"
+
+DevicePageBase {
+ id: root
+
+ readonly property var powerStateType: deviceClass.stateTypes.findByName("power")
+ readonly property var powerState: device.states.getState(powerStateType.id)
+ readonly property var powerActionType: deviceClass.actionTypes.findByName("power");
+
+ GridLayout {
+ anchors.fill: parent
+ anchors.margins: app.margins
+ columns: app.landscape ? 2 : 1
+ rowSpacing: app.margins
+ columnSpacing: app.margins
+ Layout.alignment: Qt.AlignCenter
+
+ Item {
+ Layout.preferredWidth: Math.max(app.iconSize * 6, parent.width / 5)
+ Layout.preferredHeight: width
+ Layout.topMargin: app.margins
+ Layout.bottomMargin: app.landscape ? app.margins : 0
+ Layout.alignment: Qt.AlignCenter
+ Layout.rowSpan: app.landscape ? 4 : 1
+ Layout.fillHeight: true
+
+ AbstractButton {
+ height: Math.min(parent.height, parent.width)
+ width: height
+ anchors.centerIn: parent
+ Rectangle {
+ anchors.fill: parent
+ color: "transparent"
+ border.color: root.powerState.value === true ? app.accentColor : bulbIcon.keyColor
+ border.width: 4
+ radius: width / 2
+ }
+
+ ColorIcon {
+ id: bulbIcon
+ anchors.fill: parent
+ anchors.margins: app.margins * 1.5
+ name: "../images/irrigation.svg"
+ color: root.powerState.value === true ? app.accentColor : keyColor
+ }
+ onClicked: {
+ var params = []
+ var param = {}
+ param["paramTypeId"] = root.powerActionType.paramTypes.get(0).id;
+ param["value"] = !root.powerState.value;
+ params.push(param)
+ engine.deviceManager.executeAction(root.device.id, root.powerStateType.id, params);
+ }
+ }
+ }
+ }
+}
diff --git a/nymea-app/ui/images/irrigation.svg b/nymea-app/ui/images/irrigation.svg
new file mode 100644
index 00000000..e50ccdf0
--- /dev/null
+++ b/nymea-app/ui/images/irrigation.svg
@@ -0,0 +1,194 @@
+
+
+
+