From da3efd05e833efda0618e144b9474fed355e342d Mon Sep 17 00:00:00 2001 From: Aido Date: Fri, 15 May 2026 20:50:31 +0100 Subject: [PATCH] Added Meshtastic ID to messages bridged to MeshCore MeshCore messages already prepend the MeshCore ID to messages bridged to Meshtastic, so now conversely, Meshtastic IDs are prepended to messages bridged to MeshCore. --- CHANGELOG.md | 1 + ammb/meshcore_handler.py | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e872a1b..b403234 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ - **Added** configuration settings for bridging specific channels - **Fixed** companion radio decoding to be more robust - **Added** `channel_index` key to `external_message` dict +- **Added** Meshtastic ID to messages bridged to MeshCore --- ## Version 2.0.0 - Comprehensive Code Review and Enhancements (December 31, 2025) diff --git a/ammb/meshcore_handler.py b/ammb/meshcore_handler.py index 0fe7675..f0fa394 100644 --- a/ammb/meshcore_handler.py +++ b/ammb/meshcore_handler.py @@ -627,6 +627,10 @@ class MeshcoreHandler: # CMD_SEND_CHANNEL_TXT_MSG (3) txt_type = 0 channel_idx = int(item.get("channel_index", 0)) + sender_meshtastic_id = item.get("sender_meshtastic_id", "Unknown") + + # Prepend Meshtastic ID to outgoing MeshCore message + payload = f"{sender_meshtastic_id}: {payload}" if self.config.meshtastic_channel_index is not None and self.config.meshcore_channel_index is not None: if channel_idx == self.config.meshtastic_channel_index: @@ -642,4 +646,4 @@ class MeshcoreHandler: encoded = self.protocol_handler.encode({"payload": cmd_payload}) if not encoded: self.logger.warning("Failed to encode companion text message.") - return encoded \ No newline at end of file + return encoded