From d48b941d5640c81aa3c17a8141e4095589e9a4d6 Mon Sep 17 00:00:00 2001 From: Kyle Manna Date: Sat, 19 Sep 2026 12:16:39 -0700 Subject: [PATCH] messaging: Fix send_cmd destination type handling - Fall back to repeater commands when a destination has no contact type. - Keep an explicit dst_type instead of overwriting it with REPEATER. --- src/meshcore/commands/messaging.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/meshcore/commands/messaging.py b/src/meshcore/commands/messaging.py index dae7936..12cbf49 100644 --- a/src/meshcore/commands/messaging.py +++ b/src/meshcore/commands/messaging.py @@ -73,10 +73,11 @@ class MessagingCommands(CommandHandlerBase): timestamp = int(time.time()) if dst_type is None: - dst_type = dst["type"] - else: # assume destination is a repeater - logger.warning("Can't determine destination type, please ensure contacts first or specify dst_type when calling `send_cmd`. Assuming it's a repeater.") - dst_type = AdvType.REPEATER.value + if isinstance(dst, dict) and "type" in dst: + dst_type = dst["type"] + else: # assume destination is a repeater + logger.warning("Can't determine destination type, please ensure contacts first or specify dst_type when calling `send_cmd`. Assuming it's a repeater.") + dst_type = AdvType.REPEATER.value cmd_data = bytearray([CommandType.SEND_TXT_MSG.value]) if dst_type == AdvType.CHAT.value :