Add some more sensor support to inlinecontrols

This commit is contained in:
Michael Zanetti 2021-07-13 11:13:11 +02:00
parent 5da4fd1399
commit a7a7978821
6 changed files with 256 additions and 8 deletions

View File

@ -267,5 +267,6 @@
<file>ui/images/zigbee-router.svg</file>
<file>ui/images/sensors/o2.svg</file>
<file>ui/images/sensors/ph.svg</file>
<file>ui/images/sensors/orp.svg</file>
</qresource>
</RCC>

View File

@ -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":

View File

@ -89,7 +89,8 @@ Item {
"ventilation": "lightblue",
"watersensor": "aqua",
"phsensor": "green",
"o2sensor": "lightblue"
"o2sensor": "lightblue",
"orpsensor": "yellow"
}
property var stateColors: {

View File

@ -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 = []

View File

@ -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

View File

@ -0,0 +1,226 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<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="1.0.2 (e86c870879, 2021-01-15)"
viewBox="0 0 96 96.000001"
sodipodi:docname="orp.svg">
<defs
id="defs4876" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="3.6368565"
inkscape:cx="68.210966"
inkscape:cy="59.468617"
inkscape:document-units="px"
inkscape:current-layer="g4780"
showgrid="false"
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="1464"
inkscape:window-height="933"
inkscape:window-x="72"
inkscape:window-y="27"
inkscape:window-maximized="1"
inkscape:document-rotation="0">
<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 />
</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)" />
<g
transform="matrix(0,-0.75,-0.75029678,0,484.8993,358.46935)"
id="layer1-2"
inkscape:label="Layer 1">
<g
style="display:inline"
id="g4845-6"
transform="matrix(0,-1,-1,0,373.50506,516.50504)">
<g
inkscape:label="Layer 1"
id="g4778-1"
transform="matrix(-0.9996045,0,0,1,575.94296,-611.00001)"
inkscape:export-filename="next01.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90">
<g
style="display:inline"
id="g4780-8"
transform="matrix(-1,0,0,1,575.99999,611)">
<rect
transform="scale(-1,1)"
y="345.36221"
x="-438.00244"
height="96"
width="96.037987"
id="rect4782-7"
style="color:#000000;display:inline;overflow:visible;visibility:visible;fill:none;stroke:none;stroke-width:4;marker:none;enable-background:accumulate" />
<path
id="path4185"
transform="matrix(0,-1,-1.0003957,0,438.00245,441.36222)"
d="M 48.048828,3.9980469 C 35.339788,29.765082 26.577949,58.499495 25.980469,60.476562 c -0.0848,0.232149 -0.14708,0.473418 -0.22461,0.708985 -0.76552,2.315984 -1.199218,4.785 -1.199218,7.357422 C 24.556641,81.498363 35.065011,92 48.025391,92 60.963251,91.97331 71.443359,81.483872 71.443359,68.544922 c 0,-2.570723 -0.421276,-5.042778 -1.185547,-7.357422 0,0 -8.630054,-29.006362 -22.208984,-57.1484375 V 4.03125 4.0195312 4.0058594 Z m -0.03906,9.8417971 C 59.209548,38.806795 66.42383,62.328125 66.42383,62.328125 l 0.01563,0.05859 0.01953,0.05664 c 0.63557,1.924869 0.982422,3.964814 0.982422,6.09961 h 0.002 C 67.443359,79.320455 58.800601,87.97351 48.025391,88 h -0.0059 -0.0039 C 37.221101,87.9958 28.556607,79.332206 28.556607,68.541016 c 0,-2.12324 0.354983,-4.160037 0.996093,-6.09961 l 0.002,-0.002 v -0.002 c 0.131789,-0.400452 0.188593,-0.602839 0.183593,-0.589844 l 0.03906,-0.105468 0.0332,-0.109376 C 30.320007,59.947 37.570226,36.847661 48.009766,13.839844 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"
inkscape:connector-curvature="0" />
</g>
</g>
</g>
</g>
<g
id="g4780-5"
transform="matrix(0.68872117,0,0,0.68872427,121.31686,142.44563)"
style="stroke-width:1.45196">
<rect
id="rect4782-6"
transform="scale(-1,1)"
x="-438"
y="345.35999"
width="96.038002"
height="96"
style="color:#000000;fill:none;stroke-width:1.45196" />
<path
id="path4212"
d="m 341.96,389 56.75,24 v -15.273 h 39.288 l -56.75,-24 V 389 Z"
style="fill:#808080;stroke-width:1.45196" />
</g>
</g>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 8.1 KiB