Enhance MQTT status message to include repeat status

Updated the MQTT message structure to add a new field for repeat status, allowing the indication of forwarding status as "on" or "off". This change includes modifications to the MQTTMessageBuilder and related documentation to reflect the new parameter. Additionally, updated CLI command documentation to clarify flooding behavior in different firmware versions.
This commit is contained in:
agessaman committed 2026-05-09 17:40:00 -07:00
1 parent ff031f48bb
commit 303cf8c2bd
5 files changed
+17 -6

No files matched your search

+2 -1
View File
@@ -478,7 +478,8 @@ Minimal raw packet data for map integration.
"model": "device_model",
"firmware_version": "firmware_version",
"radio": "radio_info",
"client_version": "meshcore-custom-repeater/{build_date}"
"client_version": "meshcore-custom-repeater/{build_date}",
"repeat": "on|off"
}
```
+2
View File
@@ -766,6 +766,8 @@ This document provides an overview of CLI commands that can be sent to MeshCore
- `name`: Region name
- `parent_name`: Parent region name (optional, defaults to wildcard)
**Note:** In firmware **v1.15.0** and later, `region put` enables flooding for that region by default (you do not need a separate `region allowf <name>` after each `put`). On **v1.14.0** and earlier, new regions may still require `region allowf` for flooding—see [`region allowf`](#allow-a-region).
---
#### Remove a region
+6 -2
View File
@@ -24,7 +24,8 @@ int MQTTMessageBuilder::buildStatusMessage(
int tx_air_secs,
int rx_air_secs,
int recv_errors,
int internal_heap
int internal_heap,
const char* repeat
) {
// doc is provided by the caller (heap-allocated DynamicJsonDocument in MQTTBridge),
// keeping this 768-byte scratch space off the MQTT task stack.
@@ -39,7 +40,10 @@ int MQTTMessageBuilder::buildStatusMessage(
root["firmware_version"] = firmware_version;
root["radio"] = radio;
root["client_version"] = client_version;
if (repeat != nullptr) {
root["repeat"] = repeat;
}
// Add stats object if any stats are provided
if (battery_mv >= 0 || uptime_secs >= 0 || errors >= 0 || queue_len >= 0 ||
noise_floor > -999 || tx_air_secs >= 0 || rx_air_secs >= 0 || recv_errors >= 0 ||
+3 -1
View File
@@ -39,6 +39,7 @@ public:
* @param rx_air_secs RX air time in seconds (optional, -1 to omit)
* @param recv_errors Radio receive/CRC errors (optional, -1 to omit)
* @param internal_heap Internal heap free bytes (optional, -1 to omit)
* @param repeat Repeat/forwarding status ("on" or "off"); nullptr omits the field
* @return Length of JSON string, or 0 on error
*/
static int buildStatusMessage(
@@ -61,7 +62,8 @@ public:
int tx_air_secs = -1,
int rx_air_secs = -1,
int recv_errors = -1,
int internal_heap = -1
int internal_heap = -1,
const char* repeat = nullptr
);
/**
+4 -2
View File
@@ -1736,7 +1736,8 @@ void MQTTBridge::publishStatusToSlot(int index) {
_origin, origin_id, _board_model, _firmware_version, radio_info,
client_version, "online", timestamp, json_buffer, STATUS_JSON_BUFFER_SIZE,
battery_mv, uptime_secs, errors, _queue_count, noise_floor,
tx_air_secs, rx_air_secs, recv_errors, internal_heap_free
tx_air_secs, rx_air_secs, recv_errors, internal_heap_free,
_prefs->disable_fwd ? "off" : "on"
);
if (len > 0) {
@@ -2425,7 +2426,8 @@ bool MQTTBridge::publishStatus() {
_origin, origin_id, _board_model, _firmware_version, radio_info,
client_version, "online", timestamp, json_buffer, STATUS_JSON_BUFFER_SIZE,
battery_mv, uptime_secs, errors, _queue_count, noise_floor,
tx_air_secs, rx_air_secs, recv_errors, internal_heap_free
tx_air_secs, rx_air_secs, recv_errors, internal_heap_free,
_prefs->disable_fwd ? "off" : "on"
);
if (len > 0) {