python
python copied to clipboard
Why request all remote channels before executing the command: set-owner-short
ben@meshtastic:~/.local/lib/python3.9/site-packages/meshtastic$ meshtastic --dest \!f244c480 --set-owner-short xxxx
Connected to radio
Setting device owner short to xxxx
Requesting preferences from remote node.
Be sure:
1. There is a SECONDARY channel named 'admin'.
2. The '--seturl' was used to configure.
3. All devices have the same modem config. (i.e., '--ch-longfast')
4. All devices have been rebooted after all of the above. (optional, but recommended)
Note: This could take a while (it requests remote channel configs, then writes config)
Requesting channel 0 info from remote node (this could take a while)
Requesting channel 1 info from remote node (this could take a while)
Requesting channel 2 info from remote node (this could take a while)
System: Linux
Platform: Linux-5.10.0-13-amd64-x86_64-with-glibc2.31
Release: 5.10.0-13-amd64
Machine: x86_64
Encoding (stdin): utf-8
Encoding (stdout): utf-8
meshtastic: v1.2.93
Executable: /home/ben/.local/bin/meshtastic
Python: 3.9.2 CPython GCC 10.2.1 20210110
When we call
interface.getNode(args.dest).setOwner(long_name=None, short_name=args.set_owner_short)
getNode create a requestConfig while we just need the meshtastic.node.Node(self, nodeId).
So each time we try to communicate with remote we waste time/energy/airtime to get remoteConfig which not needed:
def getNode(self, nodeId):
"""Return a node object which contains device settings and channel info"""
if nodeId in (LOCAL_ADDR, BROADCAST_ADDR):
return self.localNode
else:
n = meshtastic.node.Node(self, nodeId)
logging.debug("About to requestConfig")
# n.requestConfig()
# if not n.waitForConfig():
# our_exit("Error: Timed out waiting for node config")
return n
I propose to comment n.requestConfig() as above.
but we need to move it somewhere else in the code for the command:
meshtastic --dest \!f244c480 --info
Both modification proposed in the commit.
Will do a Merge Request.
If pull request #310 approved then we can close this issue.