meshcore-cli 0.8.0.dev6__tar.gz → 0.8.1__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.
- {meshcore_cli-0.8.0.dev6 → meshcore_cli-0.8.1}/PKG-INFO +1 -1
- {meshcore_cli-0.8.0.dev6 → meshcore_cli-0.8.1}/pyproject.toml +1 -1
- {meshcore_cli-0.8.0.dev6 → meshcore_cli-0.8.1}/src/meshcore_cli/meshcore_cli.py +29 -5
- {meshcore_cli-0.8.0.dev6 → meshcore_cli-0.8.1}/.gitignore +0 -0
- {meshcore_cli-0.8.0.dev6 → meshcore_cli-0.8.1}/LICENSE +0 -0
- {meshcore_cli-0.8.0.dev6 → meshcore_cli-0.8.1}/README.md +0 -0
- {meshcore_cli-0.8.0.dev6 → meshcore_cli-0.8.1}/src/meshcore_cli/__init__.py +0 -0
- {meshcore_cli-0.8.0.dev6 → meshcore_cli-0.8.1}/src/meshcore_cli/__main__.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: meshcore-cli
|
|
3
|
-
Version: 0.8.
|
|
3
|
+
Version: 0.8.1
|
|
4
4
|
Summary: Command line interface to meshcore companion radios
|
|
5
5
|
Project-URL: Homepage, https://github.com/fdlamotte/meshcore-cli
|
|
6
6
|
Project-URL: Issues, https://github.com/fdlamotte/meshcore-cli/issues
|
|
@@ -22,7 +22,7 @@ from meshcore import TCPConnection, BLEConnection, SerialConnection
|
|
|
22
22
|
from meshcore import MeshCore, EventType, logger
|
|
23
23
|
|
|
24
24
|
# Version
|
|
25
|
-
VERSION = "v0.8.
|
|
25
|
+
VERSION = "v0.8.1"
|
|
26
26
|
|
|
27
27
|
# default ble address is stored in a config file
|
|
28
28
|
MCCLI_CONFIG_DIR = str(Path.home()) + "/.config/meshcore/"
|
|
@@ -278,8 +278,11 @@ def make_completion_dict(contacts, to=None):
|
|
|
278
278
|
"manual_add_contacts":None,
|
|
279
279
|
"telemetry_mode_base":None,
|
|
280
280
|
"telemetry_mode_loc":None,
|
|
281
|
+
"custom":None
|
|
281
282
|
},
|
|
282
283
|
})
|
|
284
|
+
completion_list["set"].update(make_completion_dict.custom_vars)
|
|
285
|
+
completion_list["get"].update(make_completion_dict.custom_vars)
|
|
283
286
|
else :
|
|
284
287
|
completion_list.update({
|
|
285
288
|
"send" : None,
|
|
@@ -357,6 +360,7 @@ def make_completion_dict(contacts, to=None):
|
|
|
357
360
|
})
|
|
358
361
|
|
|
359
362
|
return completion_list
|
|
363
|
+
make_completion_dict.custom_vars = {}
|
|
360
364
|
|
|
361
365
|
async def interactive_loop(mc, to=None) :
|
|
362
366
|
print("""Interactive mode, most commands from terminal chat should work.
|
|
@@ -389,6 +393,12 @@ Line starting with \"$\" or \".\" will issue a meshcli command.
|
|
|
389
393
|
|
|
390
394
|
bindings = KeyBindings()
|
|
391
395
|
|
|
396
|
+
res = await mc.commands.get_custom_vars()
|
|
397
|
+
cv = []
|
|
398
|
+
if res.type != EventType.ERROR :
|
|
399
|
+
cv = list(res.payload.keys())
|
|
400
|
+
make_completion_dict.custom_vars = {k:None for k in cv}
|
|
401
|
+
|
|
392
402
|
# Add our own key binding.
|
|
393
403
|
@bindings.add("escape")
|
|
394
404
|
def _(event):
|
|
@@ -863,7 +873,9 @@ async def next_cmd(mc, cmds, json_output=False):
|
|
|
863
873
|
lon : longitude
|
|
864
874
|
radio : radio parameters
|
|
865
875
|
tx : tx power
|
|
866
|
-
print_snr : snr display in messages
|
|
876
|
+
print_snr : snr display in messages
|
|
877
|
+
custom : all custom variables in json format
|
|
878
|
+
each custom var can also be get/set directly""")
|
|
867
879
|
case "print_name":
|
|
868
880
|
if json_output :
|
|
869
881
|
print(json.dumps({"print_name" : interactive_loop.print_name}))
|
|
@@ -956,6 +968,16 @@ async def next_cmd(mc, cmds, json_output=False):
|
|
|
956
968
|
print(json.dumps({"telemetry_mode_loc" : mc.self_info["telemetry_mode_loc"]}))
|
|
957
969
|
else :
|
|
958
970
|
print(f"telemetry_mode_loc: {mc.self_info['telemetry_mode_loc']}")
|
|
971
|
+
case "custom" :
|
|
972
|
+
res = await mc.commands.get_custom_vars()
|
|
973
|
+
logger.debug(res)
|
|
974
|
+
if res.type == EventType.ERROR :
|
|
975
|
+
if json_output :
|
|
976
|
+
print(json.dumps(res))
|
|
977
|
+
else :
|
|
978
|
+
logger.error("Couldn't get custom variables")
|
|
979
|
+
else :
|
|
980
|
+
print(json.dumps(res.payload, indent=4))
|
|
959
981
|
case _ :
|
|
960
982
|
res = await mc.commands.get_custom_vars()
|
|
961
983
|
logger.debug(res)
|
|
@@ -963,7 +985,7 @@ async def next_cmd(mc, cmds, json_output=False):
|
|
|
963
985
|
if json_output :
|
|
964
986
|
print(json.dumps(res))
|
|
965
987
|
else :
|
|
966
|
-
|
|
988
|
+
logger.error(f"Couldn't get custom variables")
|
|
967
989
|
else :
|
|
968
990
|
try:
|
|
969
991
|
if cmds[1].startswith("_"):
|
|
@@ -1520,9 +1542,11 @@ def command_help():
|
|
|
1520
1542
|
contacts / list : gets contact list lc
|
|
1521
1543
|
share_contact <ct> : share a contact with others sc
|
|
1522
1544
|
export_contact <ct> : get a contact's URI ec
|
|
1545
|
+
import_contact <URI> : import a contactt from its URI ic
|
|
1523
1546
|
remove_contact <ct> : removes a contact from this node
|
|
1524
1547
|
reset_path <ct> : resets path to a contact to flood rp
|
|
1525
1548
|
change_path <ct> <pth> : change the path to a contact cp
|
|
1549
|
+
req_telemetry <ct> : prints telemetry data as json rt
|
|
1526
1550
|
Repeaters
|
|
1527
1551
|
login <name> <pwd> : log into a node (rep) with given pwd l
|
|
1528
1552
|
logout <name> : log out of a repeater
|
|
@@ -1603,14 +1627,14 @@ async def main(argv):
|
|
|
1603
1627
|
if len(devices) == 0:
|
|
1604
1628
|
logger.error("No ble device found")
|
|
1605
1629
|
for d in devices :
|
|
1606
|
-
if d.name.startswith("MeshCore-"):
|
|
1630
|
+
if not d.name is None and d.name.startswith("MeshCore-"):
|
|
1607
1631
|
print(f"{d.address} {d.name}")
|
|
1608
1632
|
return
|
|
1609
1633
|
case "-S" :
|
|
1610
1634
|
devices = await BleakScanner.discover(timeout=timeout)
|
|
1611
1635
|
choices = []
|
|
1612
1636
|
for d in devices:
|
|
1613
|
-
if d.name.startswith("MeshCore-"):
|
|
1637
|
+
if not d.name is None and d.name.startswith("MeshCore-"):
|
|
1614
1638
|
choices.append((d.address, f"{d.address} {d.name}"))
|
|
1615
1639
|
if len(choices) == 0:
|
|
1616
1640
|
logger.error("No BLE device found, exiting")
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|