diff --git a/meshtastic/__main__.py b/meshtastic/__main__.py index a494e02..96d8b83 100644 --- a/meshtastic/__main__.py +++ b/meshtastic/__main__.py @@ -339,7 +339,7 @@ def onConnected(interface): # can include lat/long/alt etc: latitude = 37.5, longitude = -122.1 interface.getNode(args.dest, False, **getNode_kwargs).setFixedPosition(lat, lon, alt) - if args.set_owner or args.set_owner_short or args.set_is_unmessageable or args.set_is_unmessagable: + if args.set_owner or args.set_owner_short or args.set_is_unmessageable: closeNow = True waitForAckNak = True @@ -360,22 +360,20 @@ def onConnected(interface): print(f"Setting device owner to {args.set_owner}") elif args.set_owner_short and not args.set_owner: print(f"Setting device owner short to {args.set_owner_short}") - unmessageable = ( - args.set_is_unmessageable - if args.set_is_unmessageable is not None - else args.set_is_unmessagable - ) - set_is_unmessagable = ( - meshtastic.util.fromStr(unmessageable) - if isinstance(unmessageable, str) - else unmessageable - ) - if set_is_unmessagable is not None: - print(f"Setting device owner is_unmessageable to {set_is_unmessagable}") - interface.getNode( - args.dest, False, **getNode_kwargs).setOwner(long_name=args.set_owner, - short_name=args.set_owner_short, is_unmessagable=set_is_unmessagable - ) + + if args.set_is_unmessageable: + unmessagable = ( + meshtastic.util.fromStr(args.set_is_unmessageable) + if isinstance(args.set_is_unmessageable, str) + else args.set_is_unmessageable + ) + + if unmessagable is not None: + print(f"Setting device owner is_unmessageable to {unmessagable}") + interface.getNode( + args.dest, False, **getNode_kwargs).setOwner(long_name=args.set_owner, + short_name=args.set_owner_short, is_unmessagable=unmessagable + ) # TODO: add to export-config and configure if args.set_canned_message: @@ -1599,7 +1597,8 @@ def addConfigArgs(parser: argparse.ArgumentParser) -> argparse.ArgumentParser: ) group.add_argument( - "--set-is-unmessageable", "--set-is-unmessagable", help="Set if a node is messageable or not", action="store" + "--set-is-unmessageable", "--set-is-unmessagable", + help="Set if a node is messageable or not", action="store" ) group.add_argument( diff --git a/nanopb b/nanopb new file mode 160000 index 0000000..4380dd9 --- /dev/null +++ b/nanopb @@ -0,0 +1 @@ +Subproject commit 4380dd9e947e6f40e1f31f9eaeda7994ac1872ae