Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions meshtastic/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,16 @@ def onConnected(interface):
waitForAckNak = True
interface.getNode(args.dest, False, **getNode_kwargs).removeIgnored(args.remove_ignored_node)

if args.set_muted_node:
closeNow = True
waitForAckNak = True
interface.getNode(args.dest, False, **getNode_kwargs).setMuted(args.set_muted_node)

if args.remove_muted_node:
closeNow = True
waitForAckNak = True
interface.getNode(args.dest, False, **getNode_kwargs).removeMuted(args.remove_muted_node)

if args.reset_nodedb:
closeNow = True
waitForAckNak = True
Expand Down Expand Up @@ -1949,6 +1959,18 @@ def addRemoteAdminArgs(parser: argparse.ArgumentParser) -> argparse.ArgumentPars
"Use the node ID with a '!' or '0x' prefix or the node number.",
metavar="!xxxxxxxx"
)
group.add_argument(
"--set-muted-node",
help="Tell the destination node to set the specified node to be muted on the NodeDB. "
"Use the node ID with a '!' or '0x' prefix or the node number.",
metavar="!xxxxxxxx"
)
group.add_argument(
"--remove-muted-node",
help="Tell the destination node to set the specified node to be un-muted on the NodeDB. "
"Use the node ID with a '!' or '0x' prefix or the node number.",
metavar="!xxxxxxxx"
)
group.add_argument(
"--reset-nodedb",
help="Tell the destination node to clear its list of nodes",
Expand Down
36 changes: 36 additions & 0 deletions meshtastic/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -800,6 +800,42 @@ def removeIgnored(self, nodeId: Union[int, str]):
onResponse = self.onAckNak
return self._sendAdmin(p, onResponse=onResponse)

def setMuted(self, nodeId: Union[int, str]):
"""Tell the node to set the specified node ID to be muted on the NodeDB on the device"""
self.ensureSessionKey()
if isinstance(nodeId, str):
if nodeId.startswith("!"):
nodeId = int(nodeId[1:], 16)
else:
nodeId = int(nodeId)

p = admin_pb2.AdminMessage()
p.set_muted_node = nodeId

if self == self.iface.localNode:
onResponse = None
else:
onResponse = self.onAckNak
return self._sendAdmin(p, onResponse=onResponse)

def removeMuted(self, nodeId: Union[int, str]):
"""Tell the node to set the specified node ID to be un-muted on the NodeDB on the device"""
self.ensureSessionKey()
if isinstance(nodeId, str):
if nodeId.startswith("!"):
nodeId = int(nodeId[1:], 16)
else:
nodeId = int(nodeId)

p = admin_pb2.AdminMessage()
p.remove_muted_node = nodeId

if self == self.iface.localNode:
onResponse = None
else:
onResponse = self.onAckNak
return self._sendAdmin(p, onResponse=onResponse)

def resetNodeDb(self):
"""Tell the node to reset its list of nodes."""
self.ensureSessionKey()
Expand Down
57 changes: 34 additions & 23 deletions meshtastic/protobuf/admin_pb2.py

Large diffs are not rendered by default.

18 changes: 15 additions & 3 deletions meshtastic/protobuf/admin_pb2.pyi

Large diffs are not rendered by default.

17 changes: 14 additions & 3 deletions meshtastic/protobuf/apponly_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 14 additions & 3 deletions meshtastic/protobuf/atak_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 14 additions & 3 deletions meshtastic/protobuf/cannedmessages_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 24 additions & 13 deletions meshtastic/protobuf/channel_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion meshtastic/protobuf/channel_pb2.pyi

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 14 additions & 3 deletions meshtastic/protobuf/clientonly_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading