Skip to content

Commit

Permalink
add info for user to troubleshoot MQTT
Browse files Browse the repository at this point in the history
This adds the MQTT connection errors to VRM online portal menu as well.
The MQTT connection errors are not shown if a bridge is disabled. If an
error is present all error status are shown unless explicitly reported
as disabled.
  • Loading branch information
jhofstee authored and blammit committed Oct 24, 2024
1 parent e836be6 commit 5a85cc6
Showing 1 changed file with 60 additions and 4 deletions.
64 changes: 60 additions & 4 deletions pages/settings/PageSettingsLogger.qml
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ Page {
}

ListSwitch {
id: useHttps

//% "Use secure connection (HTTPS)"
text: qsTrId("settings_https_enabled")
dataItem.uid: Global.systemSettings.serviceUid + "/Settings/Vrmlogger/HttpsEnabled"
Expand All @@ -142,6 +144,42 @@ Page {
}
}

ListTextItem {
id: connectionStatus

// Status of vrmlogger
property VeQuickItem httpsConnectionError: VeQuickItem {
uid: root.loggerServiceUid + "/Vrm/ConnectionError"
}

/*
* Status of the MQTT bridges, type bool, set to undefined when the bridge is not
* supposed to run. In other words: when it has a value and is false, then there is a problem.
*/
property VeQuickItem mqttRealtimeConnected: VeQuickItem {
uid: Global.venusPlatform.serviceUid + "/Mqtt/Bridges/GXdbus/Connected"
}
property VeQuickItem mqttRealtimeStatus: VeQuickItem {
uid: Global.venusPlatform.serviceUid + "/Mqtt/Bridges/GXdbus/ConnectionStatus"
}
property VeQuickItem mqttRpcConnected: VeQuickItem {
uid: Global.venusPlatform.serviceUid + "/Mqtt/Bridges/GXrpc/Connected"
}
property VeQuickItem mqttRpcStatus: VeQuickItem {
uid: Global.venusPlatform.serviceUid + "/Mqtt/Bridges/GXrpc/ConnectionStatus"
}

readonly property bool anyError:
httpsConnectionError.value ||
mqttRealtimeConnected.value === false ||
mqttRpcConnected.value === false

//% "Connection status"
text: qsTrId("settings_connection_status")
secondaryText: CommonWords.no_error
allowed: !anyError
}

ListTextItem {
function stringForErrorCode(errorCode) {
switch (errorCode) {
Expand Down Expand Up @@ -175,10 +213,14 @@ Page {
return ""
}
}
//% "Connection error"
text: qsTrId("settings_connection_error")
secondaryText: stringForErrorCode(dataItem.value)
dataItem.uid: root.loggerServiceUid + "/Vrm/ConnectionError"

text: useHttps.dataItem.value ?
//% "Connection status (HTTPS channel)"
qsTrId("settings_connection_error_https_channel") :
//% "Connection status (HTTP channel)"
qsTrId("settings_connection_error_http_channel")
secondaryText: stringForErrorCode(connectionStatus.httpsConnectionError.value)
allowed: !connectionStatus.allowed
}

ListItem {
Expand All @@ -192,6 +234,20 @@ Page {
}
}

ListTextItem {
//% "Connection status (MQTT Real-time channel)"
text: qsTrId("settings_connection_error_realtime_channel")
secondaryText: connectionStatus.mqttRealtimeStatus.value || ''
allowed: !connectionStatus.allowed && connectionStatus.mqttRealtimeConnected.isValid
}

ListTextItem {
//% "Connection status (MQTT RPC channel)"
text: qsTrId("settings_connection_error_rpc_channel")
secondaryText: connectionStatus.mqttRpcStatus.value || ''
allowed: !connectionStatus.allowed && connectionStatus.mqttRpcConnected.isValid
}

ListSwitch {
//% "Reboot device when no contact"
text: qsTrId("settings_no_contact_reboot")
Expand Down

0 comments on commit 5a85cc6

Please sign in to comment.