meshcore-cli 1.3.16__py3-none-any.whl → 1.3.17__py3-none-any.whl
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/meshcore_cli.py +107 -4
- {meshcore_cli-1.3.16.dist-info → meshcore_cli-1.3.17.dist-info}/METADATA +1 -1
- meshcore_cli-1.3.17.dist-info/RECORD +8 -0
- meshcore_cli-1.3.16.dist-info/RECORD +0 -8
- {meshcore_cli-1.3.16.dist-info → meshcore_cli-1.3.17.dist-info}/WHEEL +0 -0
- {meshcore_cli-1.3.16.dist-info → meshcore_cli-1.3.17.dist-info}/entry_points.txt +0 -0
- {meshcore_cli-1.3.16.dist-info → meshcore_cli-1.3.17.dist-info}/licenses/LICENSE +0 -0
meshcore_cli/meshcore_cli.py
CHANGED
|
@@ -32,7 +32,7 @@ import re
|
|
|
32
32
|
from meshcore import MeshCore, EventType, logger
|
|
33
33
|
|
|
34
34
|
# Version
|
|
35
|
-
VERSION = "v1.3.
|
|
35
|
+
VERSION = "v1.3.17"
|
|
36
36
|
|
|
37
37
|
# default ble address is stored in a config file
|
|
38
38
|
MCCLI_CONFIG_DIR = str(Path.home()) + "/.config/meshcore/"
|
|
@@ -591,6 +591,9 @@ def make_completion_dict(contacts, pending={}, to=None, channels=None):
|
|
|
591
591
|
"req_telemetry" : contact_list,
|
|
592
592
|
"req_binary" : contact_list,
|
|
593
593
|
"req_mma" : contact_list,
|
|
594
|
+
"req_owner" : contact_list,
|
|
595
|
+
"req_regions" : contact_list,
|
|
596
|
+
"req_clock" : contact_list,
|
|
594
597
|
"self_telemetry" : None,
|
|
595
598
|
"get_channel": None,
|
|
596
599
|
"set_channel": None,
|
|
@@ -623,6 +626,7 @@ def make_completion_dict(contacts, pending={}, to=None, channels=None):
|
|
|
623
626
|
"print_path_updates" : {"on":None,"off":None},
|
|
624
627
|
"classic_prompt" : {"on" : None, "off":None},
|
|
625
628
|
"manual_add_contacts" : {"on" : None, "off":None},
|
|
629
|
+
"autoadd_config" : None,
|
|
626
630
|
"telemetry_mode_base" : {"always" : None, "device":None, "never":None},
|
|
627
631
|
"telemetry_mode_loc" : {"always" : None, "device":None, "never":None},
|
|
628
632
|
"telemetry_mode_env" : {"always" : None, "device":None, "never":None},
|
|
@@ -655,6 +659,7 @@ def make_completion_dict(contacts, pending={}, to=None, channels=None):
|
|
|
655
659
|
"print_new_contacts":None,
|
|
656
660
|
"classic_prompt":None,
|
|
657
661
|
"manual_add_contacts":None,
|
|
662
|
+
"autoadd_config":None,
|
|
658
663
|
"telemetry_mode_base":None,
|
|
659
664
|
"telemetry_mode_loc":None,
|
|
660
665
|
"telemetry_mode_env":None,
|
|
@@ -1290,7 +1295,10 @@ async def process_contact_chat_line(mc, contact, line):
|
|
|
1290
1295
|
line.startswith("req_status") or line.startswith("rs") or\
|
|
1291
1296
|
line.startswith("req_neighbours") or line.startswith("rn") or\
|
|
1292
1297
|
line.startswith("req_telemetry") or line.startswith("rt") or\
|
|
1293
|
-
line.startswith("
|
|
1298
|
+
line.startswith("req_regions") or line.startswith("rr") or\
|
|
1299
|
+
line.startswith("req_owner") or line.startswith("ro") or\
|
|
1300
|
+
line.startswith("req_clock") or line.startswith("rc") or\
|
|
1301
|
+
line.startswith("req_acl") or line.startswith("ra") or\
|
|
1294
1302
|
line.startswith("path") or\
|
|
1295
1303
|
line.startswith("logout") :
|
|
1296
1304
|
args = [line.split()[0], contact['adv_name']]
|
|
@@ -2138,6 +2146,11 @@ async def next_cmd(mc, cmds, json_output=False):
|
|
|
2138
2146
|
print(f"Error : {res}")
|
|
2139
2147
|
else :
|
|
2140
2148
|
print(f"manual add contact: {mac}")
|
|
2149
|
+
case "autoadd_config":
|
|
2150
|
+
flags = int(cmds[2], 0)
|
|
2151
|
+
res = await mc.commands.set_autoadd_config(flags)
|
|
2152
|
+
if res.type == EventType.ERROR:
|
|
2153
|
+
print(f"Error : {res}")
|
|
2141
2154
|
case "multi_acks":
|
|
2142
2155
|
ma = (cmds[2] == "on") or (cmds[2] == "true") or (cmds[2] == "yes") or (cmds[2] == "1")
|
|
2143
2156
|
res = await mc.commands.set_multi_acks(ma)
|
|
@@ -2363,6 +2376,12 @@ async def next_cmd(mc, cmds, json_output=False):
|
|
|
2363
2376
|
print(json.dumps({"manual_add_contacts" : mc.self_info["manual_add_contacts"]}))
|
|
2364
2377
|
else :
|
|
2365
2378
|
print(f"manual_add_contacts: {mc.self_info['manual_add_contacts']}")
|
|
2379
|
+
case "autoadd_config" :
|
|
2380
|
+
res = await mc.commands.get_autoadd_config()
|
|
2381
|
+
if res is None or res.type == EventType.ERROR:
|
|
2382
|
+
logger.error("Can't get autoadd_config")
|
|
2383
|
+
else :
|
|
2384
|
+
print(f"0x{res.payload['config']:02x}")
|
|
2366
2385
|
case "telemetry_mode_base" :
|
|
2367
2386
|
await mc.commands.send_appstart()
|
|
2368
2387
|
if json_output :
|
|
@@ -2791,6 +2810,75 @@ async def next_cmd(mc, cmds, json_output=False):
|
|
|
2791
2810
|
|
|
2792
2811
|
print(f" {name:22} {type:>4} SNR: {n['SNR_in']:6,.2f}->{n['SNR']:6,.2f} RSSI: ->{n['RSSI']:4}")
|
|
2793
2812
|
|
|
2813
|
+
case "req_regions"|"rr":
|
|
2814
|
+
argnum = 1
|
|
2815
|
+
await mc.ensure_contacts()
|
|
2816
|
+
contact = await get_contact_from_arg(mc, cmds[1])
|
|
2817
|
+
if contact is None:
|
|
2818
|
+
if json_output :
|
|
2819
|
+
print(json.dumps({"error" : "unknown contact"}))
|
|
2820
|
+
else:
|
|
2821
|
+
print(f"Unknown contact {cmds[1]}")
|
|
2822
|
+
else:
|
|
2823
|
+
timeout = 0 if not "timeout" in contact else contact["timeout"]
|
|
2824
|
+
res = await mc.commands.req_regions_sync(contact, timeout)
|
|
2825
|
+
if res is None :
|
|
2826
|
+
if json_output :
|
|
2827
|
+
print(json.dumps({"error" : "Getting data"}))
|
|
2828
|
+
else:
|
|
2829
|
+
print("Error getting data")
|
|
2830
|
+
else :
|
|
2831
|
+
if json_output :
|
|
2832
|
+
print(json.dumps({"repeater": contact["adv_name"]}, {"regions": res}))
|
|
2833
|
+
else :
|
|
2834
|
+
print(f"{contact['adv_name']} repeats {res}")
|
|
2835
|
+
|
|
2836
|
+
case "req_owner"|"ro":
|
|
2837
|
+
argnum = 1
|
|
2838
|
+
await mc.ensure_contacts()
|
|
2839
|
+
contact = await get_contact_from_arg(mc, cmds[1])
|
|
2840
|
+
if contact is None:
|
|
2841
|
+
if json_output :
|
|
2842
|
+
print(json.dumps({"error" : "unknown contact"}))
|
|
2843
|
+
else:
|
|
2844
|
+
print(f"Unknown contact {cmds[1]}")
|
|
2845
|
+
else:
|
|
2846
|
+
timeout = 0 if not "timeout" in contact else contact["timeout"]
|
|
2847
|
+
res = await mc.commands.req_owner_sync(contact, timeout)
|
|
2848
|
+
if res is None :
|
|
2849
|
+
if json_output :
|
|
2850
|
+
print(json.dumps({"error" : "Getting data"}))
|
|
2851
|
+
else:
|
|
2852
|
+
print("Error getting data")
|
|
2853
|
+
else :
|
|
2854
|
+
if json_output:
|
|
2855
|
+
print(json.dumps(res))
|
|
2856
|
+
else:
|
|
2857
|
+
if res["owner"] == "":
|
|
2858
|
+
print(f"{res['name']} has no owner set")
|
|
2859
|
+
else:
|
|
2860
|
+
print(f"{res['name']} is owned by {res['owner']}")
|
|
2861
|
+
|
|
2862
|
+
case "req_clock"|"rc":
|
|
2863
|
+
argnum = 1
|
|
2864
|
+
await mc.ensure_contacts()
|
|
2865
|
+
contact = await get_contact_from_arg(mc, cmds[1])
|
|
2866
|
+
if contact is None:
|
|
2867
|
+
if json_output :
|
|
2868
|
+
print(json.dumps({"error" : "unknown contact"}))
|
|
2869
|
+
else:
|
|
2870
|
+
print(f"Unknown contact {cmds[1]}")
|
|
2871
|
+
else:
|
|
2872
|
+
timeout = 0 if not "timeout" in contact else contact["timeout"]
|
|
2873
|
+
res = await mc.commands.req_basic_sync(contact, timeout)
|
|
2874
|
+
if res is None :
|
|
2875
|
+
if json_output :
|
|
2876
|
+
print(json.dumps({"error" : "Getting data"}))
|
|
2877
|
+
else:
|
|
2878
|
+
print("Error getting data")
|
|
2879
|
+
else :
|
|
2880
|
+
print(int.from_bytes(bytes.fromhex(res["data"][0:8]), byteorder="little", signed=False))
|
|
2881
|
+
|
|
2794
2882
|
case "req_telemetry"|"rt" :
|
|
2795
2883
|
argnum = 1
|
|
2796
2884
|
await mc.ensure_contacts()
|
|
@@ -2870,7 +2958,7 @@ async def next_cmd(mc, cmds, json_output=False):
|
|
|
2870
2958
|
else :
|
|
2871
2959
|
print(json.dumps(res, indent=4))
|
|
2872
2960
|
|
|
2873
|
-
case "req_acl" :
|
|
2961
|
+
case "req_acl"|"ra" :
|
|
2874
2962
|
argnum = 1
|
|
2875
2963
|
contact = await get_contact_from_arg(mc, cmds[1])
|
|
2876
2964
|
if contact is None:
|
|
@@ -3434,9 +3522,12 @@ def command_help():
|
|
|
3434
3522
|
reset_path <ct> : resets path to a contact to flood rp
|
|
3435
3523
|
change_path <ct> <pth> : change the path to a contact cp
|
|
3436
3524
|
change_flags <ct> <f> : change contact flags (tel_l|tel_a|star)cf
|
|
3525
|
+
req_acl <ct> : requests access control list for node ra
|
|
3437
3526
|
req_telemetry <ct> : prints telemetry data as json rt
|
|
3527
|
+
req_regions <ct> : prints regions from repeater rr
|
|
3528
|
+
req_owner <ct> : prints owner for a repeater ro
|
|
3529
|
+
req_clock <ct> : prints repeater timestamp (for sync) rc
|
|
3438
3530
|
req_mma <ct> : requests min/max/avg for a sensor rm
|
|
3439
|
-
req_acl <ct> : requests access control list for sensor
|
|
3440
3531
|
pending_contacts : show pending contacts
|
|
3441
3532
|
add_pending <pending> : manually add pending contact
|
|
3442
3533
|
flush_pending : flush pending contact list
|
|
@@ -3555,6 +3646,7 @@ def get_help_for (cmdname, context="line") :
|
|
|
3555
3646
|
- when off device automatically adds contacts from adverts
|
|
3556
3647
|
- when on contacts must be added manually using add_pending
|
|
3557
3648
|
(pending contacts list is built by meshcli from adverts while connected)
|
|
3649
|
+
autoadd_config : set autoadd_config flags
|
|
3558
3650
|
display:
|
|
3559
3651
|
print_timestamp <on/off/fmt>: toggle printing of timestamp, can be strftime format
|
|
3560
3652
|
print_snr <on/off> : toggle snr display in messages
|
|
@@ -3607,6 +3699,17 @@ With growing number of users, it becomes necessary to manage contact list and on
|
|
|
3607
3699
|
|
|
3608
3700
|
This feature only really works in interactive mode.
|
|
3609
3701
|
|
|
3702
|
+
You can also set autoadd_config flag to filter contacts that are automatically added to your contact list
|
|
3703
|
+
|
|
3704
|
+
// Auto-add config bitmask
|
|
3705
|
+
// Bit 0: If set, overwrite oldest non-favourite contact when contacts file is full
|
|
3706
|
+
// Bits 1-4: these indicate which contact types to auto-add when manual_contact_mode = 0x01
|
|
3707
|
+
#define AUTO_ADD_OVERWRITE_OLDEST (1 << 0) // 0x01 - overwrite oldest non-favourite when full
|
|
3708
|
+
#define AUTO_ADD_CHAT (1 << 1) // 0x02 - auto-add Chat (Companion) (ADV_TYPE_CHAT)
|
|
3709
|
+
#define AUTO_ADD_REPEATER (1 << 2) // 0x04 - auto-add Repeater (ADV_TYPE_REPEATER)
|
|
3710
|
+
#define AUTO_ADD_ROOM_SERVER (1 << 3) // 0x08 - auto-add Room Server (ADV_TYPE_ROOM)
|
|
3711
|
+
#define AUTO_ADD_SENSOR (1 << 4) // 0x10 - auto-add Sensor (ADV_TYPE_SENSOR)
|
|
3712
|
+
|
|
3610
3713
|
Note: There is also an auto_update_contacts setting that has nothing to do with adding contacts, it permits to automatically sync contact lists between device and meshcore-cli (when there is an update in name, location or path).
|
|
3611
3714
|
""")
|
|
3612
3715
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: meshcore-cli
|
|
3
|
-
Version: 1.3.
|
|
3
|
+
Version: 1.3.17
|
|
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
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
meshcore_cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
meshcore_cli/__main__.py,sha256=PfYgibmu2LEtC-OV7L1UgmvV3swJ5rQ4bbXHlwUFlgE,83
|
|
3
|
+
meshcore_cli/meshcore_cli.py,sha256=CFReb2iTlJs7y3IPwWn85ZaJJSr0nrP1G3nl9Fbge6A,177380
|
|
4
|
+
meshcore_cli-1.3.17.dist-info/METADATA,sha256=IpwXoqN-QTRy0kRj--PGcFEVYyF3tApxysedF-btxpY,18194
|
|
5
|
+
meshcore_cli-1.3.17.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
6
|
+
meshcore_cli-1.3.17.dist-info/entry_points.txt,sha256=77V29Pyth11GteDk7tneBN3MMk8JI7bTlS-BGSmxCmI,103
|
|
7
|
+
meshcore_cli-1.3.17.dist-info/licenses/LICENSE,sha256=F9s987VtS0AKxW7LdB2EkLMkrdeERI7ICdLJR60A9M4,1066
|
|
8
|
+
meshcore_cli-1.3.17.dist-info/RECORD,,
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
meshcore_cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
meshcore_cli/__main__.py,sha256=PfYgibmu2LEtC-OV7L1UgmvV3swJ5rQ4bbXHlwUFlgE,83
|
|
3
|
-
meshcore_cli/meshcore_cli.py,sha256=AjAqHDZ2LCPAaDqtZV7kWN07feXuu3Il7YMPxhS_vkg,172001
|
|
4
|
-
meshcore_cli-1.3.16.dist-info/METADATA,sha256=kRcTR55u3pSOzEaaAs6KwNqtUIZT5VJuVD2MyzIts64,18194
|
|
5
|
-
meshcore_cli-1.3.16.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
6
|
-
meshcore_cli-1.3.16.dist-info/entry_points.txt,sha256=77V29Pyth11GteDk7tneBN3MMk8JI7bTlS-BGSmxCmI,103
|
|
7
|
-
meshcore_cli-1.3.16.dist-info/licenses/LICENSE,sha256=F9s987VtS0AKxW7LdB2EkLMkrdeERI7ICdLJR60A9M4,1066
|
|
8
|
-
meshcore_cli-1.3.16.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|