meshcore-cli 1.6.9__tar.gz → 1.6.11__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-1.6.9 → meshcore_cli-1.6.11}/PKG-INFO +5 -4
- {meshcore_cli-1.6.9 → meshcore_cli-1.6.11}/README.md +3 -2
- {meshcore_cli-1.6.9 → meshcore_cli-1.6.11}/flake.nix +2 -2
- {meshcore_cli-1.6.9 → meshcore_cli-1.6.11}/pyproject.toml +2 -2
- {meshcore_cli-1.6.9 → meshcore_cli-1.6.11}/src/meshcore_cli/meshcore_cli.py +114 -9
- {meshcore_cli-1.6.9 → meshcore_cli-1.6.11}/.github/funding.yml +0 -0
- {meshcore_cli-1.6.9 → meshcore_cli-1.6.11}/.gitignore +0 -0
- {meshcore_cli-1.6.9 → meshcore_cli-1.6.11}/LICENSE +0 -0
- {meshcore_cli-1.6.9 → meshcore_cli-1.6.11}/flake.lock +0 -0
- {meshcore_cli-1.6.9 → meshcore_cli-1.6.11}/scripts/README.md +0 -0
- {meshcore_cli-1.6.9 → meshcore_cli-1.6.11}/scripts/ask_mepo_coords +0 -0
- {meshcore_cli-1.6.9 → meshcore_cli-1.6.11}/scripts/contact_markers.sh +0 -0
- {meshcore_cli-1.6.9 → meshcore_cli-1.6.11}/scripts/getpos.py +0 -0
- {meshcore_cli-1.6.9 → meshcore_cli-1.6.11}/scripts/neighbour_map.sh +0 -0
- {meshcore_cli-1.6.9 → meshcore_cli-1.6.11}/src/meshcore_cli/__init__.py +0 -0
- {meshcore_cli-1.6.9 → meshcore_cli-1.6.11}/src/meshcore_cli/__main__.py +0 -0
- {meshcore_cli-1.6.9 → meshcore_cli-1.6.11}/sxmo/sxmo_accel.sh +0 -0
- {meshcore_cli-1.6.9 → meshcore_cli-1.6.11}/sxmo/sxmo_mc.sh +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: meshcore-cli
|
|
3
|
-
Version: 1.6.
|
|
3
|
+
Version: 1.6.11
|
|
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.
|
|
14
|
+
Requires-Dist: meshcore>=2.3.22
|
|
15
15
|
Requires-Dist: prompt-toolkit>=3.0.50
|
|
16
16
|
Requires-Dist: requests>=2.28.0
|
|
17
17
|
Description-Content-Type: text/markdown
|
|
@@ -111,7 +111,7 @@ Commands are given after arguments, they can be chained and some have shortcuts.
|
|
|
111
111
|
alias <key> <cmd> : create an alias for key, see ?alias
|
|
112
112
|
aliases : list all aliases
|
|
113
113
|
aliases_load : load aliases from a file
|
|
114
|
-
handler_attach <d> <c> : attach c as a handler for d (rxlog|msgs)
|
|
114
|
+
handler_attach <d> <c> : attach c as a handler for d (rxlog|msgs|chan_data|telemetry)
|
|
115
115
|
handler_detach <n> : detach an handler (from its handle n)
|
|
116
116
|
Messaging
|
|
117
117
|
msg <name> <msg> : send message to node by name m {
|
|
@@ -153,6 +153,7 @@ Commands are given after arguments, they can be chained and some have shortcuts.
|
|
|
153
153
|
change_path <ct> <pth> : change the path to a contact cp
|
|
154
154
|
change_flags <ct> <f> : change contact flags (tel_l|tel_a|star)cf
|
|
155
155
|
req_telemetry <ct> : prints telemetry data as json rt
|
|
156
|
+
sub_telemetry : subscribes to push telemetry
|
|
156
157
|
req_mma <ct> : requests min/max/avg for a sensor rm
|
|
157
158
|
req_acl <ct> : requests access control list for sensor
|
|
158
159
|
pending_contacts : show pending contacts
|
|
@@ -238,7 +239,7 @@ Aliases can be saved using a redirection `> filename aliases` and loaded from a
|
|
|
238
239
|
|
|
239
240
|
#### Handlers
|
|
240
241
|
|
|
241
|
-
Shell processes can be attached to `rxlog` or `
|
|
242
|
+
Shell processes can be attached to `rxlog`, `msgs`, `chan_data` or `telemetry` using `handler_attach` and `handler_detach` commands.
|
|
242
243
|
|
|
243
244
|
For instance:
|
|
244
245
|
```
|
|
@@ -93,7 +93,7 @@ Commands are given after arguments, they can be chained and some have shortcuts.
|
|
|
93
93
|
alias <key> <cmd> : create an alias for key, see ?alias
|
|
94
94
|
aliases : list all aliases
|
|
95
95
|
aliases_load : load aliases from a file
|
|
96
|
-
handler_attach <d> <c> : attach c as a handler for d (rxlog|msgs)
|
|
96
|
+
handler_attach <d> <c> : attach c as a handler for d (rxlog|msgs|chan_data|telemetry)
|
|
97
97
|
handler_detach <n> : detach an handler (from its handle n)
|
|
98
98
|
Messaging
|
|
99
99
|
msg <name> <msg> : send message to node by name m {
|
|
@@ -135,6 +135,7 @@ Commands are given after arguments, they can be chained and some have shortcuts.
|
|
|
135
135
|
change_path <ct> <pth> : change the path to a contact cp
|
|
136
136
|
change_flags <ct> <f> : change contact flags (tel_l|tel_a|star)cf
|
|
137
137
|
req_telemetry <ct> : prints telemetry data as json rt
|
|
138
|
+
sub_telemetry : subscribes to push telemetry
|
|
138
139
|
req_mma <ct> : requests min/max/avg for a sensor rm
|
|
139
140
|
req_acl <ct> : requests access control list for sensor
|
|
140
141
|
pending_contacts : show pending contacts
|
|
@@ -220,7 +221,7 @@ Aliases can be saved using a redirection `> filename aliases` and loaded from a
|
|
|
220
221
|
|
|
221
222
|
#### Handlers
|
|
222
223
|
|
|
223
|
-
Shell processes can be attached to `rxlog` or `
|
|
224
|
+
Shell processes can be attached to `rxlog`, `msgs`, `chan_data` or `telemetry` using `handler_attach` and `handler_detach` commands.
|
|
224
225
|
|
|
225
226
|
For instance:
|
|
226
227
|
```
|
|
@@ -17,12 +17,12 @@
|
|
|
17
17
|
|
|
18
18
|
meshcore = python3Packages.buildPythonPackage rec {
|
|
19
19
|
pname = "meshcore";
|
|
20
|
-
version = "2.3.
|
|
20
|
+
version = "2.3.22";
|
|
21
21
|
pyproject = true;
|
|
22
22
|
|
|
23
23
|
src = python3Packages.fetchPypi {
|
|
24
24
|
inherit pname version;
|
|
25
|
-
sha256 = "sha256-
|
|
25
|
+
sha256 = "sha256-dxiG5cJcteqXP0+XWVfnPpb0Mp+8oes5FvrFfBMzUBA=";
|
|
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.
|
|
7
|
+
version = "1.6.11"
|
|
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.
|
|
20
|
+
dependencies = [ "meshcore >= 2.3.22",
|
|
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.
|
|
38
|
+
VERSION = "v1.6.11"
|
|
39
39
|
|
|
40
40
|
# default ble address is stored in a config file
|
|
41
41
|
MCCLI_CONFIG_DIR = os.path.expanduser("~/.config/meshcore/")
|
|
@@ -118,6 +118,7 @@ HANDLERS = { # dicts that will be indexed by numbers
|
|
|
118
118
|
"rxlog" : {},
|
|
119
119
|
"msgs" : {},
|
|
120
120
|
"chan_data" : {},
|
|
121
|
+
"telemetry" : {},
|
|
121
122
|
}
|
|
122
123
|
LAST_HANDLER_ID = 0
|
|
123
124
|
HANDLER_QUEUE_SIZE = 100
|
|
@@ -523,6 +524,9 @@ handle_log_rx.advert_echoes = False
|
|
|
523
524
|
handle_log_rx.mc = None
|
|
524
525
|
handle_log_rx.echo_unk_chans=False
|
|
525
526
|
|
|
527
|
+
async def handle_telemetry(event):
|
|
528
|
+
enqueue_handler_event("telemetry", event.payload)
|
|
529
|
+
|
|
526
530
|
async def handle_advert(event):
|
|
527
531
|
if not handle_advert.print_adverts:
|
|
528
532
|
return
|
|
@@ -745,7 +749,7 @@ def make_completion_dict(contacts, pending=None, to=None, channels=None):
|
|
|
745
749
|
"aliases" : None,
|
|
746
750
|
"aliases_load" : None,
|
|
747
751
|
"alias" : None,
|
|
748
|
-
"handler_attach": {"rxlog":None, "msgs":None, "chan_data":None},
|
|
752
|
+
"handler_attach": {"rxlog":None, "msgs":None, "chan_data":None, "telemetry":None},
|
|
749
753
|
"handler_detach": None,
|
|
750
754
|
"handlers": None,
|
|
751
755
|
"login" : contact_list,
|
|
@@ -754,6 +758,8 @@ def make_completion_dict(contacts, pending=None, to=None, channels=None):
|
|
|
754
758
|
"req_neighbours": contact_list,
|
|
755
759
|
"logout" : contact_list,
|
|
756
760
|
"req_telemetry" : contact_list,
|
|
761
|
+
"sub_telemetry" : contact_list,
|
|
762
|
+
"unsub_telemetry" : contact_list,
|
|
757
763
|
"req_binary" : contact_list,
|
|
758
764
|
"req_mma" : contact_list,
|
|
759
765
|
"req_owner" : contact_list,
|
|
@@ -769,6 +775,8 @@ def make_completion_dict(contacts, pending=None, to=None, channels=None):
|
|
|
769
775
|
"at": None,
|
|
770
776
|
"scope": None,
|
|
771
777
|
"send_raw": None,
|
|
778
|
+
"gps" : {"on":None,"off":None,"sync":None,"once":None,"diag":None,"fix":None,"fix_stats":None,"period":None,
|
|
779
|
+
},
|
|
772
780
|
"set" : {
|
|
773
781
|
"name" : None,
|
|
774
782
|
"pin" : None,
|
|
@@ -829,6 +837,8 @@ def make_completion_dict(contacts, pending=None, to=None, channels=None):
|
|
|
829
837
|
"ui.backlight_on_msgs": None,
|
|
830
838
|
"ui.auto_off_blank": None,
|
|
831
839
|
"ui.max_partial": None,
|
|
840
|
+
"ui.nd_name": None,
|
|
841
|
+
"ui.gps_action": {"toggle":None, "once":None,},
|
|
832
842
|
},
|
|
833
843
|
"get" : {"name":None,
|
|
834
844
|
"bat":None,
|
|
@@ -940,6 +950,8 @@ def make_completion_dict(contacts, pending=None, to=None, channels=None):
|
|
|
940
950
|
"change_flags" : None,
|
|
941
951
|
"reset_advert_time" : None,
|
|
942
952
|
"req_telemetry" : None,
|
|
953
|
+
"sub_telemetry" : None,
|
|
954
|
+
"unsub_telemetry" : None,
|
|
943
955
|
"req_binary" : None,
|
|
944
956
|
"forget_password" : None,
|
|
945
957
|
}
|
|
@@ -974,7 +986,8 @@ def make_completion_dict(contacts, pending=None, to=None, channels=None):
|
|
|
974
986
|
"req_clock" :None,
|
|
975
987
|
"setperm":contact_list,
|
|
976
988
|
"region" : {"get":None, "allowf": None, "denyf": None, "put": None, "remove": None, "save": None, "home": None},
|
|
977
|
-
"gps" : {"on":None,"off":None,"sync":None,"
|
|
989
|
+
"gps" : {"on":None,"off":None,"sync":None,"once":None,"diag":None,"fix":None,"fix_stats":None,"period":None,
|
|
990
|
+
"setloc":None,
|
|
978
991
|
"advert" : {"none": None, "share": None, "prefs": None},
|
|
979
992
|
},
|
|
980
993
|
"powersaving" : {"on":None,"off":None},
|
|
@@ -990,6 +1003,7 @@ def make_completion_dict(contacts, pending=None, to=None, channels=None):
|
|
|
990
1003
|
"flood.advert.interval" : None,
|
|
991
1004
|
"flood.max":None,
|
|
992
1005
|
"advert.interval" : None,
|
|
1006
|
+
"advert.loc" : None,
|
|
993
1007
|
"guest.password" : None,
|
|
994
1008
|
"owner.info":None,
|
|
995
1009
|
"rxdelay": None,
|
|
@@ -1019,6 +1033,7 @@ def make_completion_dict(contacts, pending=None, to=None, channels=None):
|
|
|
1019
1033
|
"flood.advert.interval" : None,
|
|
1020
1034
|
"flood.max" : None,
|
|
1021
1035
|
"advert.interval" : None,
|
|
1036
|
+
"advert.loc" : {"none": None, "shared": None, "prefs": None},
|
|
1022
1037
|
"guest.password" : None,
|
|
1023
1038
|
"owner.info":None,
|
|
1024
1039
|
"allow.read.only" : {"on": None, "off": None},
|
|
@@ -1791,6 +1806,7 @@ async def process_contact_chat_line(mc, contact, line, inside=False, json_output
|
|
|
1791
1806
|
line.startswith("path ") or line == "path" or\
|
|
1792
1807
|
line.startswith("advert_path") or line == "ap" or line.startswith("ap ") or\
|
|
1793
1808
|
line.startswith("reset_advert_time") or\
|
|
1809
|
+
line.startswith("unsub_telemetry") or\
|
|
1794
1810
|
line.startswith("logout") :
|
|
1795
1811
|
args = [line.split()[0], contact['adv_name']]
|
|
1796
1812
|
out_str = ""
|
|
@@ -1899,6 +1915,12 @@ async def process_contact_chat_line(mc, contact, line, inside=False, json_output
|
|
|
1899
1915
|
await process_cmds(mc, args, json_output=json_output, sink=sink)
|
|
1900
1916
|
return True
|
|
1901
1917
|
|
|
1918
|
+
cmds = line.split(" ")
|
|
1919
|
+
if cmds[0] == "sub_telemetry":
|
|
1920
|
+
args = [cmds[0], contact['adv_name'], cmds[1], cmds[2]]
|
|
1921
|
+
await process_cmds(mc, args, json_output=json_output, sink=sink)
|
|
1922
|
+
return True
|
|
1923
|
+
|
|
1902
1924
|
if line == "login": # use stored password or prompt for it
|
|
1903
1925
|
password_file = ""
|
|
1904
1926
|
password = ""
|
|
@@ -2753,7 +2775,7 @@ async def next_cmd(mc, cmds, json_output=False, sink=sys.stdout, end="\n"):
|
|
|
2753
2775
|
auc = (cmds[2] == "on") or (cmds[2] == "true") or (cmds[2] == "yes") or (cmds[2] == "1")
|
|
2754
2776
|
mc.auto_update_contacts=auc
|
|
2755
2777
|
case "telemetry_mode_base":
|
|
2756
|
-
if (cmds[2] == "2") or (cmds[2]
|
|
2778
|
+
if (cmds[2] == "2") or (cmds[2].startswith("al")) or (cmds[2] == "yes") or (cmds[2] == "on") :
|
|
2757
2779
|
mode = 2
|
|
2758
2780
|
elif (cmds[2] == "1") or (cmds[2] == "selected") or (cmds[2] == "dev") :
|
|
2759
2781
|
mode = 1
|
|
@@ -3721,6 +3743,58 @@ async def next_cmd(mc, cmds, json_output=False, sink=sys.stdout, end="\n"):
|
|
|
3721
3743
|
"lpp": res,
|
|
3722
3744
|
}, indent = 4) + end
|
|
3723
3745
|
|
|
3746
|
+
case "sub_telemetry" :
|
|
3747
|
+
argnum = 3
|
|
3748
|
+
await mc.ensure_contacts()
|
|
3749
|
+
contact = await get_contact_from_arg(mc, cmds[1])
|
|
3750
|
+
if contact is None:
|
|
3751
|
+
if json_output :
|
|
3752
|
+
output_str += json.dumps({"error" : "unknown contact"})+end
|
|
3753
|
+
else:
|
|
3754
|
+
output_str += f"Unknown contact {cmds[1]}{end}"
|
|
3755
|
+
else:
|
|
3756
|
+
if cmds[2].endswith("m"):
|
|
3757
|
+
duration = int(cmds[2][:-1]) * 60
|
|
3758
|
+
elif cmds[2].endswith("h"):
|
|
3759
|
+
duration = int(cmds[2][:-1]) * 3600
|
|
3760
|
+
else:
|
|
3761
|
+
duration = int(cmds[2])
|
|
3762
|
+
if cmds[3].startswith('[') or cmds[3].startswith('{'): # json
|
|
3763
|
+
min_deltas = json.loads(cmds[3])
|
|
3764
|
+
else: # custom formating: chan:type:value,
|
|
3765
|
+
min_deltas = []
|
|
3766
|
+
for d in cmds[3].split(","):
|
|
3767
|
+
fields = d.split(":")
|
|
3768
|
+
if len(fields) < 3:
|
|
3769
|
+
raise(ValueError(f"incorrect encoding for min_delta: {d}"))
|
|
3770
|
+
try:
|
|
3771
|
+
lpp_type = int(fields[1])
|
|
3772
|
+
except ValueError:
|
|
3773
|
+
lpp_type = fields[1]
|
|
3774
|
+
min_deltas.append({
|
|
3775
|
+
"channel": int(fields[0]),
|
|
3776
|
+
"type": lpp_type,
|
|
3777
|
+
"value": float(fields[2]),
|
|
3778
|
+
})
|
|
3779
|
+
timeout = 0 if not "timeout" in contact else contact["timeout"]
|
|
3780
|
+
res = await mc.commands.telemetry_subscribe(contact, duration, min_deltas, timeout=timeout)
|
|
3781
|
+
output_str += str(res) + end
|
|
3782
|
+
|
|
3783
|
+
case "unsub_telemetry" :
|
|
3784
|
+
argnum = 1
|
|
3785
|
+
await mc.ensure_contacts()
|
|
3786
|
+
contact = await get_contact_from_arg(mc, cmds[1])
|
|
3787
|
+
if contact is None:
|
|
3788
|
+
if json_output :
|
|
3789
|
+
output_str += json.dumps({"error" : "unknown contact"})+end
|
|
3790
|
+
else:
|
|
3791
|
+
output_str += f"Unknown contact {cmds[1]}{end}"
|
|
3792
|
+
else:
|
|
3793
|
+
timeout = 0 if not "timeout" in contact else contact["timeout"]
|
|
3794
|
+
res = await mc.commands.req_unsubscribe_sync(contact)
|
|
3795
|
+
output_str += "OK" if res else "ERROR"
|
|
3796
|
+
output_str += end
|
|
3797
|
+
|
|
3724
3798
|
case "req_status"|"rs" :
|
|
3725
3799
|
argnum = 1
|
|
3726
3800
|
contact = await get_contact_from_arg(mc, cmds[1])
|
|
@@ -4495,7 +4569,7 @@ async def next_cmd(mc, cmds, json_output=False, sink=sys.stdout, end="\n"):
|
|
|
4495
4569
|
process = None
|
|
4496
4570
|
|
|
4497
4571
|
try:
|
|
4498
|
-
if not htype in ["msgs", "rxlog", "chan_data"]:
|
|
4572
|
+
if not htype in ["msgs", "rxlog", "chan_data", "telemetry"]:
|
|
4499
4573
|
raise ValueError (f"Unknown handler type {htype}")
|
|
4500
4574
|
process = await asyncio.create_subprocess_exec(
|
|
4501
4575
|
*shlex.split(cmd, posix=True),
|
|
@@ -4533,7 +4607,7 @@ async def next_cmd(mc, cmds, json_output=False, sink=sys.stdout, end="\n"):
|
|
|
4533
4607
|
case "handler_detach":
|
|
4534
4608
|
argnum = 1
|
|
4535
4609
|
nb = int(cmds[1])
|
|
4536
|
-
handlers = HANDLERS["msgs"]|HANDLERS["rxlog"]|HANDLERS["chan_data"]
|
|
4610
|
+
handlers = HANDLERS["msgs"]|HANDLERS["rxlog"]|HANDLERS["chan_data"]|HANDLERS["telemetry"]
|
|
4537
4611
|
handler = handlers[nb]
|
|
4538
4612
|
handler["closed"] = True
|
|
4539
4613
|
for task_name in ("writer_task", "output_task"):
|
|
@@ -4643,7 +4717,7 @@ def command_help():
|
|
|
4643
4717
|
alias <key> <cmd> : create an alias for key, see ?alias
|
|
4644
4718
|
aliases : list all aliases
|
|
4645
4719
|
aliases_load : load aliases from a file
|
|
4646
|
-
handler_attach <d> <c> : attach c as a handler for d
|
|
4720
|
+
handler_attach <d> <c> : attach c as a handler for d
|
|
4647
4721
|
handler_detach <n> : detach an handler (from its handle n)
|
|
4648
4722
|
Messaging
|
|
4649
4723
|
msg <name> <msg> : send message to node by name m {
|
|
@@ -4689,6 +4763,8 @@ def command_help():
|
|
|
4689
4763
|
change_flags <ct> <f> : change contact flags (tel_l|tel_a|star)cf
|
|
4690
4764
|
req_acl <ct> : requests access control list for node ra
|
|
4691
4765
|
req_telemetry <ct> : prints telemetry data as json rt
|
|
4766
|
+
sub_telemetry c d md : subscribe to pushed telemetry
|
|
4767
|
+
unsub_telemetry c : unsubscribe to pushed telemetry
|
|
4692
4768
|
req_regions <ct> : prints regions from repeater rr
|
|
4693
4769
|
req_owner <ct> : prints owner for a repeater ro
|
|
4694
4770
|
req_clock <ct> : prints repeater timestamp (for sync)
|
|
@@ -5058,6 +5134,34 @@ Output format is given as a string with one character by field. Name is always d
|
|
|
5058
5134
|
Use get/set lc_output_format to get or set default value
|
|
5059
5135
|
""")
|
|
5060
5136
|
|
|
5137
|
+
elif "telemetry" in cmdname :
|
|
5138
|
+
print("""req_telemetry/sub_telemetry/unsub_telemetry: telemetry management in meshcore-cli
|
|
5139
|
+
|
|
5140
|
+
There are two ways to deal with telemetry in meshcore:
|
|
5141
|
+
|
|
5142
|
+
Pulled telemetry is the historical way. In meshcore-cli this is done by issuing a `req_telemetry` command on a contact. A json structure obtained from lpp encoded value will be returned if you have the rights to access telemetry.
|
|
5143
|
+
|
|
5144
|
+
There is also a pushed telemetry way. You have to subscribe to the node for getting the data, which will be pushed to you whenever a change is noticed.
|
|
5145
|
+
|
|
5146
|
+
In meshcore-cli, to subscribe for telemetry you have to issue a `sub_telemetry` command. This commands has three arguments: the contact, the duration of the registration (in seconds by default but can be specified by appending m or h) and the min_deltas structure, which describes the triggers for telemety push. Min_delta can be sent as a json_encoding structure (same as the one issued by req_telemetry) or a compact structure, where each sensor is specified using the chan:lpp_type:delta format (ex: 1:voltage:0.1,1:temperature:0.5 will look for .1 variation in voltage and .5 variation in temperature from channel 1).
|
|
5147
|
+
|
|
5148
|
+
Once you are subscribed, handlers mechanisms can be used to print the value using your own filters. You can subscribe to the telemetry handler by using `handler_attach telemetry <command>`.
|
|
5149
|
+
|
|
5150
|
+
To unsubscribe to pushed telemetry call `unsub_telemetry
|
|
5151
|
+
|
|
5152
|
+
""")
|
|
5153
|
+
|
|
5154
|
+
elif "handler" in cmdname :
|
|
5155
|
+
print("""handler_attach/handler_detach/handlers: special handling for incoming data
|
|
5156
|
+
|
|
5157
|
+
meshcore-cli lets you attach shell process to msg rx_log chan_data or telemetry
|
|
5158
|
+
|
|
5159
|
+
* `handler_attach <d> <c>` attaches command `c` to the handler `d` (which can be msgs, rxlog, chan_data or telemetry). It returns an handle number.
|
|
5160
|
+
|
|
5161
|
+
* `handler_detach <n>` detaches handler with number `n`
|
|
5162
|
+
* `handlers` lists current handlers
|
|
5163
|
+
""")
|
|
5164
|
+
|
|
5061
5165
|
else:
|
|
5062
5166
|
print(f"Sorry, no help yet for {cmdname}")
|
|
5063
5167
|
|
|
@@ -5514,8 +5618,8 @@ async def main(argv):
|
|
|
5514
5618
|
first_device = False
|
|
5515
5619
|
quiet = False
|
|
5516
5620
|
force_interactive = False
|
|
5517
|
-
serial_dtr =
|
|
5518
|
-
serial_rts =
|
|
5621
|
+
serial_dtr = None
|
|
5622
|
+
serial_rts = None
|
|
5519
5623
|
|
|
5520
5624
|
# basic logger configuration (was removed from meshcore_py)
|
|
5521
5625
|
logging.basicConfig(level=logging.INFO)
|
|
@@ -5776,6 +5880,7 @@ async def main(argv):
|
|
|
5776
5880
|
mc.subscribe(EventType.PATH_UPDATE, handle_path_update)
|
|
5777
5881
|
mc.subscribe(EventType.NEW_CONTACT, handle_new_contact)
|
|
5778
5882
|
mc.subscribe(EventType.RX_LOG_DATA, handle_log_rx)
|
|
5883
|
+
mc.subscribe(EventType.PUSHED_TELEMETRY, handle_telemetry)
|
|
5779
5884
|
|
|
5780
5885
|
mc.auto_update_contacts = True
|
|
5781
5886
|
mc.set_decrypt_channel_logs(True)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|