This repository has been archived on 2026-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
powersync-app/nymea-app/ui/devicepages/SensorDevicePagePost110.qml
2018-11-30 17:34:25 +01:00

39 lines
1.3 KiB
QML

import QtQuick 2.5
import QtQuick.Controls 2.1
import QtQuick.Layouts 1.1
import Nymea 1.0
import "../components"
import "../customviews"
ListView {
anchors { fill: parent }
model: ListModel {
Component.onCompleted: {
var supportedInterfaces = ["temperaturesensor", "humiditysensor", "pressuresensor", "moisturesensor", "lightsensor", "conductivitysensor", "noisesensor", "co2sensor"]
for (var i = 0; i < supportedInterfaces.length; i++) {
print("checking", root.deviceClass.name, root.deviceClass.interfaces)
if (root.deviceClass.interfaces.indexOf(supportedInterfaces[i]) >= 0) {
append({name: supportedInterfaces[i]});
}
}
}
}
delegate: GenericTypeGraph {
width: parent.width
device: root.device
stateType: root.deviceClass.stateTypes.findByName(stateTypeName)
color: app.interfaceToColor(modelData)
iconSource: app.interfaceToIcon(modelData)
implicitHeight: width * .6
property string stateTypeName: {
switch (modelData) {
case "lightsensor":
return "lightIntensity";
default:
return modelData.replace("sensor", "");
}
}
}
}