mirror of
https://github.com/meshtastic/python.git
synced 2025-12-26 09:27:52 -05:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ece6286d82 | ||
|
|
0bb4b31b6a | ||
|
|
915066e0af | ||
|
|
6be3969577 | ||
|
|
b73cc1f499 | ||
|
|
65305af184 |
@@ -1228,7 +1228,7 @@ def common():
|
||||
|
||||
|
||||
def addConnectionArgs(parser: argparse.ArgumentParser) -> argparse.ArgumentParser:
|
||||
"""Add connection specifiation arguments"""
|
||||
"""Add connection specification arguments"""
|
||||
|
||||
outer = parser.add_argument_group(
|
||||
"Connection",
|
||||
@@ -1264,64 +1264,92 @@ def addConnectionArgs(parser: argparse.ArgumentParser) -> argparse.ArgumentParse
|
||||
const="any",
|
||||
)
|
||||
|
||||
outer.add_argument(
|
||||
"--ble-scan",
|
||||
help="Scan for Meshtastic BLE devices that may be available to connect to",
|
||||
action="store_true",
|
||||
)
|
||||
|
||||
return parser
|
||||
|
||||
|
||||
def initParser():
|
||||
"""Initialize the command line argument parsing."""
|
||||
parser = mt_config.parser
|
||||
args = mt_config.args
|
||||
|
||||
# The "Help" group includes the help option and other informational stuff about the CLI itself
|
||||
outerHelpGroup = parser.add_argument_group("Help")
|
||||
helpGroup = outerHelpGroup.add_mutually_exclusive_group()
|
||||
helpGroup.add_argument(
|
||||
"-h", "--help", action="help", help="show this help message and exit"
|
||||
def addSelectionArgs(parser: argparse.ArgumentParser) -> argparse.ArgumentParser:
|
||||
"""Add node/channel specification arguments"""
|
||||
group = parser.add_argument_group(
|
||||
"Selection",
|
||||
"Arguments that select channels to use, destination nodes, etc."
|
||||
)
|
||||
|
||||
the_version = get_active_version()
|
||||
helpGroup.add_argument("--version", action="version", version=f"{the_version}")
|
||||
|
||||
helpGroup.add_argument(
|
||||
"--support",
|
||||
action="store_true",
|
||||
help="Show support info (useful when troubleshooting an issue)",
|
||||
group.add_argument(
|
||||
"--dest",
|
||||
help="The destination node id for any sent commands, if not set '^all' or '^local' is assumed as appropriate",
|
||||
default=None,
|
||||
metavar="!xxxxxxxx",
|
||||
)
|
||||
|
||||
# Connection arguments to indicate a device to connect to
|
||||
parser = addConnectionArgs(parser)
|
||||
group.add_argument(
|
||||
"--ch-index",
|
||||
help="Set the specified channel index for channel-specific commands. Channels start at 0 (0 is the PRIMARY channel).",
|
||||
action="store",
|
||||
metavar="INDEX",
|
||||
)
|
||||
|
||||
# Arguments concerning viewing and setting configuration
|
||||
return parser
|
||||
|
||||
# Arguments for sending or requesting things from the local device
|
||||
def addImportExportArgs(parser: argparse.ArgumentParser) -> argparse.ArgumentParser:
|
||||
"""Add import/export config arguments"""
|
||||
group = parser.add_argument_group(
|
||||
"Import/Export",
|
||||
"Arguments that concern importing and exporting configuration of Meshtastic devices",
|
||||
)
|
||||
|
||||
# Arguments for sending or requesting things from the mesh
|
||||
|
||||
# All the rest of the arguments
|
||||
group = parser.add_argument_group("optional arguments")
|
||||
group.add_argument(
|
||||
"--configure",
|
||||
help="Specify a path to a yaml(.yml) file containing the desired settings for the connected device.",
|
||||
action="append",
|
||||
)
|
||||
|
||||
group.add_argument(
|
||||
"--export-config",
|
||||
help="Export the configuration in yaml(.yml) format.",
|
||||
action="store_true",
|
||||
)
|
||||
return parser
|
||||
|
||||
group.add_argument(
|
||||
"--seriallog",
|
||||
help="Log device serial output to either 'none' or a filename to append to. Defaults to 'stdout' if no filename specified.",
|
||||
nargs="?",
|
||||
const="stdout",
|
||||
default=None,
|
||||
def addConfigArgs(parser: argparse.ArgumentParser) -> argparse.ArgumentParser:
|
||||
"""Add arguments to do with configuring a device"""
|
||||
|
||||
group = parser.add_argument_group(
|
||||
"Configuration",
|
||||
"Arguments that concern general configuration of Meshtastic devices",
|
||||
)
|
||||
|
||||
group.add_argument(
|
||||
"--info",
|
||||
help="Read and display the radio config information",
|
||||
"--get",
|
||||
help=(
|
||||
"Get a preferences field. Use an invalid field such as '0' to get a list of all fields."
|
||||
" Can use either snake_case or camelCase format. (ex: 'ls_secs' or 'lsSecs')"
|
||||
),
|
||||
nargs=1,
|
||||
action="append",
|
||||
metavar="FIELD"
|
||||
)
|
||||
|
||||
group.add_argument(
|
||||
"--set",
|
||||
help="Set a preferences field. Can use either snake_case or camelCase format. (ex: 'ls_secs' or 'lsSecs')",
|
||||
nargs=2,
|
||||
action="append",
|
||||
metavar=("FIELD", "VALUE"),
|
||||
)
|
||||
|
||||
group.add_argument(
|
||||
"--begin-edit",
|
||||
help="Tell the node to open a transaction to edit settings",
|
||||
action="store_true",
|
||||
)
|
||||
|
||||
group.add_argument(
|
||||
"--commit-edit",
|
||||
help="Tell the node to commit open settings transaction",
|
||||
action="store_true",
|
||||
)
|
||||
|
||||
@@ -1331,16 +1359,119 @@ def initParser():
|
||||
action="store_true",
|
||||
)
|
||||
|
||||
group.add_argument(
|
||||
"--set-canned-message",
|
||||
help="Set the canned messages plugin message (up to 200 characters).",
|
||||
action="store",
|
||||
)
|
||||
|
||||
group.add_argument(
|
||||
"--get-ringtone", help="Show the stored ringtone", action="store_true"
|
||||
)
|
||||
|
||||
group.add_argument(
|
||||
"--nodes",
|
||||
help="Print Node List in a pretty formatted table",
|
||||
"--set-ringtone",
|
||||
help="Set the Notification Ringtone (up to 230 characters).",
|
||||
action="store",
|
||||
metavar="RINGTONE",
|
||||
)
|
||||
|
||||
group.add_argument(
|
||||
"--ch-vlongslow",
|
||||
help="Change to the very long-range and slow modem preset",
|
||||
action="store_true",
|
||||
)
|
||||
|
||||
group.add_argument(
|
||||
"--ch-longslow",
|
||||
help="Change to the long-range and slow modem preset",
|
||||
action="store_true",
|
||||
)
|
||||
|
||||
group.add_argument(
|
||||
"--ch-longfast",
|
||||
help="Change to the long-range and fast modem preset",
|
||||
action="store_true",
|
||||
)
|
||||
|
||||
group.add_argument(
|
||||
"--ch-medslow",
|
||||
help="Change to the med-range and slow modem preset",
|
||||
action="store_true",
|
||||
)
|
||||
|
||||
group.add_argument(
|
||||
"--ch-medfast",
|
||||
help="Change to the med-range and fast modem preset",
|
||||
action="store_true",
|
||||
)
|
||||
|
||||
group.add_argument(
|
||||
"--ch-shortslow",
|
||||
help="Change to the short-range and slow modem preset",
|
||||
action="store_true",
|
||||
)
|
||||
|
||||
group.add_argument(
|
||||
"--ch-shortfast",
|
||||
help="Change to the short-range and fast modem preset",
|
||||
action="store_true",
|
||||
)
|
||||
|
||||
group.add_argument("--set-owner", help="Set device owner name", action="store")
|
||||
|
||||
group.add_argument(
|
||||
"--set-owner-short", help="Set device owner short name", action="store"
|
||||
)
|
||||
|
||||
group.add_argument(
|
||||
"--set-ham", help="Set licensed Ham ID and turn off encryption", action="store"
|
||||
)
|
||||
|
||||
group.add_argument("--seturl", help="Set a channel URL", action="store")
|
||||
|
||||
return parser
|
||||
|
||||
def addChannelConfigArgs(parser: argparse.ArgumentParser) -> argparse.ArgumentParser:
|
||||
"""Add arguments to do with configuring channels"""
|
||||
|
||||
group = parser.add_argument_group(
|
||||
"Channel Configuration",
|
||||
"Arguments that concern configuration of channels",
|
||||
)
|
||||
|
||||
group.add_argument(
|
||||
"--ch-add",
|
||||
help="Add a secondary channel, you must specify a channel name",
|
||||
default=None,
|
||||
)
|
||||
|
||||
group.add_argument(
|
||||
"--ch-del", help="Delete the ch-index channel", action="store_true"
|
||||
)
|
||||
|
||||
group.add_argument(
|
||||
"--ch-set",
|
||||
help=(
|
||||
"Set a channel parameter. To see channel settings available:'--ch-set all all --ch-index 0'. "
|
||||
"Can set the 'psk' using this command. To disable encryption on primary channel:'--ch-set psk none --ch-index 0'. "
|
||||
"To set encryption with a new random key on second channel:'--ch-set psk random --ch-index 1'. "
|
||||
"To set encryption back to the default:'--ch-set psk default --ch-index 0'. To set encryption with your "
|
||||
"own key: '--ch-set psk 0x1a1a1a1a2b2b2b2b1a1a1a1a2b2b2b2b1a1a1a1a2b2b2b2b1a1a1a1a2b2b2b2b --ch-index 0'."
|
||||
),
|
||||
nargs=2,
|
||||
action="append",
|
||||
metavar=("FIELD", "VALUE"),
|
||||
)
|
||||
|
||||
group.add_argument(
|
||||
"--channel-fetch-attempts",
|
||||
help=("Attempt to retrieve channel settings for --ch-set this many times before giving up. Default %(default)s."),
|
||||
default=3,
|
||||
type=int,
|
||||
metavar="ATTEMPTS",
|
||||
)
|
||||
|
||||
group.add_argument(
|
||||
"--qr",
|
||||
help=(
|
||||
@@ -1356,44 +1487,9 @@ def initParser():
|
||||
action="store_true",
|
||||
)
|
||||
|
||||
group.add_argument(
|
||||
"--get",
|
||||
help=(
|
||||
"Get a preferences field. Use an invalid field such as '0' to get a list of all fields."
|
||||
" Can use either snake_case or camelCase format. (ex: 'ls_secs' or 'lsSecs')"
|
||||
),
|
||||
nargs=1,
|
||||
action="append",
|
||||
)
|
||||
|
||||
group.add_argument(
|
||||
"--set",
|
||||
help="Set a preferences field. Can use either snake_case or camelCase format. (ex: 'ls_secs' or 'lsSecs')",
|
||||
nargs=2,
|
||||
action="append",
|
||||
)
|
||||
|
||||
group.add_argument("--seturl", help="Set a channel URL", action="store")
|
||||
|
||||
group.add_argument(
|
||||
"--ch-index",
|
||||
help="Set the specified channel index. Channels start at 0 (0 is the PRIMARY channel).",
|
||||
action="store",
|
||||
)
|
||||
|
||||
group.add_argument(
|
||||
"--ch-add",
|
||||
help="Add a secondary channel, you must specify a channel name",
|
||||
default=None,
|
||||
)
|
||||
|
||||
group.add_argument(
|
||||
"--ch-del", help="Delete the ch-index channel", action="store_true"
|
||||
)
|
||||
|
||||
group.add_argument(
|
||||
"--ch-enable",
|
||||
help="Enable the specified channel",
|
||||
help="Enable the specified channel. Use --ch-add instead whenever possible.",
|
||||
action="store_true",
|
||||
dest="ch_enable",
|
||||
default=False,
|
||||
@@ -1402,231 +1498,21 @@ def initParser():
|
||||
# Note: We are doing a double negative here (Do we want to disable? If ch_disable==True, then disable.)
|
||||
group.add_argument(
|
||||
"--ch-disable",
|
||||
help="Disable the specified channel",
|
||||
help="Disable the specified channel Use --ch-del instead whenever possible.",
|
||||
action="store_true",
|
||||
dest="ch_disable",
|
||||
default=False,
|
||||
)
|
||||
|
||||
group.add_argument(
|
||||
"--ch-set",
|
||||
help=(
|
||||
"Set a channel parameter. To see channel settings available:'--ch-set all all --ch-index 0'. "
|
||||
"Can set the 'psk' using this command. To disable encryption on primary channel:'--ch-set psk none --ch-index 0'. "
|
||||
"To set encryption with a new random key on second channel:'--ch-set psk random --ch-index 1'. "
|
||||
"To set encryption back to the default:'--ch-set psk default --ch-index 0'. To set encryption with your "
|
||||
"own key: '--ch-set psk 0x1a1a1a1a2b2b2b2b1a1a1a1a2b2b2b2b1a1a1a1a2b2b2b2b1a1a1a1a2b2b2b2b --ch-index 0'."
|
||||
),
|
||||
nargs=2,
|
||||
action="append",
|
||||
)
|
||||
return parser
|
||||
|
||||
group.add_argument(
|
||||
"--channel-fetch-attempts",
|
||||
help=("Attempt to retrieve channel settings for --ch-set this many times before giving up."),
|
||||
default=3,
|
||||
type=int,
|
||||
)
|
||||
def addPositionConfigArgs(parser: argparse.ArgumentParser) -> argparse.ArgumentParser:
|
||||
"""Add arguments to do with fixed positions and position config"""
|
||||
|
||||
group.add_argument(
|
||||
"--timeout",
|
||||
help="How long to wait for replies",
|
||||
default=300,
|
||||
type=int,
|
||||
group = parser.add_argument_group(
|
||||
"Position Configuration",
|
||||
"Arguments that modify fixed position and other position-related configuration.",
|
||||
)
|
||||
|
||||
group.add_argument(
|
||||
"--ch-vlongslow",
|
||||
help="Change to the very long-range and slow channel",
|
||||
action="store_true",
|
||||
)
|
||||
|
||||
group.add_argument(
|
||||
"--ch-longslow",
|
||||
help="Change to the long-range and slow channel",
|
||||
action="store_true",
|
||||
)
|
||||
|
||||
group.add_argument(
|
||||
"--ch-longfast",
|
||||
help="Change to the long-range and fast channel",
|
||||
action="store_true",
|
||||
)
|
||||
|
||||
group.add_argument(
|
||||
"--ch-medslow",
|
||||
help="Change to the med-range and slow channel",
|
||||
action="store_true",
|
||||
)
|
||||
|
||||
group.add_argument(
|
||||
"--ch-medfast",
|
||||
help="Change to the med-range and fast channel",
|
||||
action="store_true",
|
||||
)
|
||||
|
||||
group.add_argument(
|
||||
"--ch-shortslow",
|
||||
help="Change to the short-range and slow channel",
|
||||
action="store_true",
|
||||
)
|
||||
|
||||
group.add_argument(
|
||||
"--ch-shortfast",
|
||||
help="Change to the short-range and fast channel",
|
||||
action="store_true",
|
||||
)
|
||||
|
||||
group.add_argument("--set-owner", help="Set device owner name", action="store")
|
||||
|
||||
group.add_argument(
|
||||
"--set-owner-short", help="Set device owner short name", action="store"
|
||||
)
|
||||
|
||||
group.add_argument(
|
||||
"--set-canned-message",
|
||||
help="Set the canned messages plugin message (up to 200 characters).",
|
||||
action="store",
|
||||
)
|
||||
|
||||
group.add_argument(
|
||||
"--set-ringtone",
|
||||
help="Set the Notification Ringtone (up to 230 characters).",
|
||||
action="store",
|
||||
)
|
||||
|
||||
group.add_argument(
|
||||
"--set-ham", help="Set licensed Ham ID and turn off encryption", action="store"
|
||||
)
|
||||
|
||||
group.add_argument(
|
||||
"--dest",
|
||||
help="The destination node id for any sent commands, if not set '^all' or '^local' is assumed as appropriate",
|
||||
default=None,
|
||||
)
|
||||
|
||||
group.add_argument(
|
||||
"--sendtext",
|
||||
help="Send a text message. Can specify a destination '--dest' and/or channel index '--ch-index'.",
|
||||
)
|
||||
|
||||
group.add_argument(
|
||||
"--traceroute",
|
||||
help="Traceroute from connected node to a destination. "
|
||||
"You need pass the destination ID as argument, like "
|
||||
"this: '--traceroute !ba4bf9d0' "
|
||||
"Only nodes that have the encryption key can be traced.",
|
||||
)
|
||||
|
||||
group.add_argument(
|
||||
"--request-telemetry",
|
||||
help="Request telemetry from a node. "
|
||||
"You need to pass the destination ID as argument with '--dest'. "
|
||||
"For repeaters, the nodeNum is required.",
|
||||
action="store_true",
|
||||
)
|
||||
|
||||
group.add_argument(
|
||||
"--request-position",
|
||||
help="Request the position from a node. "
|
||||
"You need to pass the destination ID as an argument with '--dest'. "
|
||||
"For repeaters, the nodeNum is required.",
|
||||
action="store_true",
|
||||
)
|
||||
|
||||
group.add_argument(
|
||||
"--ack",
|
||||
help="Use in combination with --sendtext to wait for an acknowledgment.",
|
||||
action="store_true",
|
||||
)
|
||||
|
||||
group.add_argument(
|
||||
"--reboot", help="Tell the destination node to reboot", action="store_true"
|
||||
)
|
||||
|
||||
group.add_argument(
|
||||
"--reboot-ota",
|
||||
help="Tell the destination node to reboot into factory firmware (ESP32)",
|
||||
action="store_true",
|
||||
)
|
||||
|
||||
group.add_argument(
|
||||
"--enter-dfu",
|
||||
help="Tell the destination node to enter DFU mode (NRF52)",
|
||||
action="store_true",
|
||||
)
|
||||
|
||||
group.add_argument(
|
||||
"--shutdown", help="Tell the destination node to shutdown", action="store_true"
|
||||
)
|
||||
|
||||
group.add_argument(
|
||||
"--device-metadata",
|
||||
help="Get the device metadata from the node",
|
||||
action="store_true",
|
||||
)
|
||||
|
||||
group.add_argument(
|
||||
"--begin-edit",
|
||||
help="Tell the node to open a transaction to edit settings",
|
||||
action="store_true",
|
||||
)
|
||||
|
||||
group.add_argument(
|
||||
"--commit-edit",
|
||||
help="Tell the node to commit open settings transaction",
|
||||
action="store_true",
|
||||
)
|
||||
|
||||
group.add_argument(
|
||||
"--factory-reset", "--factory-reset-config",
|
||||
help="Tell the destination node to install the default config, preserving BLE bonds & PKI keys",
|
||||
action="store_true",
|
||||
)
|
||||
|
||||
group.add_argument(
|
||||
"--factory-reset-device",
|
||||
help="Tell the destination node to install the default config and clear BLE bonds & PKI keys",
|
||||
action="store_true",
|
||||
)
|
||||
|
||||
group.add_argument(
|
||||
"--remove-node",
|
||||
help="Tell the destination node to remove a specific node from its DB, by node number or ID",
|
||||
)
|
||||
group.add_argument(
|
||||
"--reset-nodedb",
|
||||
help="Tell the destination node to clear its list of nodes",
|
||||
action="store_true",
|
||||
)
|
||||
|
||||
group.add_argument(
|
||||
"--set-time",
|
||||
help="Set the time to the provided unix epoch timestamp, or the system's current time if omitted or 0.",
|
||||
action="store",
|
||||
type=int,
|
||||
nargs="?",
|
||||
default=None,
|
||||
const=0,
|
||||
)
|
||||
|
||||
group.add_argument(
|
||||
"--reply", help="Reply to received messages", action="store_true"
|
||||
)
|
||||
|
||||
group.add_argument(
|
||||
"--no-time",
|
||||
help="Deprecated. Retained for backwards compatibility in scripts, but is a no-op.",
|
||||
action="store_true",
|
||||
)
|
||||
|
||||
group.add_argument(
|
||||
"--no-nodes",
|
||||
help="Request that the node not send node info to the client. "
|
||||
"Will break things that depend on the nodedb, but will speed up startup. Requires 2.3.11+ firmware.",
|
||||
action="store_true",
|
||||
)
|
||||
|
||||
group.add_argument(
|
||||
"--setalt",
|
||||
help="Set device altitude in meters (allows use without GPS), and enable fixed position. "
|
||||
@@ -1659,6 +1545,217 @@ def initParser():
|
||||
nargs="*",
|
||||
action="store",
|
||||
)
|
||||
return parser
|
||||
|
||||
def addLocalActionArgs(parser: argparse.ArgumentParser) -> argparse.ArgumentParser:
|
||||
"""Add arguments concerning local-only information & actions"""
|
||||
group = parser.add_argument_group(
|
||||
"Local Actions",
|
||||
"Arguments that take actions or request information from the local node only.",
|
||||
)
|
||||
|
||||
group.add_argument(
|
||||
"--info",
|
||||
help="Read and display the radio config information",
|
||||
action="store_true",
|
||||
)
|
||||
|
||||
group.add_argument(
|
||||
"--nodes",
|
||||
help="Print Node List in a pretty formatted table",
|
||||
action="store_true",
|
||||
)
|
||||
|
||||
return parser
|
||||
|
||||
def addRemoteActionArgs(parser: argparse.ArgumentParser) -> argparse.ArgumentParser:
|
||||
"""Add arguments concerning information & actions that may interact with the mesh"""
|
||||
group = parser.add_argument_group(
|
||||
"Remote Actions",
|
||||
"Arguments that take actions or request information from either the local node or remote nodes via the mesh.",
|
||||
)
|
||||
|
||||
group.add_argument(
|
||||
"--sendtext",
|
||||
help="Send a text message. Can specify a destination '--dest' and/or channel index '--ch-index'.",
|
||||
metavar="TEXT",
|
||||
)
|
||||
|
||||
group.add_argument(
|
||||
"--traceroute",
|
||||
help="Traceroute from connected node to a destination. "
|
||||
"You need pass the destination ID as argument, like "
|
||||
"this: '--traceroute !ba4bf9d0' "
|
||||
"Only nodes with a shared channel can be traced.",
|
||||
metavar="!xxxxxxxx",
|
||||
)
|
||||
|
||||
group.add_argument(
|
||||
"--request-telemetry",
|
||||
help="Request telemetry from a node. "
|
||||
"You need to pass the destination ID as argument with '--dest'. "
|
||||
"For repeaters, the nodeNum is required.",
|
||||
action="store_true",
|
||||
)
|
||||
|
||||
group.add_argument(
|
||||
"--request-position",
|
||||
help="Request the position from a node. "
|
||||
"You need to pass the destination ID as an argument with '--dest'. "
|
||||
"For repeaters, the nodeNum is required.",
|
||||
action="store_true",
|
||||
)
|
||||
|
||||
group.add_argument(
|
||||
"--reply", help="Reply to received messages", action="store_true"
|
||||
)
|
||||
|
||||
return parser
|
||||
|
||||
def addRemoteAdminArgs(parser: argparse.ArgumentParser) -> argparse.ArgumentParser:
|
||||
"""Add arguments concerning admin actions that may interact with the mesh"""
|
||||
|
||||
outer = parser.add_argument_group(
|
||||
"Remote Admin Actions",
|
||||
"Arguments that interact with local node or remote nodes via the mesh, requiring admin access.",
|
||||
)
|
||||
|
||||
group = outer.add_mutually_exclusive_group()
|
||||
|
||||
group.add_argument(
|
||||
"--reboot", help="Tell the destination node to reboot", action="store_true"
|
||||
)
|
||||
|
||||
group.add_argument(
|
||||
"--reboot-ota",
|
||||
help="Tell the destination node to reboot into factory firmware (ESP32)",
|
||||
action="store_true",
|
||||
)
|
||||
|
||||
group.add_argument(
|
||||
"--enter-dfu",
|
||||
help="Tell the destination node to enter DFU mode (NRF52)",
|
||||
action="store_true",
|
||||
)
|
||||
|
||||
group.add_argument(
|
||||
"--shutdown", help="Tell the destination node to shutdown", action="store_true"
|
||||
)
|
||||
|
||||
group.add_argument(
|
||||
"--device-metadata",
|
||||
help="Get the device metadata from the node",
|
||||
action="store_true",
|
||||
)
|
||||
|
||||
group.add_argument(
|
||||
"--factory-reset", "--factory-reset-config",
|
||||
help="Tell the destination node to install the default config, preserving BLE bonds & PKI keys",
|
||||
action="store_true",
|
||||
)
|
||||
|
||||
group.add_argument(
|
||||
"--factory-reset-device",
|
||||
help="Tell the destination node to install the default config and clear BLE bonds & PKI keys",
|
||||
action="store_true",
|
||||
)
|
||||
|
||||
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"
|
||||
)
|
||||
group.add_argument(
|
||||
"--reset-nodedb",
|
||||
help="Tell the destination node to clear its list of nodes",
|
||||
action="store_true",
|
||||
)
|
||||
|
||||
group.add_argument(
|
||||
"--set-time",
|
||||
help="Set the time to the provided unix epoch timestamp, or the system's current time if omitted or 0.",
|
||||
action="store",
|
||||
type=int,
|
||||
nargs="?",
|
||||
default=None,
|
||||
const=0,
|
||||
metavar="TIMESTAMP",
|
||||
)
|
||||
|
||||
return parser
|
||||
|
||||
def initParser():
|
||||
"""Initialize the command line argument parsing."""
|
||||
parser = mt_config.parser
|
||||
args = mt_config.args
|
||||
|
||||
# The "Help" group includes the help option and other informational stuff about the CLI itself
|
||||
outerHelpGroup = parser.add_argument_group("Help")
|
||||
helpGroup = outerHelpGroup.add_mutually_exclusive_group()
|
||||
helpGroup.add_argument(
|
||||
"-h", "--help", action="help", help="show this help message and exit"
|
||||
)
|
||||
|
||||
the_version = get_active_version()
|
||||
helpGroup.add_argument("--version", action="version", version=f"{the_version}")
|
||||
|
||||
helpGroup.add_argument(
|
||||
"--support",
|
||||
action="store_true",
|
||||
help="Show support info (useful when troubleshooting an issue)",
|
||||
)
|
||||
|
||||
# Connection arguments to indicate a device to connect to
|
||||
parser = addConnectionArgs(parser)
|
||||
|
||||
# Selection arguments to denote nodes and channels to use
|
||||
parser = addSelectionArgs(parser)
|
||||
|
||||
# Arguments concerning viewing and setting configuration
|
||||
parser = addImportExportArgs(parser)
|
||||
parser = addConfigArgs(parser)
|
||||
parser = addPositionConfigArgs(parser)
|
||||
parser = addChannelConfigArgs(parser)
|
||||
|
||||
# Arguments for sending or requesting things from the local device
|
||||
parser = addLocalActionArgs(parser)
|
||||
|
||||
# Arguments for sending or requesting things from the mesh
|
||||
parser = addRemoteActionArgs(parser)
|
||||
parser = addRemoteAdminArgs(parser)
|
||||
|
||||
# All the rest of the arguments
|
||||
group = parser.add_argument_group("Miscellaneous arguments")
|
||||
|
||||
group.add_argument(
|
||||
"--seriallog",
|
||||
help="Log device serial output to either 'none' or a filename to append to. Defaults to '%(const)s' if no filename specified.",
|
||||
nargs="?",
|
||||
const="stdout",
|
||||
default=None,
|
||||
metavar="LOG_DESTINATION",
|
||||
)
|
||||
|
||||
group.add_argument(
|
||||
"--ack",
|
||||
help="Use in combination with compatible actions (e.g. --sendtext) to wait for an acknowledgment.",
|
||||
action="store_true",
|
||||
)
|
||||
|
||||
group.add_argument(
|
||||
"--timeout",
|
||||
help="How long to wait for replies. Default %(default)ss.",
|
||||
default=300,
|
||||
type=int,
|
||||
metavar="SECONDS",
|
||||
)
|
||||
|
||||
group.add_argument(
|
||||
"--no-nodes",
|
||||
help="Request that the node not send node info to the client. "
|
||||
"Will break things that depend on the nodedb, but will speed up startup. Requires 2.3.11+ firmware.",
|
||||
action="store_true",
|
||||
)
|
||||
|
||||
group.add_argument(
|
||||
"--debug", help="Show API library debug log messages", action="store_true"
|
||||
@@ -1670,6 +1767,33 @@ def initParser():
|
||||
action="store_true",
|
||||
)
|
||||
|
||||
group.add_argument(
|
||||
"--wait-to-disconnect",
|
||||
help="How many seconds to wait before disconnecting from the device.",
|
||||
const="5",
|
||||
nargs="?",
|
||||
action="store",
|
||||
metavar="SECONDS",
|
||||
)
|
||||
|
||||
group.add_argument(
|
||||
"--noproto",
|
||||
help="Don't start the API, just function as a dumb serial terminal.",
|
||||
action="store_true",
|
||||
)
|
||||
|
||||
group.add_argument(
|
||||
"--listen",
|
||||
help="Just stay open and listen to the protobuf stream. Enables debug logging.",
|
||||
action="store_true",
|
||||
)
|
||||
|
||||
group.add_argument(
|
||||
"--no-time",
|
||||
help="Deprecated. Retained for backwards compatibility in scripts, but is a no-op.",
|
||||
action="store_true",
|
||||
)
|
||||
|
||||
power_group = parser.add_argument_group(
|
||||
"Power Testing", "Options for power testing/logging."
|
||||
)
|
||||
@@ -1724,31 +1848,6 @@ def initParser():
|
||||
const="default",
|
||||
)
|
||||
|
||||
group.add_argument(
|
||||
"--ble-scan",
|
||||
help="Scan for Meshtastic BLE devices",
|
||||
action="store_true",
|
||||
)
|
||||
|
||||
group.add_argument(
|
||||
"--wait-to-disconnect",
|
||||
help="How many seconds to wait before disconnecting from the device.",
|
||||
const="5",
|
||||
nargs="?",
|
||||
action="store",
|
||||
)
|
||||
|
||||
group.add_argument(
|
||||
"--noproto",
|
||||
help="Don't start the API, just function as a dumb serial terminal.",
|
||||
action="store_true",
|
||||
)
|
||||
|
||||
group.add_argument(
|
||||
"--listen",
|
||||
help="Just stay open and listen to the protobuf stream. Enables debug logging.",
|
||||
action="store_true",
|
||||
)
|
||||
|
||||
remoteHardwareArgs = parser.add_argument_group(
|
||||
"Remote Hardware", "Arguments related to the Remote Hardware module"
|
||||
|
||||
@@ -914,6 +914,8 @@ class MeshInterface: # pylint: disable=R0902
|
||||
startConfig = mesh_pb2.ToRadio()
|
||||
if self.configId is None or not self.noNodes:
|
||||
self.configId = random.randint(0, 0xFFFFFFFF)
|
||||
if self.configId == NODELESS_WANT_CONFIG_ID:
|
||||
self.configId = self.configId + 1
|
||||
startConfig.want_config_id = self.configId
|
||||
self._sendToRadio(startConfig)
|
||||
|
||||
|
||||
12
meshtastic/protobuf/mesh_pb2.py
generated
12
meshtastic/protobuf/mesh_pb2.py
generated
File diff suppressed because one or more lines are too long
24
meshtastic/protobuf/mesh_pb2.pyi
generated
24
meshtastic/protobuf/mesh_pb2.pyi
generated
@@ -129,6 +129,10 @@ class _HardwareModelEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._
|
||||
"""
|
||||
Heltec HRU-3601: https://heltec.org/project/hru-3601/
|
||||
"""
|
||||
HELTEC_WIRELESS_BRIDGE: _HardwareModel.ValueType # 24
|
||||
"""
|
||||
Heltec Wireless Bridge
|
||||
"""
|
||||
STATION_G1: _HardwareModel.ValueType # 25
|
||||
"""
|
||||
B&Q Consulting Station Edition G1: https://uniteng.com/wiki/doku.php?id=meshtastic:station
|
||||
@@ -201,7 +205,7 @@ class _HardwareModelEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._
|
||||
"""
|
||||
M5STACK: _HardwareModel.ValueType # 42
|
||||
"""
|
||||
M5 esp32 based MCU modules with enclosure, TFT and LORA Shields. All Variants (Basic, Core, Fire, Core2, Paper) https://m5stack.com/
|
||||
M5 esp32 based MCU modules with enclosure, TFT and LORA Shields. All Variants (Basic, Core, Fire, Core2, CoreS3, Paper) https://m5stack.com/
|
||||
"""
|
||||
HELTEC_V3: _HardwareModel.ValueType # 43
|
||||
"""
|
||||
@@ -359,8 +363,12 @@ class _HardwareModelEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._
|
||||
^^^ short A0 to switch to I2C address 0x3C
|
||||
"""
|
||||
M5STACK_COREBASIC: _HardwareModel.ValueType # 77
|
||||
"""M5 esp32 based MCU modules with enclosure, TFT and LORA Shields. All Variants (Basic, Core, Fire, Core2, Paper) https://m5stack.com/"""
|
||||
"""M5 esp32 based MCU modules with enclosure, TFT and LORA Shields. All Variants (Basic, Core, Fire, Core2, CoreS3, Paper) https://m5stack.com/"""
|
||||
M5STACK_CORE2: _HardwareModel.ValueType # 78
|
||||
RPI_PICO2: _HardwareModel.ValueType # 79
|
||||
"""Pico2 with Waveshare Hat, same as Pico"""
|
||||
M5STACK_CORES3: _HardwareModel.ValueType # 80
|
||||
"""M5 esp32 based MCU modules with enclosure, TFT and LORA Shields. All Variants (Basic, Core, Fire, Core2, CoreS3, Paper) https://m5stack.com/"""
|
||||
PRIVATE_HW: _HardwareModel.ValueType # 255
|
||||
"""
|
||||
------------------------------------------------------------------------------------------------------------------------------------------
|
||||
@@ -474,6 +482,10 @@ HELTEC_HRU_3601: HardwareModel.ValueType # 23
|
||||
"""
|
||||
Heltec HRU-3601: https://heltec.org/project/hru-3601/
|
||||
"""
|
||||
HELTEC_WIRELESS_BRIDGE: HardwareModel.ValueType # 24
|
||||
"""
|
||||
Heltec Wireless Bridge
|
||||
"""
|
||||
STATION_G1: HardwareModel.ValueType # 25
|
||||
"""
|
||||
B&Q Consulting Station Edition G1: https://uniteng.com/wiki/doku.php?id=meshtastic:station
|
||||
@@ -546,7 +558,7 @@ Custom Disaster Radio esp32 v3 device https://github.com/sudomesh/disaster-radio
|
||||
"""
|
||||
M5STACK: HardwareModel.ValueType # 42
|
||||
"""
|
||||
M5 esp32 based MCU modules with enclosure, TFT and LORA Shields. All Variants (Basic, Core, Fire, Core2, Paper) https://m5stack.com/
|
||||
M5 esp32 based MCU modules with enclosure, TFT and LORA Shields. All Variants (Basic, Core, Fire, Core2, CoreS3, Paper) https://m5stack.com/
|
||||
"""
|
||||
HELTEC_V3: HardwareModel.ValueType # 43
|
||||
"""
|
||||
@@ -704,8 +716,12 @@ https://www.adafruit.com/product/938
|
||||
^^^ short A0 to switch to I2C address 0x3C
|
||||
"""
|
||||
M5STACK_COREBASIC: HardwareModel.ValueType # 77
|
||||
"""M5 esp32 based MCU modules with enclosure, TFT and LORA Shields. All Variants (Basic, Core, Fire, Core2, Paper) https://m5stack.com/"""
|
||||
"""M5 esp32 based MCU modules with enclosure, TFT and LORA Shields. All Variants (Basic, Core, Fire, Core2, CoreS3, Paper) https://m5stack.com/"""
|
||||
M5STACK_CORE2: HardwareModel.ValueType # 78
|
||||
RPI_PICO2: HardwareModel.ValueType # 79
|
||||
"""Pico2 with Waveshare Hat, same as Pico"""
|
||||
M5STACK_CORES3: HardwareModel.ValueType # 80
|
||||
"""M5 esp32 based MCU modules with enclosure, TFT and LORA Shields. All Variants (Basic, Core, Fire, Core2, CoreS3, Paper) https://m5stack.com/"""
|
||||
PRIVATE_HW: HardwareModel.ValueType # 255
|
||||
"""
|
||||
------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
Submodule protobufs updated: 5709c0a05e...9651aa59ea
@@ -1,6 +1,6 @@
|
||||
[tool.poetry]
|
||||
name = "meshtastic"
|
||||
version = "2.5.1"
|
||||
version = "2.5.2"
|
||||
description = "Python API & client shell for talking to Meshtastic devices"
|
||||
authors = ["Meshtastic Developers <contact@meshtastic.org>"]
|
||||
license = "GPL-3.0-only"
|
||||
|
||||
Reference in New Issue
Block a user