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
LogicModeButton.qml
MainScreen.qml
MqttPage.qml
NamePage.qml
NavigationItem.qml
NavigationPage.qml

View File

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

View File

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

View File

@@ -40,6 +40,8 @@ ApplicationWindow {
PageIndicator {
id: indicator
visible: view.count > 1
count: view.count
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
apiKey: "ee"
}
ApiKeyValueHelper {
id: cloudApiKeyValueHelper
deviceConnection: mainScreen.deviceConnection
apiKey: "cwe"
}
ApiKeyValueHelper {
id: ocppApiKeyValueHelper
deviceConnection: mainScreen.deviceConnection
apiKey: "ocppe"
}
ApiKeyValueHelper {
id: cloudApiKeyValueHelper
id: mqttApiKeyValueHelper
deviceConnection: mainScreen.deviceConnection
apiKey: "cwe"
apiKey: "mce"
}
iconSource: "material-icons/grid_guides.svg"
@@ -87,8 +92,9 @@ StackView {
wifiStaApiKeyValueHelper.exists ? qsTr("Wi-Fi") : null,
wifiApApiKeyValueHelper.exists ? qsTr("Hotspot") : null,
ethernetApiKeyValueHelper.exists ? qsTr("Ethernet") : null,
ocppApiKeyValueHelper.exists ? qsTr("OCPP") : null,
cloudApiKeyValueHelper.exists ? qsTr("Cloud") : null,
ocppApiKeyValueHelper.exists ? qsTr("OCPP") : null,
mqttApiKeyValueHelper.exists ? qsTr("MQTT") : null,
qsTr("API Settings")
].filter(Boolean).join(" • ")
component: "ConnectionPage.qml"

View File

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

1
qmldir
View File

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