Add MQTT page to show mqtt errors

This commit is contained in:
2024-07-09 21:47:02 +02:00
parent d4b15e0fa6
commit 0be0198302
8 changed files with 116 additions and 10 deletions

View File

@@ -93,6 +93,7 @@ qt_add_qml_module(evcharger-app
LoadBalancingPage.qml LoadBalancingPage.qml
LogicModeButton.qml LogicModeButton.qml
MainScreen.qml MainScreen.qml
MqttPage.qml
NamePage.qml NamePage.qml
NavigationItem.qml NavigationItem.qml
NavigationPage.qml NavigationPage.qml

View File

@@ -1,6 +1,7 @@
import QtQuick import QtQuick
import QtQuick.Controls import QtQuick.Controls
import QtQuick.Layouts import QtQuick.Layouts
import EVChargerApp
ColumnLayout { ColumnLayout {
signal connected signal connected

View File

@@ -27,6 +27,13 @@ NavigationPage {
visible: ethernetApiKeyValueHelper.exists visible: ethernetApiKeyValueHelper.exists
} }
NavigationItem {
iconSource: "material-icons/grid_guides.svg"
title: qsTr("Cloud")
component: "CloudPage.qml"
visible: cloudApiKeyValueHelper.exists
}
NavigationItem { NavigationItem {
iconSource: "material-icons/grid_guides.svg" iconSource: "material-icons/grid_guides.svg"
title: qsTr("OCPP") title: qsTr("OCPP")
@@ -36,9 +43,9 @@ NavigationPage {
NavigationItem { NavigationItem {
iconSource: "material-icons/grid_guides.svg" iconSource: "material-icons/grid_guides.svg"
title: qsTr("Cloud") title: qsTr("MQTT")
component: "CloudPage.qml" component: "MqttPage.qml"
visible: cloudApiKeyValueHelper.exists visible: mqttApiKeyValueHelper.exists
} }
NavigationItem { NavigationItem {

View File

@@ -40,6 +40,8 @@ ApplicationWindow {
PageIndicator { PageIndicator {
id: indicator id: indicator
visible: view.count > 1
count: view.count count: view.count
currentIndex: view.currentIndex currentIndex: view.currentIndex

88
MqttPage.qml Normal file
View File

@@ -0,0 +1,88 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import EVChargerApp
NavigationPage {
title: qsTr("MQTT")
GeneralOnOffSwitch {
apiKey: "mce"
}
WhiteBox {
Layout.fillWidth: true
GridLayout {
anchors.fill: parent
columns: 2
Label {
text: qsTr("Trying to connect:")
font.bold: true
}
ApiKeyValueItem {
apiKey: "mcs"
}
Label {
text: qsTr("Is connected:")
font.bold: true
}
ApiKeyValueItem {
apiKey: "mcc"
}
Label {
text: qsTr("Connected since:")
font.bold: true
}
ApiKeyValueHelper {
id: connectedSince
deviceConnection: mainScreen.deviceConnection
apiKey: "mcca"
}
Text {
text: connectedSince.value ? formatDuration(connectedSince.value - rebootTime.value) : ""
}
Label {
text: qsTr("Command Counter:")
font.bold: true
}
ApiKeyValueItem {
apiKey: "mcsl"
}
Label {
text: qsTr("Last error:")
font.bold: true
}
ApiKeyValueItem {
apiKey: "mlr"
wrapMode: Text.Wrap
}
Label {
text: qsTr("Last error age:")
font.bold: true
}
ApiKeyValueHelper {
id: lastErrorAge
deviceConnection: mainScreen.deviceConnection
apiKey: "mlra"
}
Text {
text: lastErrorAge.value ? formatDuration(lastErrorAge.value - rebootTime.value) : ""
}
}
}
}

View File

@@ -70,15 +70,20 @@ StackView {
deviceConnection: mainScreen.deviceConnection deviceConnection: mainScreen.deviceConnection
apiKey: "ee" apiKey: "ee"
} }
ApiKeyValueHelper {
id: cloudApiKeyValueHelper
deviceConnection: mainScreen.deviceConnection
apiKey: "cwe"
}
ApiKeyValueHelper { ApiKeyValueHelper {
id: ocppApiKeyValueHelper id: ocppApiKeyValueHelper
deviceConnection: mainScreen.deviceConnection deviceConnection: mainScreen.deviceConnection
apiKey: "ocppe" apiKey: "ocppe"
} }
ApiKeyValueHelper { ApiKeyValueHelper {
id: cloudApiKeyValueHelper id: mqttApiKeyValueHelper
deviceConnection: mainScreen.deviceConnection deviceConnection: mainScreen.deviceConnection
apiKey: "cwe" apiKey: "mce"
} }
iconSource: "material-icons/grid_guides.svg" iconSource: "material-icons/grid_guides.svg"
@@ -87,8 +92,9 @@ StackView {
wifiStaApiKeyValueHelper.exists ? qsTr("Wi-Fi") : null, wifiStaApiKeyValueHelper.exists ? qsTr("Wi-Fi") : null,
wifiApApiKeyValueHelper.exists ? qsTr("Hotspot") : null, wifiApApiKeyValueHelper.exists ? qsTr("Hotspot") : null,
ethernetApiKeyValueHelper.exists ? qsTr("Ethernet") : null, ethernetApiKeyValueHelper.exists ? qsTr("Ethernet") : null,
ocppApiKeyValueHelper.exists ? qsTr("OCPP") : null,
cloudApiKeyValueHelper.exists ? qsTr("Cloud") : null, cloudApiKeyValueHelper.exists ? qsTr("Cloud") : null,
ocppApiKeyValueHelper.exists ? qsTr("OCPP") : null,
mqttApiKeyValueHelper.exists ? qsTr("MQTT") : null,
qsTr("API Settings") qsTr("API Settings")
].filter(Boolean).join(" • ") ].filter(Boolean).join(" • ")
component: "ConnectionPage.qml" component: "ConnectionPage.qml"

View File

@@ -505,14 +505,14 @@
<context> <context>
<name>ConnectingScreen</name> <name>ConnectingScreen</name>
<message> <message>
<location filename="../ConnectingScreen.qml" line="23"/> <location filename="../ConnectingScreen.qml" line="24"/>
<location filename="../build/Desktop-Debug/EVChargerApp/ConnectingScreen.qml" line="23"/> <location filename="../build/Desktop-Debug/EVChargerApp/ConnectingScreen.qml" line="24"/>
<source>Trying to reach device...</source> <source>Trying to reach device...</source>
<translation>Versuche Gerät zu erreichen...</translation> <translation>Versuche Gerät zu erreichen...</translation>
</message> </message>
<message> <message>
<location filename="../ConnectingScreen.qml" line="47"/> <location filename="../ConnectingScreen.qml" line="48"/>
<location filename="../build/Desktop-Debug/EVChargerApp/ConnectingScreen.qml" line="47"/> <location filename="../build/Desktop-Debug/EVChargerApp/ConnectingScreen.qml" line="48"/>
<source>Cancel</source> <source>Cancel</source>
<translation>Abbrechen</translation> <translation>Abbrechen</translation>
</message> </message>

1
qmldir
View File

@@ -43,6 +43,7 @@ EVChargerApp 1.0 LicensesPage.qml
EVChargerApp 1.0 LoadBalancingPage.qml EVChargerApp 1.0 LoadBalancingPage.qml
EVChargerApp 1.0 LogicModeButton.qml EVChargerApp 1.0 LogicModeButton.qml
EVChargerApp 1.0 MainScreen.qml EVChargerApp 1.0 MainScreen.qml
EVChargerApp 1.0 MqttPage.qml
EVChargerApp 1.0 NamePage.qml EVChargerApp 1.0 NamePage.qml
EVChargerApp 1.0 NavigationItem.qml EVChargerApp 1.0 NavigationItem.qml
EVChargerApp 1.0 NavigationPage.qml EVChargerApp 1.0 NavigationPage.qml