From f1ad5966afcb451ae56199c01ef744e2bf7f379f Mon Sep 17 00:00:00 2001 From: SpudGunMan Date: Fri, 17 Oct 2025 19:50:41 -0700 Subject: [PATCH] send_raw_bytes --- modules/system.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/modules/system.py b/modules/system.py index 654672e..a297621 100644 --- a/modules/system.py +++ b/modules/system.py @@ -809,6 +809,23 @@ def send_message(message, ch, nodeid=0, nodeInt=1, bypassChuncking=False): logger.error(f"System: Exception during send_message: {e} (message length: {len(message)})") return False +def send_raw_bytes(nodeid, raw_bytes, nodeInt=1, channel=0, portnum=256, want_ack=True): + # Send raw bytes to a node using the Meshtastic interface. + interface = globals()[f'interface{nodeInt}'] + try: + interface.sendData( + raw_bytes, + destinationId=nodeid, + portNum=portnum, + channelIndex=channel, + wantAck=want_ack + ) + logger.debug(f"Sent raw bytes to {nodeid} on portnum {portnum} via Device{nodeInt}") + return True + except Exception as e: + logger.error(f"System: Error sending raw bytes to {nodeid} via Device{nodeInt}: {e} bytes: {raw_bytes}") + return False + def messageTrap(msg): # Check if the message contains a trap word, this is the first filter for listning to messages # after this the message is passed to the command_handler in the bot.py which is switch case filter for applying word to function