meshcore-cli 1.6.5__tar.gz → 1.6.7__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: meshcore-cli
3
- Version: 1.6.5
3
+ Version: 1.6.7
4
4
  Summary: Command line interface to meshcore companion radios and repeaters
5
5
  Project-URL: Homepage, https://github.com/fdlamotte/meshcore-cli
6
6
  Project-URL: Issues, https://github.com/fdlamotte/meshcore-cli/issues
@@ -11,7 +11,7 @@ Classifier: Operating System :: OS Independent
11
11
  Classifier: Programming Language :: Python :: 3
12
12
  Requires-Python: >=3.10
13
13
  Requires-Dist: bleak>=0.22
14
- Requires-Dist: meshcore>=2.3.15
14
+ Requires-Dist: meshcore>=2.3.16
15
15
  Requires-Dist: prompt-toolkit>=3.0.50
16
16
  Requires-Dist: requests>=2.28.0
17
17
  Description-Content-Type: text/markdown
@@ -17,12 +17,12 @@
17
17
 
18
18
  meshcore = python3Packages.buildPythonPackage rec {
19
19
  pname = "meshcore";
20
- version = "2.3.15";
20
+ version = "2.3.16";
21
21
  pyproject = true;
22
22
 
23
23
  src = python3Packages.fetchPypi {
24
24
  inherit pname version;
25
- sha256 = "sha256-YIR8IdclmhOmi4kAgpYiO0N8Odauwten370gjYQ50FA=";
25
+ sha256 = "sha256-HU3D2oJKwtecMJHv7zGUjIuuk+hPfRBZQTMaSNamR9A=";
26
26
  };
27
27
 
28
28
  build-system = [ python3Packages.hatchling ];
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "meshcore-cli"
7
- version = "1.6.5"
7
+ version = "1.6.7"
8
8
  authors = [
9
9
  { name="Florent de Lamotte", email="florent@frizoncorrea.fr" },
10
10
  ]
@@ -17,7 +17,7 @@ classifiers = [
17
17
  ]
18
18
  license = "MIT"
19
19
  license-files = ["LICEN[CS]E*"]
20
- dependencies = [ "meshcore >= 2.3.15",
20
+ dependencies = [ "meshcore >= 2.3.16",
21
21
  "bleak >= 0.22",
22
22
  "prompt_toolkit >= 3.0.50",
23
23
  "requests >= 2.28.0" ]
@@ -35,7 +35,7 @@ except ImportError:
35
35
  from meshcore import MeshCore, EventType, logger
36
36
 
37
37
  # Version
38
- VERSION = "v1.6.5"
38
+ VERSION = "v1.6.7"
39
39
 
40
40
  # default ble address is stored in a config file
41
41
  MCCLI_CONFIG_DIR = os.path.expanduser("~/.config/meshcore/")
@@ -653,7 +653,7 @@ class MyNestedCompleter(NestedCompleter):
653
653
  opts = self.options.keys()
654
654
  completer = WordCompleter(
655
655
  opts, ignore_case=self.ignore_case,
656
- pattern=re.compile(r"([a-zA-Z0-9_\\/\#\?@]+|[^a-zA-Z0-9_\s\#\?@]+)"))
656
+ pattern=re.compile(r"([a-zA-Z0-9_\\/\#\?@\.]+|[^a-zA-Z0-9_\s\#\?@\.]+)"))
657
657
  yield from completer.get_completions(document, complete_event)
658
658
  else: # normal behavior for remainder
659
659
  yield from super().get_completions(document, complete_event)
@@ -767,6 +767,7 @@ def make_completion_dict(contacts, pending=None, to=None, channels=None):
767
767
  "pin" : None,
768
768
  "radio" : {",,,":None, "f,bw,sf,cr":None},
769
769
  "tx" : None,
770
+ "freq": None,
770
771
  "tuning" : {",", "af,tx_d"},
771
772
  "lat" : None,
772
773
  "lon" : None,
@@ -801,6 +802,26 @@ def make_completion_dict(contacts, pending=None, to=None, channels=None):
801
802
  "path_hash_mode":{"0":None, "1":None, "2":None},
802
803
  "path.hash.mode":{"0":None, "1":None, "2":None},
803
804
  "default_scope": None,
805
+ "tz.offset": None,
806
+ "radio.rxgain": None,
807
+ "radio.fem.rxgain": None,
808
+ "radio.fem.txgain": None,
809
+ "dutycycle": None,
810
+ "int.thresh": None,
811
+ "cad": None,
812
+ "agc.reset.interval": None,
813
+ "multi.acks": None,
814
+ "pin": None,
815
+ "wifi.status": None,
816
+ "wifi.ssid": None,
817
+ "wifi.pwd": None,
818
+ "ui.show_clock": None,
819
+ "ui.auto_off_delay": None,
820
+ "ui.backlight_delay": None,
821
+ "ui.backlight_on_keys": None,
822
+ "ui.backlight_on_msgs": None,
823
+ "ui.auto_off_blank": None,
824
+ "ui.max_partial": None,
804
825
  },
805
826
  "get" : {"name":None,
806
827
  "bat":None,
@@ -847,6 +868,26 @@ def make_completion_dict(contacts, pending=None, to=None, channels=None):
847
868
  "path_hash_mode":None,
848
869
  "path.hash.mode":None,
849
870
  "default_scope":None,
871
+ "tz.offset": None,
872
+ "radio.rxgain": None,
873
+ "radio.fem.rxgain": None,
874
+ "radio.fem.txgain": None,
875
+ "dutycycle": None,
876
+ "int.thresh": None,
877
+ "cad": None,
878
+ "agc.reset.interval": None,
879
+ "multi.acks": None,
880
+ "pin": None,
881
+ "wifi.status": None,
882
+ "wifi.ssid": None,
883
+ "wifi.pwd": None,
884
+ "ui.show_clock": None,
885
+ "ui.auto_off_delay": None,
886
+ "ui.backlight_delay": None,
887
+ "ui.backlight_on_keys": None,
888
+ "ui.backlight_on_msgs": None,
889
+ "ui.auto_off_blank": None,
890
+ "ui.max_partial": None,
850
891
  },
851
892
  "?get":None,
852
893
  "?set":None,
@@ -2767,7 +2808,8 @@ async def next_cmd(mc, cmds, json_output=False, sink=sys.stdout, end="\n"):
2767
2808
  vname = cmds[1]
2768
2809
  res = await mc.commands.set_custom_var(vname, cmds[2])
2769
2810
  if res.type == EventType.ERROR:
2770
- output_str += f"Error : {res}{end}"
2811
+ logger.debug(f"No config found by that {res}, trying to exec line as cli")
2812
+ return (None, output_str)
2771
2813
  elif json_output :
2772
2814
  output_str += json.dumps({"result" : "set", "var" : vname, "value" : cmds[2]})+end
2773
2815
  else :
@@ -3084,10 +3126,8 @@ async def next_cmd(mc, cmds, json_output=False, sink=sys.stdout, end="\n"):
3084
3126
  vname = cmds[1]
3085
3127
  val = res.payload[vname]
3086
3128
  except KeyError:
3087
- if json_output :
3088
- output_str += json.dumps({"error" : "Unknown var", "var" : cmds[1]})+end
3089
- else :
3090
- output_str += f"Unknown var {cmds[1]}{end}"
3129
+ logger.debug(f"No config found by that name, trying to exec line as cli")
3130
+ return (None, output_str)
3091
3131
  else:
3092
3132
  if json_output :
3093
3133
  output_str += json.dumps({"var" : vname, "value" : val})+end
@@ -3244,11 +3284,30 @@ async def next_cmd(mc, cmds, json_output=False, sink=sys.stdout, end="\n"):
3244
3284
  output_str += json.dumps(res.payload, indent=4)+end
3245
3285
 
3246
3286
  case "chan_data" :
3247
- argnum = 3 # chan/datatype/payload (path will be an option -p...)
3248
- if cmds[1].isnumeric() :
3249
- nb = int(cmds[1])
3287
+ argnum = 3 # [-p path:hash_mode] chan datatype payload
3288
+ path_hash_mode = 0
3289
+ path = None
3290
+
3291
+ args = cmds[1:]
3292
+ while len(args) > 0 and args[0][0] == "-":
3293
+ arg = args[0]
3294
+
3295
+ if arg.startswith("-p"): # path comes as hex string with mode after `:`
3296
+ path_str = arg[2:]
3297
+ if ":" in path_str:
3298
+ path_hash_mode = int(path_str.split(":")[1])
3299
+ if path_str.split(":")[0] == "0": # 0-hop message
3300
+ path = bytes([])
3301
+ else:
3302
+ path = bytes.fromhex(path_str.split(":")[0])
3303
+
3304
+ argnum += 1
3305
+ args = args[1:] # next argument
3306
+
3307
+ if args[0].isnumeric() :
3308
+ nb = int(args[0])
3250
3309
  else:
3251
- chan = await get_channel_by_name(mc, cmds[1])
3310
+ chan = await get_channel_by_name(mc, args[0])
3252
3311
  if chan is None:
3253
3312
  nb = None
3254
3313
  else:
@@ -3257,7 +3316,8 @@ async def next_cmd(mc, cmds, json_output=False, sink=sys.stdout, end="\n"):
3257
3316
  logger.error("Invalid channel")
3258
3317
  else:
3259
3318
  res = await mc.commands.send_channel_data(
3260
- nb, int(cmds[2]), bytes.fromhex(cmds[3]))
3319
+ nb, int(args[1],0), bytes.fromhex(args[2]),
3320
+ path = path, path_hash_mode = path_hash_mode)
3261
3321
  logger.debug(res)
3262
3322
  if res.type == EventType.ERROR:
3263
3323
  output_str += f"Error sending chan data: {res}{end}"
@@ -3439,32 +3499,41 @@ async def next_cmd(mc, cmds, json_output=False, sink=sys.stdout, end="\n"):
3439
3499
  output_str += f"Path for {contact['adv_name']}: out {outp}, in {inp}{end}"
3440
3500
 
3441
3501
  case "node_discover"|"nd" :
3442
- argnum = 1
3502
+ argnum = 0
3503
+ types = 0xFF
3443
3504
  prefix_only = True
3505
+ filter_args = False
3444
3506
 
3445
- if len(cmds) == 1:
3446
- argnum = 0
3447
- types = 0xFF
3448
- else:
3449
- try: # try to decode type as int
3450
- types = int(cmds[1])
3451
- except ValueError:
3452
- if "all" in cmds[1]:
3453
- types = 0xFF
3454
- else :
3455
- types = 0
3456
- if "rep" in cmds[1] or "rpt" in cmds[1]:
3457
- types = types | 4
3458
- if "cli" in cmds[1] or "comp" in cmds[1]:
3459
- types = types | 2
3460
- if "room" in cmds[1]:
3461
- types = types | 8
3462
- if "sens" in cmds[1]:
3463
- types = types | 16
3464
-
3465
- if "full" in cmds[1]:
3507
+ args = cmds[1:]
3508
+ while len(args) > 0 and args[0][0] == "-": # Breaking change ...
3509
+
3510
+ if args[0].startswith('-f'): # -f or -full
3466
3511
  prefix_only = False
3467
3512
 
3513
+ if args[0].startswith('-t'): # same as before but with -t
3514
+ arg = args[0][2:]
3515
+ if not filter_args:
3516
+ filter_args = True
3517
+ types = 0
3518
+
3519
+ try: # try to decode type as int
3520
+ types = int(arg)
3521
+ except ValueError:
3522
+ if "all" in arg:
3523
+ types = 0xFF
3524
+ else :
3525
+ if "rep" in arg or "rpt" in arg:
3526
+ types = types | 4
3527
+ if "cli" in arg or "comp" in arg:
3528
+ types = types | 2
3529
+ if "room" in arg:
3530
+ types = types | 8
3531
+ if "sens" in arg:
3532
+ types = types | 16
3533
+
3534
+ argnum += 1
3535
+ args = args[1:]
3536
+
3468
3537
  res = await mc.commands.send_node_discover_req(types, prefix_only=prefix_only)
3469
3538
  if res is None or res.type == EventType.ERROR:
3470
3539
  output_str += "Error sending discover request" + end
@@ -4636,15 +4705,18 @@ def get_help_for (cmdname, context="line") :
4636
4705
  """)
4637
4706
 
4638
4707
  elif cmdname == "node_discover" or cmdname == "nd" :
4639
- print("""node_discover <filter> : discovers 0-hop nodes and displays signal info
4708
+ print("""node_discover [-t<filter>] [-f] : discovers 0-hop nodes and displays signal info
4640
4709
 
4641
- filter can be "all" for all types or nodes or a comma separated list consisting of :
4710
+ `-t` asks for nodes regarding filter.
4711
+ filter can be an integer value or "all" for all types or nodes or a comma separated list consisting of :
4642
4712
  - cli or comp for companions
4643
4713
  - rep for repeaters
4644
4714
  - sens for sensors
4645
4715
  - room for chat rooms
4646
4716
 
4647
- nd can be used with no filter parameter ... !!! BEWARE WITH CHAINING !!!
4717
+ `-f` or `-full`: will ask for the full key of the node
4718
+
4719
+ BEWARE: filter option have changed since v1.6.4, using -t is now mandatory !!!
4648
4720
  """)
4649
4721
 
4650
4722
  elif cmdname == "get" :
File without changes
File without changes
File without changes
File without changes