Merge PR #366: Add support for the irrigation interface
This commit is contained in:
commit
c243e9a445
@ -171,6 +171,9 @@ QString DeviceClass::baseInterface() const
|
||||
if (interface == "evcharger") {
|
||||
return "evcharger";
|
||||
}
|
||||
if (interface == "irrigation") {
|
||||
return "irrigation";
|
||||
}
|
||||
}
|
||||
return "uncategorized";
|
||||
}
|
||||
|
||||
@ -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"));
|
||||
|
||||
|
||||
@ -167,6 +167,7 @@
|
||||
<file>ui/images/stock_video.svg</file>
|
||||
<file>ui/images/sensors/presence.svg</file>
|
||||
<file>ui/images/powersocket.svg</file>
|
||||
<file>ui/images/irrigation.svg</file>
|
||||
<file>ui/images/dial.svg</file>
|
||||
<file>ui/images/ventilation.svg</file>
|
||||
<file>ui/images/edit-copy.svg</file>
|
||||
|
||||
@ -144,6 +144,7 @@
|
||||
<file>ui/devicepages/BoolSensorDevicePage.qml</file>
|
||||
<file>ui/devicepages/HeatingDevicePage.qml</file>
|
||||
<file>ui/devicepages/PowersocketDevicePage.qml</file>
|
||||
<file>ui/devicepages/IrrigationDevicePage.qml</file>
|
||||
<file>ui/devicelistpages/PowerSocketsDeviceListPage.qml</file>
|
||||
<file>ui/components/GroupedListView.qml</file>
|
||||
<file>ui/delegates/statedelegates/LedDelegate.qml</file>
|
||||
|
||||
@ -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";
|
||||
}
|
||||
|
||||
92
nymea-app/ui/devicepages/IrrigationDevicePage.qml
Normal file
92
nymea-app/ui/devicepages/IrrigationDevicePage.qml
Normal file
@ -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 <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
194
nymea-app/ui/images/irrigation.svg
Normal file
194
nymea-app/ui/images/irrigation.svg
Normal file
@ -0,0 +1,194 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="96"
|
||||
height="96"
|
||||
id="svg4874"
|
||||
version="1.1"
|
||||
inkscape:version="0.92.4 (5da689c313, 2019-01-14)"
|
||||
viewBox="0 0 96 96.000001"
|
||||
sodipodi:docname="irrigation.svg">
|
||||
<defs
|
||||
id="defs4876" />
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="8.9919988"
|
||||
inkscape:cx="18.629722"
|
||||
inkscape:cy="38.242072"
|
||||
inkscape:document-units="px"
|
||||
inkscape:current-layer="g4780"
|
||||
showgrid="true"
|
||||
showborder="true"
|
||||
fit-margin-top="0"
|
||||
fit-margin-left="0"
|
||||
fit-margin-right="0"
|
||||
fit-margin-bottom="0"
|
||||
inkscape:snap-bbox="true"
|
||||
inkscape:bbox-paths="true"
|
||||
inkscape:bbox-nodes="true"
|
||||
inkscape:snap-bbox-edge-midpoints="true"
|
||||
inkscape:snap-bbox-midpoints="true"
|
||||
inkscape:object-paths="true"
|
||||
inkscape:snap-intersection-paths="true"
|
||||
inkscape:object-nodes="true"
|
||||
inkscape:snap-smooth-nodes="true"
|
||||
inkscape:snap-midpoints="true"
|
||||
inkscape:snap-object-midpoints="true"
|
||||
inkscape:snap-center="true"
|
||||
showguides="true"
|
||||
inkscape:guide-bbox="true"
|
||||
inkscape:snap-global="true"
|
||||
inkscape:window-width="2792"
|
||||
inkscape:window-height="1698"
|
||||
inkscape:window-x="88"
|
||||
inkscape:window-y="44"
|
||||
inkscape:window-maximized="1">
|
||||
<inkscape:grid
|
||||
type="xygrid"
|
||||
id="grid5451"
|
||||
empspacing="8" />
|
||||
<sodipodi:guide
|
||||
orientation="1,0"
|
||||
position="8,-8.0000001"
|
||||
id="guide4063"
|
||||
inkscape:locked="false" />
|
||||
<sodipodi:guide
|
||||
orientation="1,0"
|
||||
position="4,-8.0000001"
|
||||
id="guide4065"
|
||||
inkscape:locked="false" />
|
||||
<sodipodi:guide
|
||||
orientation="0,1"
|
||||
position="-8,88.000001"
|
||||
id="guide4067"
|
||||
inkscape:locked="false" />
|
||||
<sodipodi:guide
|
||||
orientation="0,1"
|
||||
position="-8,92.000001"
|
||||
id="guide4069"
|
||||
inkscape:locked="false" />
|
||||
<sodipodi:guide
|
||||
orientation="0,1"
|
||||
position="104,4"
|
||||
id="guide4071"
|
||||
inkscape:locked="false" />
|
||||
<sodipodi:guide
|
||||
orientation="0,1"
|
||||
position="-5,8.0000001"
|
||||
id="guide4073"
|
||||
inkscape:locked="false" />
|
||||
<sodipodi:guide
|
||||
orientation="1,0"
|
||||
position="88,-8.0000001"
|
||||
id="guide4077"
|
||||
inkscape:locked="false" />
|
||||
<sodipodi:guide
|
||||
orientation="0,1"
|
||||
position="-8,84.000001"
|
||||
id="guide4074"
|
||||
inkscape:locked="false" />
|
||||
<sodipodi:guide
|
||||
orientation="1,0"
|
||||
position="12,-8.0000001"
|
||||
id="guide4076"
|
||||
inkscape:locked="false" />
|
||||
<sodipodi:guide
|
||||
orientation="1,0"
|
||||
position="84,-8.0000001"
|
||||
id="guide4080"
|
||||
inkscape:locked="false" />
|
||||
<sodipodi:guide
|
||||
position="48,-8.0000001"
|
||||
orientation="1,0"
|
||||
id="guide4170"
|
||||
inkscape:locked="false" />
|
||||
<sodipodi:guide
|
||||
position="-8,48"
|
||||
orientation="0,1"
|
||||
id="guide4172"
|
||||
inkscape:locked="false" />
|
||||
<sodipodi:guide
|
||||
position="92,-8.0000001"
|
||||
orientation="1,0"
|
||||
id="guide4760"
|
||||
inkscape:locked="false" />
|
||||
</sodipodi:namedview>
|
||||
<metadata
|
||||
id="metadata4879">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1"
|
||||
transform="translate(67.857146,-78.50504)">
|
||||
<g
|
||||
transform="matrix(0,-1,-1,0,373.50506,516.50504)"
|
||||
id="g4845"
|
||||
style="display:inline">
|
||||
<g
|
||||
inkscape:export-ydpi="90"
|
||||
inkscape:export-xdpi="90"
|
||||
inkscape:export-filename="next01.png"
|
||||
transform="matrix(-0.9996045,0,0,1,575.94296,-611.00001)"
|
||||
id="g4778"
|
||||
inkscape:label="Layer 1">
|
||||
<g
|
||||
transform="matrix(-1,0,0,1,575.99999,611)"
|
||||
id="g4780"
|
||||
style="display:inline">
|
||||
<rect
|
||||
style="color:#000000;display:inline;overflow:visible;visibility:visible;fill:none;stroke:none;stroke-width:4;marker:none;enable-background:accumulate"
|
||||
id="rect4782"
|
||||
width="96.037987"
|
||||
height="96"
|
||||
x="-438.00244"
|
||||
y="345.36221"
|
||||
transform="scale(-1,1)" />
|
||||
<path
|
||||
style="color:#000000;display:inline;overflow:visible;visibility:visible;fill:#808080;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3;marker:none;enable-background:accumulate"
|
||||
d="m 363.73764,393.75985 c 0,6.20596 5.03079,11.23696 11.23678,11.23696 1.23225,0 2.4145,-0.2078 3.52391,-0.57429 0.11279,-0.0375 0.22912,-0.067 0.34033,-0.10764 0.94707,-0.28613 14.711,-4.48106 27.05409,-10.56657 0,0 -8.7e-4,0 -0.003,0 -8.7e-4,0 -0.003,0 -0.006,0 -0.002,0 -0.005,0 -0.006,0 -10e-4,0 -0.003,0 -0.003,0 -13.48078,-6.50207 -27.37612,-10.6352 -27.37612,-10.6352 v 0 c -1.10877,-0.36602 -2.29241,-0.56696 -3.52385,-0.56696 -6.20601,0 -11.23681,5.03084 -11.23681,11.2368 z"
|
||||
id="path4253"
|
||||
inkscape:connector-curvature="0"
|
||||
inkscape:transform-center-y="-74.885928"
|
||||
inkscape:transform-center-x="-8.5053576e-06" />
|
||||
<path
|
||||
inkscape:transform-center-x="-91.389306"
|
||||
inkscape:transform-center-y="-62.666565"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path4248-8"
|
||||
d="m 374.2764,366.74653 c 0,5.19327 4.20985,9.40332 9.4031,9.40332 1.03116,0 2.0205,-0.17395 2.94886,-0.48068 0.0944,-0.0312 0.19173,-0.0561 0.28477,-0.0905 0.79255,-0.23948 12.31041,-3.74997 22.63929,-8.84229 0,0 -8.9e-4,0 -0.002,0 -8.9e-4,0 -0.003,0 -0.006,0 -0.002,0 -0.003,0 -0.005,0 -0.001,0 -0.002,0 -0.002,0 -11.28092,-5.44086 -22.90874,-8.8997 -22.90874,-8.8997 v 0 c -0.92783,-0.30626 -1.91833,-0.47444 -2.94883,-0.47444 -5.19325,0 -9.40311,4.2099 -9.40311,9.40316 z"
|
||||
style="color:#000000;display:inline;overflow:visible;visibility:visible;fill:#808080;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3;marker:none;enable-background:accumulate" />
|
||||
<path
|
||||
inkscape:transform-center-x="81.943867"
|
||||
inkscape:transform-center-y="-56.189419"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path4250-0"
|
||||
d="m 376.03287,420.78051 c 0,4.65642 3.77476,8.43135 8.43131,8.43135 0.92458,0 1.81167,-0.15601 2.6441,-0.43091 0.0846,-0.0281 0.17191,-0.0499 0.25535,-0.0812 0.71063,-0.21468 11.03813,-3.36228 20.29954,-7.92835 0,0 -8.8e-4,0 -0.002,0 -8.8e-4,0 -0.003,0 -0.005,0 -10e-4,0 -0.003,0 -0.005,0 -8.9e-4,0 -0.002,0 -0.002,0 -10.11507,-4.87858 -20.54117,-7.97985 -20.54117,-7.97985 v 0 c -0.83195,-0.27474 -1.72006,-0.42545 -2.64408,-0.42545 -4.65654,0 -8.43132,3.77493 -8.43132,8.43151 z"
|
||||
style="color:#000000;display:inline;overflow:visible;visibility:visible;fill:#808080;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3;marker:none;enable-background:accumulate" />
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 7.5 KiB |
Reference in New Issue
Block a user