+import QtQuick
+import QtQuick.Controls 6.3
+import QtQuick.Layouts 6.3
+import qthomecontrol
+
+Window {
+ width: 720
+ height: 720
+ visible: true
+ title: qsTr("Home Control")
+ visibility: "FullScreen"
+ color: Material.backgroundColor
+
+ OpenHABInterface {
+ id: openHABInterface
+ }
+
+ BackLightController {
+ id: backlightController
+ }
+
+ FontLoader { id: digital; source: "qrc:/fonts/digital-7.ttf" }
+
+ Label {
+ id: textTime
+ x: 620
+ y: 10
+ width: 90
+ height: 50
+ font.pixelSize: 36
+ horizontalAlignment: Text.AlignRight
+ verticalAlignment: Text.AlignTop
+ }
+
+
+ Timer {
+ id: timer
+ interval: 1000
+ repeat: true
+ running: true
+
+ onTriggered:
+ {
+ textTime.text = Qt.formatTime(new Date(),"hh:mm")
+ }
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ hoverEnabled: true
+ propagateComposedEvents: true
+ onPositionChanged: {
+ backlightController.hadInteraction();
+ mouse.accepted = false;
+ }
+ onClicked: {
+ backlightController.hadInteraction();
+ mouse.accepted = false;
+ }
+ onPressed: {
+ backlightController.hadInteraction();
+ mouse.accepted = false;
+ }
+ onReleased: mouse.accepted = false;
+ onDoubleClicked: mouse.accepted = false;
+ onPressAndHold: mouse.accepted = false;
+ z: 100
+ }
+
+ GroupBox {
+ id: groupBox
+ x: 15
+ y: 10
+ width: 483
+ height: 490
+ label: Label {
+ id: officeLabel
+ text: "Office"
+ font.pixelSize: 32
+ }
+ Slider {
+ id: slider
+ x: 245
+ y: 83
+ width: 190
+ height: 25
+ live: true
+ antialiasing: true
+ topPadding: 0
+ bottomPadding: 0
+ orientation: Qt.Horizontal
+ snapMode: RangeSlider.SnapOnRelease
+ stepSize: 1
+ to: 100
+ value: openHABInterface.officeDimmer
+ scale: 1.5
+ onMoved:
+ {
+ openHABInterface.officeDimmer = slider.value
+ }
+ }
+
+ Label {
+ id: textTemp
+ x: 50
+ y: 0
+ width: 100
+ height: 60
+ text: openHABInterface.officeTemperature.toFixed(1)
+ font.pixelSize: 52
+ font.family: digital.font.family
+ horizontalAlignment: Text.AlignRight
+ verticalAlignment: Text.AlignBottom
+ }
+ Label {
+ id: unitTemp
+ x: 155
+ y: 0
+ width: 30
+ height: 60
+ text: "°C"
+ font.pixelSize: 32
+ horizontalAlignment: Text.AlignLeft
+ verticalAlignment: Text.AlignBottom
+ }
+
+ Label {
+ id: textHumid
+ x: 50
+ y: 60
+ width: 100
+ height: 60
+ text: openHABInterface.officeHumidity.toFixed(0)
+ font.pixelSize: 52
+ font.family: digital.font.family
+ horizontalAlignment: Text.AlignRight
+ verticalAlignment: Text.AlignBottom
+ }
+ Label {
+ id: unitHumid
+ x: 155
+ y: 60
+ width: 30
+ height: 60
+ text: "%"
+ font.pixelSize: 32
+ horizontalAlignment: Text.AlignLeft
+ verticalAlignment: Text.AlignBottom
+ }
+
+ Label {
+ id: textPressure
+ x: 50
+ y: 120
+ width: 150
+ height: 60
+ text: openHABInterface.officePressure.toFixed(1)
+ font.pixelSize: 52
+ font.family: digital.font.family
+ horizontalAlignment: Text.AlignRight
+ verticalAlignment: Text.AlignBottom
+ }
+ Label {
+ id: unitPressure
+ x: 205
+ y: 120
+ width: 30
+ height: 60
+ text: "hPa"
+ font.pixelSize: 32
+ horizontalAlignment: Text.AlignLeft
+ verticalAlignment: Text.AlignBottom
+ }
+
+ Label {
+ id: textLight
+ x: 250
+ y: 0
+ width: 100
+ height: 60
+ text: openHABInterface.officeDimmer.toFixed(0)
+ font.pixelSize: 52
+ font.family: digital.font.family
+ horizontalAlignment: Text.AlignRight
+ verticalAlignment: Text.AlignBottom
+ }
+ Label {
+ id: unitDimmer
+ x: 357
+ y: 0
+ width: 30
+ height: 60
+ text: "%"
+ font.pixelSize: 32
+ horizontalAlignment: Text.AlignLeft
+ verticalAlignment: Text.AlignBottom
+ }
+
+ Image {
+ id: tempImage
+ x: 10
+ y: 0
+ width: 54
+ height: 60
+ source: "qrc:/images/temperature.png"
+ fillMode: Image.PreserveAspectFit
+ }
+ Image {
+ id: humidImage
+ x: 10
+ y: 60
+ width: 54
+ height: 60
+ source: "qrc:/images/humidity.png"
+ fillMode: Image.PreserveAspectFit
+ }
+ Image {
+ id: pressureImage
+ x: 10
+ y: 120
+ width: 54
+ height: 60
+ source: "qrc:/images/pressure.png"
+ fillMode: Image.PreserveAspectFit
+ }
+ Image {
+ id: lightImage
+ x: 235
+ y: 0
+ width: 54
+ height: 60
+ source: "qrc:/images/light.png"
+ fillMode: Image.PreserveAspectFit
+ }
+ Dial {
+ id: dialAC
+ x: 35
+ y: 290
+ inputMode: Dial.Vertical
+ scale: 1.5
+
+ from: 16
+ value: openHABInterface.officeACSetPoint
+ to: 26
+ stepSize: 0.5
+ snapMode: Dial.SnapAlways
+
+ onMoved: {
+ openHABInterface.officeACSetPoint = dialAC.value
+ }
+
+ Label {
+ x: 0
+ width: dialAC.width
+ y: 0
+ height: dialAC.height
+ id: thermoSetLabel
+ text: dialAC.value.toFixed(1)
+ font.pixelSize: 32
+ font.family: digital.font.family
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ }
+ }
+ Dial {
+ id: dialFloor
+ x: 50 + dialFloor.width * 1.5
+ y: 290
+ inputMode: Dial.Vertical
+ scale: 1.5
+
+ from: 16
+ value: openHABInterface.officeFloorSetPoint
+ to: 24
+ stepSize: 0.5
+ snapMode: Dial.SnapAlways
+
+ onMoved: {
+ openHABInterface.officeFloorSetPoint = dialFloor.value
+ }
+
+ Label {
+ x: 0
+ width: dialFloor.width
+ y: 0
+ height: dialFloor.height
+ id: thermoFloorSetLabel
+ text: dialFloor.value.toFixed(1)
+ font.pixelSize: 32
+ font.family: digital.font.family
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ }
+ }
+
+
+ Switch {
+ id: switchAC
+ x: 35
+ width: dialAC.width
+ y: 203
+ checked: openHABInterface.officeACToggle
+ scale: 1.5
+ onToggled:
+ {
+ openHABInterface.officeACToggle = switchAC.checked
+ }
+ }
+
+ }
+
+ Image {
+ id: outdoorTempImage
+ x: 10
+ y: 590
+ width: 54
+ height: 60
+ source: "qrc:/images/frontdoor.png"
+ fillMode: Image.PreserveAspectFit
+ }
+ Label {
+ id: outdoorTemp
+ x: 70
+ y: 590
+ width: 100
+ height: 60
+ text: openHABInterface.outdoorTemperature.toFixed(1)
+ font.pixelSize: 52
+ font.family: digital.font.family
+ horizontalAlignment: Text.AlignRight
+ verticalAlignment: Text.AlignBottom
+ }
+ Label {
+ id: unitOutdoorTemp
+ x: 175
+ y: 590
+ width: 30
+ height: 60
+ text: "°C"
+ font.pixelSize: 32
+ horizontalAlignment: Text.AlignLeft
+ verticalAlignment: Text.AlignBottom
+ }
+ Image {
+ id: powerImage
+ x: 10
+ y: 650
+ width: 54
+ height: 60
+ source: "qrc:/images/energy.png"
+ fillMode: Image.PreserveAspectFit
+ }
+ Label {
+ id: textPower
+ x: 70
+ y: 650
+ width: 100
+ height: 60
+ text: openHABInterface.mainPowerUsage < 1000 ? openHABInterface.mainPowerUsage.toFixed(0) : (openHABInterface.mainPowerUsage / 1000).toFixed(2)
+ font.pixelSize: 52
+ font.family: digital.font.family
+ horizontalAlignment: Text.AlignRight
+ verticalAlignment: Text.AlignBottom
+ }
+ Label {
+ id: unitPower
+ x: 175
+ y: 650
+ width: 30
+ height: 60
+ text: openHABInterface.mainPowerUsage < 1000 ? "W" : "kW"
+ font.pixelSize: 32
+ horizontalAlignment: Text.AlignLeft
+ verticalAlignment: Text.AlignBottom
+ }
+}