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/SmartMeterDevicePage.qml
2018-10-31 16:31:23 +01:00

46 lines
1.8 KiB
QML

import QtQuick 2.5
import QtQuick.Controls 2.1
import QtQuick.Layouts 1.1
import Nymea 1.0
import "../components"
import "../customviews"
DevicePageBase {
id: root
ListView {
anchors { fill: parent }
model: ListModel {
Component.onCompleted: {
if (root.deviceClass.interfaces.indexOf("extendedsmartmeterproducer") >= 0
|| root.deviceClass.interfaces.indexOf("extendedsmartmeterconsumer") >= 0) {
append( {interface: "extendedsmartmeterproducer", stateTypeName: "currentPower" })
}
if (root.deviceClass.interfaces.indexOf("smartmeterproducer") >= 0) {
append( {interface: "smartmeterproducer", stateTypeName: "totalEnergyProduced" })
}
if (root.deviceClass.interfaces.indexOf("smartmeterconsumer") >= 0) {
append( {interface: "smartmeterconsumer", stateTypeName: "totalEnergyConsumed" })
}
print("shown graphs are", count)
}
}
delegate: ColumnLayout {
width: parent.width
Label {
Layout.fillWidth: true
Layout.leftMargin: app.margins; Layout.topMargin: app.margins; Layout.rightMargin: app.rightMargins;
text: root.deviceClass.stateTypes.findByName(model.stateTypeName).displayName
}
GenericTypeGraph {
Layout.fillWidth: true
device: root.device
stateType: root.deviceClass.stateTypes.findByName(model.stateTypeName)
color: app.interfaceToColor(model.interface)
iconSource: app.interfaceToIcon(model.interface)
roundTo: 5
}
}
}
}