From 775108b47bc87fe53369f16941bf48cf74cf56a6 Mon Sep 17 00:00:00 2001 From: Paul Picazo Date: Tue, 2 Jul 2024 10:09:58 -0700 Subject: [PATCH 1/8] Hop limit param on sendTraceRoute fix --- meshtastic/mesh_interface.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/meshtastic/mesh_interface.py b/meshtastic/mesh_interface.py index bf7d715..3508a34 100644 --- a/meshtastic/mesh_interface.py +++ b/meshtastic/mesh_interface.py @@ -325,6 +325,7 @@ class MeshInterface: # pylint: disable=R0902 onResponse: Optional[Callable[[dict], Any]]=None, onResponseAckPermitted: bool=False, channelIndex: int=0, + hopLimit: Optional[int]=None, ): """Send a data packet to some other node @@ -347,7 +348,8 @@ class MeshInterface: # pylint: disable=R0902 for regular ACKs (True) or just data responses & NAKs (False) Note that if the onResponse callback is called 'onAckNak' this will implicitly be true. - channelIndex - channel number to use + channelIndex -- channel number to use + hopLimit -- hop limit to use Returns the sent packet. The id field will be populated in this packet and can be used to track future message acks/naks. @@ -379,7 +381,7 @@ class MeshInterface: # pylint: disable=R0902 if onResponse is not None: logging.debug(f"Setting a response handler for requestId {meshPacket.id}") self._addResponseHandler(meshPacket.id, onResponse, ackPermitted=onResponseAckPermitted) - p = self._sendPacket(meshPacket, destinationId, wantAck=wantAck) + p = self._sendPacket(meshPacket, destinationId, wantAck=wantAck, hopLimit=hopLimit) return p def sendPosition( @@ -478,6 +480,7 @@ class MeshInterface: # pylint: disable=R0902 wantResponse=True, onResponse=self.onResponseTraceRoute, channelIndex=channelIndex, + hopLimit=hopLimit, ) # extend timeout based on number of nodes, limit by configured hopLimit waitFactor = min(len(self.nodes) - 1 if self.nodes else 0, hopLimit) @@ -563,7 +566,7 @@ class MeshInterface: # pylint: disable=R0902 def _addResponseHandler(self, requestId: int, callback: Callable[[dict], Any], ackPermitted: bool=False): self.responseHandlers[requestId] = ResponseHandler(callback=callback, ackPermitted=ackPermitted) - def _sendPacket(self, meshPacket: mesh_pb2.MeshPacket, destinationId: Union[int,str]=BROADCAST_ADDR, wantAck: bool=False): + def _sendPacket(self, meshPacket: mesh_pb2.MeshPacket, destinationId: Union[int,str]=BROADCAST_ADDR, wantAck: bool=False, hopLimit: Optional[int]=None): """Send a MeshPacket to the specified node (or if unspecified, broadcast). You probably don't want this - use sendData instead. @@ -604,9 +607,12 @@ class MeshInterface: # pylint: disable=R0902 meshPacket.to = nodeNum meshPacket.want_ack = wantAck - loraConfig = getattr(self.localNode.localConfig, "lora") - hopLimit = getattr(loraConfig, "hop_limit") - meshPacket.hop_limit = hopLimit + + if hopLimit is not None: + meshPacket.hop_limit = hopLimit + else: + loraConfig = getattr(self.localNode.localConfig, "lora") + meshPacket.hop_limit = getattr(loraConfig, "hop_limit") # if the user hasn't set an ID for this packet (likely and recommended), # we should pick a new unique ID so the message can be tracked. From 15b03b704cedb2734b007f12ff60a050863576c9 Mon Sep 17 00:00:00 2001 From: Ian McEwen Date: Wed, 3 Jul 2024 20:35:58 -0700 Subject: [PATCH 2/8] Correctly detect LocalConfig vs. LocalModuleConfig, again. fixes #630 --- meshtastic/node.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meshtastic/node.py b/meshtastic/node.py index 31a5b03..48b9508 100644 --- a/meshtastic/node.py +++ b/meshtastic/node.py @@ -128,7 +128,7 @@ class Node: print("Requesting current config from remote node (this can take a while).") msgIndex = configType.index - if configType.containing_type.full_name in ("meshtastic.LocalConfig", "LocalConfig"): + if configType.containing_type.name == "LocalConfig": p = admin_pb2.AdminMessage() p.get_config_request = msgIndex self._sendAdmin(p, wantResponse=True, onResponse=onResponse) From b59aee91f260a21bca41cdf60ef2615b21daad28 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 6 Jul 2024 02:31:50 +0000 Subject: [PATCH 3/8] Bump certifi from 2024.6.2 to 2024.7.4 Bumps [certifi](https://github.com/certifi/python-certifi) from 2024.6.2 to 2024.7.4. - [Commits](https://github.com/certifi/python-certifi/compare/2024.06.02...2024.07.04) --- updated-dependencies: - dependency-name: certifi dependency-type: indirect ... Signed-off-by: dependabot[bot] --- poetry.lock | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/poetry.lock b/poetry.lock index 3331326..0695e57 100644 --- a/poetry.lock +++ b/poetry.lock @@ -119,13 +119,13 @@ files = [ [[package]] name = "certifi" -version = "2024.6.2" +version = "2024.7.4" description = "Python package for providing Mozilla's CA Bundle." optional = false python-versions = ">=3.6" files = [ - {file = "certifi-2024.6.2-py3-none-any.whl", hash = "sha256:ddc6c8ce995e6987e7faf5e3f1b02b302836a0e5d98ece18392cb1a36c72ad56"}, - {file = "certifi-2024.6.2.tar.gz", hash = "sha256:3cd43f1c6fa7dedc5899d69d3ad0398fd018ad1a17fba83ddaf78aa46c747516"}, + {file = "certifi-2024.7.4-py3-none-any.whl", hash = "sha256:c198e21b1289c2ab85ee4e67bb4b4ef3ead0892059901a8d5b622f24a1101e90"}, + {file = "certifi-2024.7.4.tar.gz", hash = "sha256:5a1e7645bc0ec61a09e26c36f6106dd4cf40c6db3a1fb6352b0244e7fb057c7b"}, ] [[package]] @@ -1103,6 +1103,7 @@ files = [ {file = "PyYAML-6.0.1-cp311-cp311-win_amd64.whl", hash = "sha256:bf07ee2fef7014951eeb99f56f39c9bb4af143d8aa3c21b1677805985307da34"}, {file = "PyYAML-6.0.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:855fb52b0dc35af121542a76b9a84f8d1cd886ea97c84703eaa6d88e37a2ad28"}, {file = "PyYAML-6.0.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:40df9b996c2b73138957fe23a16a4f0ba614f4c0efce1e9406a184b6d07fa3a9"}, + {file = "PyYAML-6.0.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a08c6f0fe150303c1c6b71ebcd7213c2858041a7e01975da3a99aed1e7a378ef"}, {file = "PyYAML-6.0.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6c22bec3fbe2524cde73d7ada88f6566758a8f7227bfbf93a408a9d86bcc12a0"}, {file = "PyYAML-6.0.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:8d4e9c88387b0f5c7d5f281e55304de64cf7f9c0021a3525bd3b1c542da3b0e4"}, {file = "PyYAML-6.0.1-cp312-cp312-win32.whl", hash = "sha256:d483d2cdf104e7c9fa60c544d92981f12ad66a457afae824d146093b8c294c54"}, From 64bb668251d35909034449ca29699ab64f3320a7 Mon Sep 17 00:00:00 2001 From: Paul Picazo Date: Sun, 7 Jul 2024 20:30:19 -0700 Subject: [PATCH 4/8] Fix line too long --- meshtastic/mesh_interface.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/meshtastic/mesh_interface.py b/meshtastic/mesh_interface.py index 3508a34..302d41d 100644 --- a/meshtastic/mesh_interface.py +++ b/meshtastic/mesh_interface.py @@ -566,7 +566,13 @@ class MeshInterface: # pylint: disable=R0902 def _addResponseHandler(self, requestId: int, callback: Callable[[dict], Any], ackPermitted: bool=False): self.responseHandlers[requestId] = ResponseHandler(callback=callback, ackPermitted=ackPermitted) - def _sendPacket(self, meshPacket: mesh_pb2.MeshPacket, destinationId: Union[int,str]=BROADCAST_ADDR, wantAck: bool=False, hopLimit: Optional[int]=None): + def _sendPacket( + self, + meshPacket: mesh_pb2.MeshPacket, + destinationId: Union[int,str]=BROADCAST_ADDR, + wantAck: bool=False, + hopLimit: Optional[int]=None + ): """Send a MeshPacket to the specified node (or if unspecified, broadcast). You probably don't want this - use sendData instead. From ec4e5210017897403c1e27a073c0465812863f02 Mon Sep 17 00:00:00 2001 From: Ian McEwen Date: Sun, 7 Jul 2024 20:49:38 -0700 Subject: [PATCH 5/8] Add a warning about this being the last version supporting python 3.8 --- meshtastic/__main__.py | 3 +++ meshtastic/util.py | 3 +++ 2 files changed, 6 insertions(+) diff --git a/meshtastic/__main__.py b/meshtastic/__main__.py index c032a36..657cc41 100644 --- a/meshtastic/__main__.py +++ b/meshtastic/__main__.py @@ -811,6 +811,9 @@ def onConnected(interface): f"*** A newer version v{pypi_version} is available!" ' Consider running "pip install --upgrade meshtastic" ***\n' ) + if sys.version_info[0] == 3 and sys.version_info[1] < 9: + print(" *** this version of the CLI is the last that supports python 3.8 ***") + print(" *** please update your python installation ***") else: print("Showing info of remote node is not supported.") print( diff --git a/meshtastic/util.py b/meshtastic/util.py index 3193802..23f648b 100644 --- a/meshtastic/util.py +++ b/meshtastic/util.py @@ -317,6 +317,9 @@ def support_info(): ) else: print(f" meshtastic: v{the_version}") + if sys.version_info[0] == 3 and sys.version_info[1] < 9: + print(" *** this version of the CLI is the last that supports python 3.8 ***") + print(" *** please update your python installation ***") print(f" Executable: {sys.argv[0]}") print( f" Python: {platform.python_version()} {platform.python_implementation()} {platform.python_compiler()}" From 62cfe2d7fee31d6f66e6de920bf5235d7c2dacf0 Mon Sep 17 00:00:00 2001 From: github-actions Date: Mon, 8 Jul 2024 03:52:47 +0000 Subject: [PATCH 6/8] bump version --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index e5d9b22..b7a4805 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "meshtastic" -version = "2.3.13" +version = "2.3.14" description = "Python API & client shell for talking to Meshtastic devices" authors = ["Meshtastic Developers "] license = "GPL-3.0-only" From 865bb6a497848cfccab01498fd7c05774547e6a0 Mon Sep 17 00:00:00 2001 From: Ian McEwen Date: Sun, 7 Jul 2024 21:00:26 -0700 Subject: [PATCH 7/8] Remove python 3.8 warning. protobufs: v2.3.15 (brought in by merge) --- meshtastic/__main__.py | 3 --- meshtastic/util.py | 3 --- 2 files changed, 6 deletions(-) diff --git a/meshtastic/__main__.py b/meshtastic/__main__.py index e3c594a..87d23cb 100644 --- a/meshtastic/__main__.py +++ b/meshtastic/__main__.py @@ -819,9 +819,6 @@ def onConnected(interface): f"*** A newer version v{pypi_version} is available!" ' Consider running "pip install --upgrade meshtastic" ***\n' ) - if sys.version_info[0] == 3 and sys.version_info[1] < 9: - print(" *** this version of the CLI is the last that supports python 3.8 ***") - print(" *** please update your python installation ***") else: print("Showing info of remote node is not supported.") print( diff --git a/meshtastic/util.py b/meshtastic/util.py index 69a319d..8cb177c 100644 --- a/meshtastic/util.py +++ b/meshtastic/util.py @@ -322,9 +322,6 @@ def support_info(): ) else: print(f" meshtastic: v{the_version}") - if sys.version_info[0] == 3 and sys.version_info[1] < 9: - print(" *** this version of the CLI is the last that supports python 3.8 ***") - print(" *** please update your python installation ***") print(f" Executable: {sys.argv[0]}") print( f" Python: {platform.python_version()} {platform.python_implementation()} {platform.python_compiler()}" From 3c772b5a31bee2170da8816fc73b0f14e99fcde1 Mon Sep 17 00:00:00 2001 From: Ian McEwen Date: Sun, 7 Jul 2024 21:15:29 -0700 Subject: [PATCH 8/8] Attempt adding python 3.12 to CI --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 82d1c99..543db54 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,6 +16,7 @@ jobs: - "3.9" - "3.10" - "3.11" + - "3.12" steps: - uses: actions/checkout@v4 - name: Install Python 3 @@ -58,6 +59,7 @@ jobs: - "3.9" - "3.10" - "3.11" + - "3.12" steps: - uses: actions/checkout@v4 - name: Install Python 3