From c086b6372ec4880cd8381f94580410bc2a9f67ad Mon Sep 17 00:00:00 2001 From: Michael Gillett <51103663+migillett@users.noreply.github.com> Date: Sun, 26 Jan 2025 11:58:48 -0500 Subject: [PATCH 01/19] Update mesh_interface.py --- meshtastic/mesh_interface.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/meshtastic/mesh_interface.py b/meshtastic/mesh_interface.py index 57545c6..4c90969 100644 --- a/meshtastic/mesh_interface.py +++ b/meshtastic/mesh_interface.py @@ -469,6 +469,11 @@ class MeshInterface: # pylint: disable=R0902 and can be used to track future message acks/naks. """ + # issue 464: allow for 0x prefix in destinationId for hex values + if type(destinationId) == str: + destinationId = destinationId.replace('0x', '!') + logging.debug(f'destinationId: {destinationId}') + if getattr(data, "SerializeToString", None): logging.debug(f"Serializing protobuf as data: {stripnl(data)}") data = data.SerializeToString() From b522abf33ed6c9865ca3271b6767708aee5454a2 Mon Sep 17 00:00:00 2001 From: Michael Gillett <51103663+migillett@users.noreply.github.com> Date: Sun, 26 Jan 2025 12:06:31 -0500 Subject: [PATCH 02/19] update docs --- meshtastic/__main__.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/meshtastic/__main__.py b/meshtastic/__main__.py index 8f2aaf9..e0aa022 100644 --- a/meshtastic/__main__.py +++ b/meshtastic/__main__.py @@ -1344,7 +1344,7 @@ def addSelectionArgs(parser: argparse.ArgumentParser) -> argparse.ArgumentParser "--dest", help="The destination node id for any sent commands, if not set '^all' or '^local' is assumed as appropriate", default=None, - metavar="!xxxxxxxx", + metavar=["!XXXXXXXX", "0xXXXXXXXX"], ) group.add_argument( @@ -1648,7 +1648,7 @@ def addRemoteActionArgs(parser: argparse.ArgumentParser) -> argparse.ArgumentPar "You need pass the destination ID as argument, like " "this: '--traceroute !ba4bf9d0' " "Only nodes with a shared channel can be traced.", - metavar="!xxxxxxxx", + metavar=["!XXXXXXXX", "0xXXXXXXXX"], ) group.add_argument( @@ -1728,27 +1728,27 @@ def addRemoteAdminArgs(parser: argparse.ArgumentParser) -> argparse.ArgumentPars group.add_argument( "--remove-node", help="Tell the destination node to remove a specific node from its DB, by node number or ID", - metavar="!xxxxxxxx" + metavar=["!XXXXXXXX", "0xXXXXXXXX"] ) group.add_argument( "--set-favorite-node", help="Tell the destination node to set the specified node to be favorited on the NodeDB on the devicein its DB, by number or ID", - metavar="!xxxxxxxx" + metavar=["!XXXXXXXX", "0xXXXXXXXX"] ) group.add_argument( "--remove-favorite-node", help="Tell the destination node to set the specified node to be un-favorited on the NodeDB on the device, by number or ID", - metavar="!xxxxxxxx" + metavar=["!XXXXXXXX", "0xXXXXXXXX"] ) group.add_argument( "--set-ignored-node", help="Tell the destination node to set the specified node to be ignored on the NodeDB on the devicein its DB, by number or ID", - metavar="!xxxxxxxx" + metavar=["!XXXXXXXX", "0xXXXXXXXX"] ) group.add_argument( "--remove-ignored-node", help="Tell the destination node to set the specified node to be un-ignored on the NodeDB on the device, by number or ID", - metavar="!xxxxxxxx" + metavar=["!XXXXXXXX", "0xXXXXXXXX"] ) group.add_argument( "--reset-nodedb", From d0023df8ca4cffc7ac951eb7ae4712ebf4eab961 Mon Sep 17 00:00:00 2001 From: Michael Gillett <51103663+migillett@users.noreply.github.com> Date: Sun, 26 Jan 2025 12:55:03 -0500 Subject: [PATCH 03/19] slight logic rework --- meshtastic/mesh_interface.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/meshtastic/mesh_interface.py b/meshtastic/mesh_interface.py index 4c90969..5e55a0c 100644 --- a/meshtastic/mesh_interface.py +++ b/meshtastic/mesh_interface.py @@ -470,9 +470,13 @@ class MeshInterface: # pylint: disable=R0902 """ # issue 464: allow for 0x prefix in destinationId for hex values - if type(destinationId) == str: - destinationId = destinationId.replace('0x', '!') - logging.debug(f'destinationId: {destinationId}') + # destination ids can either be integers or strings with a !prefix + try: + int(destinationId) + except ValueError: + # only take the last 8 characters of the destinationId and force a ! prefix + destinationId = f'!{destinationId[-8:]}' + logging.info(f"Formatted destinationId: {destinationId}") if getattr(data, "SerializeToString", None): logging.debug(f"Serializing protobuf as data: {stripnl(data)}") From 0d8646189f822fcf0ff2ab4d8e3649601d5d9e25 Mon Sep 17 00:00:00 2001 From: Michael Gillett <51103663+migillett@users.noreply.github.com> Date: Sun, 26 Jan 2025 12:56:17 -0500 Subject: [PATCH 04/19] remove logging.info used for local debugging --- meshtastic/mesh_interface.py | 1 - 1 file changed, 1 deletion(-) diff --git a/meshtastic/mesh_interface.py b/meshtastic/mesh_interface.py index 5e55a0c..1d3feb2 100644 --- a/meshtastic/mesh_interface.py +++ b/meshtastic/mesh_interface.py @@ -476,7 +476,6 @@ class MeshInterface: # pylint: disable=R0902 except ValueError: # only take the last 8 characters of the destinationId and force a ! prefix destinationId = f'!{destinationId[-8:]}' - logging.info(f"Formatted destinationId: {destinationId}") if getattr(data, "SerializeToString", None): logging.debug(f"Serializing protobuf as data: {stripnl(data)}") From efb848adf92780daf6e12bca19922165d65bf080 Mon Sep 17 00:00:00 2001 From: Michael Gillett <51103663+migillett@users.noreply.github.com> Date: Sun, 26 Jan 2025 12:58:18 -0500 Subject: [PATCH 05/19] comments explaining logic --- meshtastic/mesh_interface.py | 1 + 1 file changed, 1 insertion(+) diff --git a/meshtastic/mesh_interface.py b/meshtastic/mesh_interface.py index 1d3feb2..775907c 100644 --- a/meshtastic/mesh_interface.py +++ b/meshtastic/mesh_interface.py @@ -472,6 +472,7 @@ class MeshInterface: # pylint: disable=R0902 # issue 464: allow for 0x prefix in destinationId for hex values # destination ids can either be integers or strings with a !prefix try: + # sometimes the destinationId is actually a int as a string, so doing a type() check won't work int(destinationId) except ValueError: # only take the last 8 characters of the destinationId and force a ! prefix From 5600ce92b0912e886e9f047a7a33c26a9364ce97 Mon Sep 17 00:00:00 2001 From: Michael Gillett <51103663+migillett@users.noreply.github.com> Date: Sun, 26 Jan 2025 13:10:56 -0500 Subject: [PATCH 06/19] update to comments --- meshtastic/mesh_interface.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/meshtastic/mesh_interface.py b/meshtastic/mesh_interface.py index 775907c..90f473f 100644 --- a/meshtastic/mesh_interface.py +++ b/meshtastic/mesh_interface.py @@ -472,10 +472,10 @@ class MeshInterface: # pylint: disable=R0902 # issue 464: allow for 0x prefix in destinationId for hex values # destination ids can either be integers or strings with a !prefix try: - # sometimes the destinationId is actually a int as a string, so doing a type() check won't work + # sometimes the destinationId is actually an int as a string, so doing a type() check won't work int(destinationId) except ValueError: - # only take the last 8 characters of the destinationId and force a ! prefix + # only take the last 8 characters of the hexadecimal destinationId and force a ! prefix destinationId = f'!{destinationId[-8:]}' if getattr(data, "SerializeToString", None): From 317d81c9834f0698e3ccad33541475fb4f132a40 Mon Sep 17 00:00:00 2001 From: Michael Gillett <51103663+migillett@users.noreply.github.com> Date: Tue, 18 Feb 2025 14:02:48 -0500 Subject: [PATCH 07/19] list -> tuple fix for pytest --- meshtastic/__main__.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/meshtastic/__main__.py b/meshtastic/__main__.py index e0aa022..914f389 100644 --- a/meshtastic/__main__.py +++ b/meshtastic/__main__.py @@ -1344,7 +1344,7 @@ def addSelectionArgs(parser: argparse.ArgumentParser) -> argparse.ArgumentParser "--dest", help="The destination node id for any sent commands, if not set '^all' or '^local' is assumed as appropriate", default=None, - metavar=["!XXXXXXXX", "0xXXXXXXXX"], + metavar=("!XXXXXXXX", "0xXXXXXXXX"), ) group.add_argument( @@ -1648,7 +1648,7 @@ def addRemoteActionArgs(parser: argparse.ArgumentParser) -> argparse.ArgumentPar "You need pass the destination ID as argument, like " "this: '--traceroute !ba4bf9d0' " "Only nodes with a shared channel can be traced.", - metavar=["!XXXXXXXX", "0xXXXXXXXX"], + metavar=("!XXXXXXXX", "0xXXXXXXXX"), ) group.add_argument( @@ -1728,27 +1728,27 @@ def addRemoteAdminArgs(parser: argparse.ArgumentParser) -> argparse.ArgumentPars group.add_argument( "--remove-node", help="Tell the destination node to remove a specific node from its DB, by node number or ID", - metavar=["!XXXXXXXX", "0xXXXXXXXX"] + metavar=("!XXXXXXXX", "0xXXXXXXXX") ) group.add_argument( "--set-favorite-node", help="Tell the destination node to set the specified node to be favorited on the NodeDB on the devicein its DB, by number or ID", - metavar=["!XXXXXXXX", "0xXXXXXXXX"] + metavar=("!XXXXXXXX", "0xXXXXXXXX") ) group.add_argument( "--remove-favorite-node", help="Tell the destination node to set the specified node to be un-favorited on the NodeDB on the device, by number or ID", - metavar=["!XXXXXXXX", "0xXXXXXXXX"] + metavar=("!XXXXXXXX", "0xXXXXXXXX") ) group.add_argument( "--set-ignored-node", help="Tell the destination node to set the specified node to be ignored on the NodeDB on the devicein its DB, by number or ID", - metavar=["!XXXXXXXX", "0xXXXXXXXX"] + metavar=("!XXXXXXXX", "0xXXXXXXXX") ) group.add_argument( "--remove-ignored-node", help="Tell the destination node to set the specified node to be un-ignored on the NodeDB on the device, by number or ID", - metavar=["!XXXXXXXX", "0xXXXXXXXX"] + metavar=("!XXXXXXXX", "0xXXXXXXXX") ) group.add_argument( "--reset-nodedb", From f9ae021e4338787cf436a8a1a38cefa226290c18 Mon Sep 17 00:00:00 2001 From: Michael Gillett <51103663+migillett@users.noreply.github.com> Date: Tue, 18 Feb 2025 14:23:40 -0500 Subject: [PATCH 08/19] remove old implementation --- meshtastic/mesh_interface.py | 9 --------- 1 file changed, 9 deletions(-) diff --git a/meshtastic/mesh_interface.py b/meshtastic/mesh_interface.py index 90f473f..57545c6 100644 --- a/meshtastic/mesh_interface.py +++ b/meshtastic/mesh_interface.py @@ -469,15 +469,6 @@ class MeshInterface: # pylint: disable=R0902 and can be used to track future message acks/naks. """ - # issue 464: allow for 0x prefix in destinationId for hex values - # destination ids can either be integers or strings with a !prefix - try: - # sometimes the destinationId is actually an int as a string, so doing a type() check won't work - int(destinationId) - except ValueError: - # only take the last 8 characters of the hexadecimal destinationId and force a ! prefix - destinationId = f'!{destinationId[-8:]}' - if getattr(data, "SerializeToString", None): logging.debug(f"Serializing protobuf as data: {stripnl(data)}") data = data.SerializeToString() From 60f9dc6266a42d04d71a800942e0b8ad69407f96 Mon Sep 17 00:00:00 2001 From: Michael Gillett <51103663+migillett@users.noreply.github.com> Date: Tue, 18 Feb 2025 14:23:55 -0500 Subject: [PATCH 09/19] new implementation --- meshtastic/mesh_interface.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/meshtastic/mesh_interface.py b/meshtastic/mesh_interface.py index 57545c6..8e2d145 100644 --- a/meshtastic/mesh_interface.py +++ b/meshtastic/mesh_interface.py @@ -892,8 +892,10 @@ class MeshInterface: # pylint: disable=R0902 else: our_exit("Warning: No myInfo found.") # A simple hex style nodeid - we can parse this without needing the DB - elif destinationId.startswith("!"): - nodeNum = int(destinationId[1:], 16) + elif isinstance(destinationId, str) and len(destinationId) > 8: + # assuming some form of node id string such as !1234578 or 0x12345678 + # always grab the last 8 items of the hexadecimal id str and parse to integer + nodeNum = int(destinationId[-8:], 16) else: if self.nodes: node = self.nodes.get(destinationId) From 530d92ead2ca8550e1508a5e2b7329f3f59680fe Mon Sep 17 00:00:00 2001 From: Michael Gillett <51103663+migillett@users.noreply.github.com> Date: Tue, 18 Feb 2025 14:24:04 -0500 Subject: [PATCH 10/19] remove redundant f string --- meshtastic/mesh_interface.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meshtastic/mesh_interface.py b/meshtastic/mesh_interface.py index 8e2d145..44ad0f8 100644 --- a/meshtastic/mesh_interface.py +++ b/meshtastic/mesh_interface.py @@ -1118,7 +1118,7 @@ class MeshInterface: # pylint: disable=R0902 """Send a ToRadio protobuf to the device""" if self.noProto: logging.warning( - f"Not sending packet because protocol use is disabled by noProto" + "Not sending packet because protocol use is disabled by noProto" ) else: # logging.debug(f"Sending toRadio: {stripnl(toRadio)}") From bd68739158d17dc7db8b3ff209ca30d7f5282132 Mon Sep 17 00:00:00 2001 From: Michael Gillett <51103663+migillett@users.noreply.github.com> Date: Tue, 18 Feb 2025 14:30:28 -0500 Subject: [PATCH 11/19] >= 8 instead of > 8 --- meshtastic/mesh_interface.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meshtastic/mesh_interface.py b/meshtastic/mesh_interface.py index 44ad0f8..24f1c39 100644 --- a/meshtastic/mesh_interface.py +++ b/meshtastic/mesh_interface.py @@ -892,7 +892,7 @@ class MeshInterface: # pylint: disable=R0902 else: our_exit("Warning: No myInfo found.") # A simple hex style nodeid - we can parse this without needing the DB - elif isinstance(destinationId, str) and len(destinationId) > 8: + elif isinstance(destinationId, str) and len(destinationId) >= 8: # assuming some form of node id string such as !1234578 or 0x12345678 # always grab the last 8 items of the hexadecimal id str and parse to integer nodeNum = int(destinationId[-8:], 16) From edff956f9d2db37d109afbe36bf48361a7fee567 Mon Sep 17 00:00:00 2001 From: Michael Gillett <51103663+migillett@users.noreply.github.com> Date: Tue, 18 Feb 2025 14:53:01 -0500 Subject: [PATCH 12/19] specify nargs --- meshtastic/__main__.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/meshtastic/__main__.py b/meshtastic/__main__.py index 914f389..143adb6 100644 --- a/meshtastic/__main__.py +++ b/meshtastic/__main__.py @@ -1344,6 +1344,7 @@ def addSelectionArgs(parser: argparse.ArgumentParser) -> argparse.ArgumentParser "--dest", help="The destination node id for any sent commands, if not set '^all' or '^local' is assumed as appropriate", default=None, + nargs=1, metavar=("!XXXXXXXX", "0xXXXXXXXX"), ) @@ -1648,6 +1649,7 @@ def addRemoteActionArgs(parser: argparse.ArgumentParser) -> argparse.ArgumentPar "You need pass the destination ID as argument, like " "this: '--traceroute !ba4bf9d0' " "Only nodes with a shared channel can be traced.", + nargs=1, metavar=("!XXXXXXXX", "0xXXXXXXXX"), ) @@ -1728,26 +1730,31 @@ def addRemoteAdminArgs(parser: argparse.ArgumentParser) -> argparse.ArgumentPars group.add_argument( "--remove-node", help="Tell the destination node to remove a specific node from its DB, by node number or ID", + nargs=1, metavar=("!XXXXXXXX", "0xXXXXXXXX") ) group.add_argument( "--set-favorite-node", help="Tell the destination node to set the specified node to be favorited on the NodeDB on the devicein its DB, by number or ID", + nargs=1, metavar=("!XXXXXXXX", "0xXXXXXXXX") ) group.add_argument( "--remove-favorite-node", help="Tell the destination node to set the specified node to be un-favorited on the NodeDB on the device, by number or ID", + nargs=1, metavar=("!XXXXXXXX", "0xXXXXXXXX") ) group.add_argument( "--set-ignored-node", help="Tell the destination node to set the specified node to be ignored on the NodeDB on the devicein its DB, by number or ID", + nargs=1, metavar=("!XXXXXXXX", "0xXXXXXXXX") ) group.add_argument( "--remove-ignored-node", help="Tell the destination node to set the specified node to be un-ignored on the NodeDB on the device, by number or ID", + nargs=1, metavar=("!XXXXXXXX", "0xXXXXXXXX") ) group.add_argument( From cc411ce0bb1107a99fb3fd6608ab8132c96d8941 Mon Sep 17 00:00:00 2001 From: Michael Gillett <51103663+migillett@users.noreply.github.com> Date: Tue, 18 Feb 2025 15:05:31 -0500 Subject: [PATCH 13/19] remove nargs and unneeded fstrings --- meshtastic/__main__.py | 8 +------- meshtastic/mesh_interface.py | 4 ++-- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/meshtastic/__main__.py b/meshtastic/__main__.py index 143adb6..44cc0cf 100644 --- a/meshtastic/__main__.py +++ b/meshtastic/__main__.py @@ -1649,7 +1649,6 @@ def addRemoteActionArgs(parser: argparse.ArgumentParser) -> argparse.ArgumentPar "You need pass the destination ID as argument, like " "this: '--traceroute !ba4bf9d0' " "Only nodes with a shared channel can be traced.", - nargs=1, metavar=("!XXXXXXXX", "0xXXXXXXXX"), ) @@ -1730,31 +1729,26 @@ def addRemoteAdminArgs(parser: argparse.ArgumentParser) -> argparse.ArgumentPars group.add_argument( "--remove-node", help="Tell the destination node to remove a specific node from its DB, by node number or ID", - nargs=1, metavar=("!XXXXXXXX", "0xXXXXXXXX") ) group.add_argument( "--set-favorite-node", help="Tell the destination node to set the specified node to be favorited on the NodeDB on the devicein its DB, by number or ID", - nargs=1, metavar=("!XXXXXXXX", "0xXXXXXXXX") ) group.add_argument( "--remove-favorite-node", help="Tell the destination node to set the specified node to be un-favorited on the NodeDB on the device, by number or ID", - nargs=1, metavar=("!XXXXXXXX", "0xXXXXXXXX") ) group.add_argument( "--set-ignored-node", help="Tell the destination node to set the specified node to be ignored on the NodeDB on the devicein its DB, by number or ID", - nargs=1, - metavar=("!XXXXXXXX", "0xXXXXXXXX") + metavar="!XXXXXXXX" ) group.add_argument( "--remove-ignored-node", help="Tell the destination node to set the specified node to be un-ignored on the NodeDB on the device, by number or ID", - nargs=1, metavar=("!XXXXXXXX", "0xXXXXXXXX") ) group.add_argument( diff --git a/meshtastic/mesh_interface.py b/meshtastic/mesh_interface.py index 24f1c39..d21059b 100644 --- a/meshtastic/mesh_interface.py +++ b/meshtastic/mesh_interface.py @@ -345,7 +345,7 @@ class MeshInterface: # pylint: disable=R0902 if new_index != last_index: retries_left = requestChannelAttempts - 1 if retries_left <= 0: - our_exit(f"Error: Timed out waiting for channels, giving up") + our_exit("Error: Timed out waiting for channels, giving up") print("Timed out trying to retrieve channel info, retrying") n.requestChannels(startingIndex=new_index) last_index = new_index @@ -929,7 +929,7 @@ class MeshInterface: # pylint: disable=R0902 toRadio.packet.CopyFrom(meshPacket) if self.noProto: logging.warning( - f"Not sending packet because protocol use is disabled by noProto" + "Not sending packet because protocol use is disabled by noProto" ) else: logging.debug(f"Sending packet: {stripnl(meshPacket)}") From 7cc65aa08aa74da8fe9017235bd8e43765556cb3 Mon Sep 17 00:00:00 2001 From: Michael Gillett <51103663+migillett@users.noreply.github.com> Date: Tue, 18 Feb 2025 15:06:20 -0500 Subject: [PATCH 14/19] missed one --- meshtastic/__main__.py | 1 - 1 file changed, 1 deletion(-) diff --git a/meshtastic/__main__.py b/meshtastic/__main__.py index 44cc0cf..6c50cf2 100644 --- a/meshtastic/__main__.py +++ b/meshtastic/__main__.py @@ -1344,7 +1344,6 @@ def addSelectionArgs(parser: argparse.ArgumentParser) -> argparse.ArgumentParser "--dest", help="The destination node id for any sent commands, if not set '^all' or '^local' is assumed as appropriate", default=None, - nargs=1, metavar=("!XXXXXXXX", "0xXXXXXXXX"), ) From 4ec7698d94fea4b56cb3db6b5efe2b60a1be240c Mon Sep 17 00:00:00 2001 From: Michael Gillett <51103663+migillett@users.noreply.github.com> Date: Tue, 18 Feb 2025 15:09:59 -0500 Subject: [PATCH 15/19] metavars being a PAIN --- meshtastic/__main__.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/meshtastic/__main__.py b/meshtastic/__main__.py index 6c50cf2..7167c5b 100644 --- a/meshtastic/__main__.py +++ b/meshtastic/__main__.py @@ -1344,7 +1344,7 @@ def addSelectionArgs(parser: argparse.ArgumentParser) -> argparse.ArgumentParser "--dest", help="The destination node id for any sent commands, if not set '^all' or '^local' is assumed as appropriate", default=None, - metavar=("!XXXXXXXX", "0xXXXXXXXX"), + metavar="!XXXXXXXX", ) group.add_argument( @@ -1648,7 +1648,7 @@ def addRemoteActionArgs(parser: argparse.ArgumentParser) -> argparse.ArgumentPar "You need pass the destination ID as argument, like " "this: '--traceroute !ba4bf9d0' " "Only nodes with a shared channel can be traced.", - metavar=("!XXXXXXXX", "0xXXXXXXXX"), + metavar="!XXXXXXXX" ) group.add_argument( @@ -1728,17 +1728,17 @@ def addRemoteAdminArgs(parser: argparse.ArgumentParser) -> argparse.ArgumentPars group.add_argument( "--remove-node", help="Tell the destination node to remove a specific node from its DB, by node number or ID", - metavar=("!XXXXXXXX", "0xXXXXXXXX") + metavar="!XXXXXXXX" ) group.add_argument( "--set-favorite-node", help="Tell the destination node to set the specified node to be favorited on the NodeDB on the devicein its DB, by number or ID", - metavar=("!XXXXXXXX", "0xXXXXXXXX") + metavar="!XXXXXXXX" ) group.add_argument( "--remove-favorite-node", help="Tell the destination node to set the specified node to be un-favorited on the NodeDB on the device, by number or ID", - metavar=("!XXXXXXXX", "0xXXXXXXXX") + metavar="!XXXXXXXX" ) group.add_argument( "--set-ignored-node", @@ -1748,7 +1748,7 @@ def addRemoteAdminArgs(parser: argparse.ArgumentParser) -> argparse.ArgumentPars group.add_argument( "--remove-ignored-node", help="Tell the destination node to set the specified node to be un-ignored on the NodeDB on the device, by number or ID", - metavar=("!XXXXXXXX", "0xXXXXXXXX") + metavar="!XXXXXXXX" ) group.add_argument( "--reset-nodedb", From 7d87d5037e14c4629ff9df1a3db9d306099be30a Mon Sep 17 00:00:00 2001 From: Michael Gillett <51103663+migillett@users.noreply.github.com> Date: Tue, 18 Feb 2025 15:10:26 -0500 Subject: [PATCH 16/19] Update __main__.py --- meshtastic/__main__.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/meshtastic/__main__.py b/meshtastic/__main__.py index 7167c5b..0844f09 100644 --- a/meshtastic/__main__.py +++ b/meshtastic/__main__.py @@ -1344,7 +1344,7 @@ def addSelectionArgs(parser: argparse.ArgumentParser) -> argparse.ArgumentParser "--dest", help="The destination node id for any sent commands, if not set '^all' or '^local' is assumed as appropriate", default=None, - metavar="!XXXXXXXX", + metavar="!xxxxxxxx", ) group.add_argument( @@ -1648,7 +1648,7 @@ def addRemoteActionArgs(parser: argparse.ArgumentParser) -> argparse.ArgumentPar "You need pass the destination ID as argument, like " "this: '--traceroute !ba4bf9d0' " "Only nodes with a shared channel can be traced.", - metavar="!XXXXXXXX" + metavar="!xxxxxxxx" ) group.add_argument( @@ -1728,27 +1728,27 @@ def addRemoteAdminArgs(parser: argparse.ArgumentParser) -> argparse.ArgumentPars group.add_argument( "--remove-node", help="Tell the destination node to remove a specific node from its DB, by node number or ID", - metavar="!XXXXXXXX" + metavar="!xxxxxxxx" ) group.add_argument( "--set-favorite-node", help="Tell the destination node to set the specified node to be favorited on the NodeDB on the devicein its DB, by number or ID", - metavar="!XXXXXXXX" + metavar="!xxxxxxxx" ) group.add_argument( "--remove-favorite-node", help="Tell the destination node to set the specified node to be un-favorited on the NodeDB on the device, by number or ID", - metavar="!XXXXXXXX" + metavar="!xxxxxxxx" ) group.add_argument( "--set-ignored-node", help="Tell the destination node to set the specified node to be ignored on the NodeDB on the devicein its DB, by number or ID", - metavar="!XXXXXXXX" + metavar="!xxxxxxxx" ) group.add_argument( "--remove-ignored-node", help="Tell the destination node to set the specified node to be un-ignored on the NodeDB on the device, by number or ID", - metavar="!XXXXXXXX" + metavar="!xxxxxxxx" ) group.add_argument( "--reset-nodedb", From 060df86bb670a1cdbeaa8cd526fcd62489a28e42 Mon Sep 17 00:00:00 2001 From: Michael Gillett <51103663+migillett@users.noreply.github.com> Date: Tue, 18 Feb 2025 15:10:55 -0500 Subject: [PATCH 17/19] Update __main__.py --- meshtastic/__main__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meshtastic/__main__.py b/meshtastic/__main__.py index 0844f09..8f2aaf9 100644 --- a/meshtastic/__main__.py +++ b/meshtastic/__main__.py @@ -1648,7 +1648,7 @@ def addRemoteActionArgs(parser: argparse.ArgumentParser) -> argparse.ArgumentPar "You need pass the destination ID as argument, like " "this: '--traceroute !ba4bf9d0' " "Only nodes with a shared channel can be traced.", - metavar="!xxxxxxxx" + metavar="!xxxxxxxx", ) group.add_argument( From c844e4e0fe05c86836d22bbe3bd0bd147a52011a Mon Sep 17 00:00:00 2001 From: Michael Gillett <51103663+migillett@users.noreply.github.com> Date: Tue, 18 Feb 2025 15:25:24 -0500 Subject: [PATCH 18/19] help details for new prefix values --- meshtastic/__main__.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/meshtastic/__main__.py b/meshtastic/__main__.py index 8f2aaf9..5ee4a07 100644 --- a/meshtastic/__main__.py +++ b/meshtastic/__main__.py @@ -1342,7 +1342,7 @@ def addSelectionArgs(parser: argparse.ArgumentParser) -> argparse.ArgumentParser group.add_argument( "--dest", - help="The destination node id for any sent commands, if not set '^all' or '^local' is assumed as appropriate", + help="The destination node id for any sent commands. Use prefix of ! or 0x. If not set '^all' or '^local' is assumed as appropriate.", default=None, metavar="!xxxxxxxx", ) @@ -1646,7 +1646,7 @@ def addRemoteActionArgs(parser: argparse.ArgumentParser) -> argparse.ArgumentPar "--traceroute", help="Traceroute from connected node to a destination. " "You need pass the destination ID as argument, like " - "this: '--traceroute !ba4bf9d0' " + "this: '--traceroute !ba4bf9d0' | '--traceroute 0xba4bf9d0'" "Only nodes with a shared channel can be traced.", metavar="!xxxxxxxx", ) @@ -1732,22 +1732,22 @@ def addRemoteAdminArgs(parser: argparse.ArgumentParser) -> argparse.ArgumentPars ) group.add_argument( "--set-favorite-node", - help="Tell the destination node to set the specified node to be favorited on the NodeDB on the devicein its DB, by number or ID", + help="Tell the destination node to set the specified node to be favorited on the NodeDB on the devicein its DB, by number or ID using '!' or '0x' prefix.", metavar="!xxxxxxxx" ) group.add_argument( "--remove-favorite-node", - help="Tell the destination node to set the specified node to be un-favorited on the NodeDB on the device, by number or ID", + help="Tell the destination node to set the specified node to be un-favorited on the NodeDB on the device, by number or ID using '!' or '0x' prefix.", metavar="!xxxxxxxx" ) group.add_argument( "--set-ignored-node", - help="Tell the destination node to set the specified node to be ignored on the NodeDB on the devicein its DB, by number or ID", + help="Tell the destination node to set the specified node to be ignored on the NodeDB on the devicein its DB, by number or ID using '!' or '0x' prefix.", metavar="!xxxxxxxx" ) group.add_argument( "--remove-ignored-node", - help="Tell the destination node to set the specified node to be un-ignored on the NodeDB on the device, by number or ID", + help="Tell the destination node to set the specified node to be un-ignored on the NodeDB on the device, by number or ID using '!' or '0x' prefix.", metavar="!xxxxxxxx" ) group.add_argument( From 23ea19c00b3dd4453948ebe457a047ecb7a6b06a Mon Sep 17 00:00:00 2001 From: Michael Gillett <51103663+migillett@users.noreply.github.com> Date: Wed, 19 Feb 2025 11:26:49 -0500 Subject: [PATCH 19/19] linter fixes following failed build --- meshtastic/__main__.py | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/meshtastic/__main__.py b/meshtastic/__main__.py index 5ee4a07..fa258c8 100644 --- a/meshtastic/__main__.py +++ b/meshtastic/__main__.py @@ -226,7 +226,7 @@ def setPref(config, comp_name, raw_val) -> bool: logging.debug(f"valStr:{raw_val} val:{val}") if snake_name == "wifi_psk" and len(str(raw_val)) < 8: - print(f"Warning: network.wifi_psk must be 8 or more characters.") + print("Warning: network.wifi_psk must be 8 or more characters.") return False enumType = pref.enum_type @@ -1342,7 +1342,8 @@ def addSelectionArgs(parser: argparse.ArgumentParser) -> argparse.ArgumentParser group.add_argument( "--dest", - help="The destination node id for any sent commands. Use prefix of ! or 0x. If not set '^all' or '^local' is assumed as appropriate.", + help="The destination node id for any sent commands. If not set '^all' or '^local' is assumed." + "Use the node ID with a '!' or '0x' prefix or the node number.", default=None, metavar="!xxxxxxxx", ) @@ -1727,27 +1728,32 @@ def addRemoteAdminArgs(parser: argparse.ArgumentParser) -> argparse.ArgumentPars group.add_argument( "--remove-node", - help="Tell the destination node to remove a specific node from its DB, by node number or ID", + help="Tell the destination node to remove a specific node from its NodeDB. " + "Use the node ID with a '!' or '0x' prefix or the node number.", metavar="!xxxxxxxx" ) group.add_argument( "--set-favorite-node", - help="Tell the destination node to set the specified node to be favorited on the NodeDB on the devicein its DB, by number or ID using '!' or '0x' prefix.", + help="Tell the destination node to set the specified node to be favorited on the NodeDB. " + "Use the node ID with a '!' or '0x' prefix or the node number.", metavar="!xxxxxxxx" ) group.add_argument( "--remove-favorite-node", - help="Tell the destination node to set the specified node to be un-favorited on the NodeDB on the device, by number or ID using '!' or '0x' prefix.", + help="Tell the destination node to set the specified node to be un-favorited on the NodeDB. " + "Use the node ID with a '!' or '0x' prefix or the node number.", metavar="!xxxxxxxx" ) group.add_argument( "--set-ignored-node", - help="Tell the destination node to set the specified node to be ignored on the NodeDB on the devicein its DB, by number or ID using '!' or '0x' prefix.", + help="Tell the destination node to set the specified node to be ignored on the NodeDB. " + "Use the node ID with a '!' or '0x' prefix or the node number.", metavar="!xxxxxxxx" ) group.add_argument( "--remove-ignored-node", - help="Tell the destination node to set the specified node to be un-ignored on the NodeDB on the device, by number or ID using '!' or '0x' prefix.", + help="Tell the destination node to set the specified node to be un-ignored on the NodeDB. " + "Use the node ID with a '!' or '0x' prefix or the node number.", metavar="!xxxxxxxx" ) group.add_argument(