meshcore-cli 1.6.10__tar.gz → 1.6.12__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.10/README.md → meshcore_cli-1.6.12/PKG-INFO +36 -2
- meshcore_cli-1.6.10/PKG-INFO → meshcore_cli-1.6.12/README.md +18 -20
- {meshcore_cli-1.6.10 → meshcore_cli-1.6.12}/flake.nix +2 -2
- {meshcore_cli-1.6.10 → meshcore_cli-1.6.12}/pyproject.toml +2 -2
- {meshcore_cli-1.6.10 → meshcore_cli-1.6.12}/src/meshcore_cli/meshcore_cli.py +279 -72
- {meshcore_cli-1.6.10 → meshcore_cli-1.6.12}/.github/funding.yml +0 -0
- {meshcore_cli-1.6.10 → meshcore_cli-1.6.12}/.gitignore +0 -0
- {meshcore_cli-1.6.10 → meshcore_cli-1.6.12}/LICENSE +0 -0
- {meshcore_cli-1.6.10 → meshcore_cli-1.6.12}/flake.lock +0 -0
- {meshcore_cli-1.6.10 → meshcore_cli-1.6.12}/scripts/README.md +0 -0
- {meshcore_cli-1.6.10 → meshcore_cli-1.6.12}/scripts/ask_mepo_coords +0 -0
- {meshcore_cli-1.6.10 → meshcore_cli-1.6.12}/scripts/contact_markers.sh +0 -0
- {meshcore_cli-1.6.10 → meshcore_cli-1.6.12}/scripts/getpos.py +0 -0
- {meshcore_cli-1.6.10 → meshcore_cli-1.6.12}/scripts/neighbour_map.sh +0 -0
- {meshcore_cli-1.6.10 → meshcore_cli-1.6.12}/src/meshcore_cli/__init__.py +0 -0
- {meshcore_cli-1.6.10 → meshcore_cli-1.6.12}/src/meshcore_cli/__main__.py +0 -0
- {meshcore_cli-1.6.10 → meshcore_cli-1.6.12}/sxmo/sxmo_accel.sh +0 -0
- {meshcore_cli-1.6.10 → meshcore_cli-1.6.12}/sxmo/sxmo_mc.sh +0 -0
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: meshcore-cli
|
|
3
|
+
Version: 1.6.12
|
|
4
|
+
Summary: Command line interface to meshcore companion radios and repeaters
|
|
5
|
+
Project-URL: Homepage, https://github.com/fdlamotte/meshcore-cli
|
|
6
|
+
Project-URL: Issues, https://github.com/fdlamotte/meshcore-cli/issues
|
|
7
|
+
Author-email: Florent de Lamotte <florent@frizoncorrea.fr>
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Requires-Python: >=3.10
|
|
13
|
+
Requires-Dist: bleak>=0.22
|
|
14
|
+
Requires-Dist: meshcore>=2.3.22
|
|
15
|
+
Requires-Dist: prompt-toolkit>=3.0.50
|
|
16
|
+
Requires-Dist: requests>=2.28.0
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
|
|
1
19
|
# meshcore-cli
|
|
2
20
|
|
|
3
21
|
meshcore-cli : CLI interface to MeshCore companion app over BLE, TCP or Serial
|
|
@@ -93,8 +111,11 @@ Commands are given after arguments, they can be chained and some have shortcuts.
|
|
|
93
111
|
alias <key> <cmd> : create an alias for key, see ?alias
|
|
94
112
|
aliases : list all aliases
|
|
95
113
|
aliases_load : load aliases from a file
|
|
96
|
-
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)
|
|
97
115
|
handler_detach <n> : detach an handler (from its handle n)
|
|
116
|
+
timer <s> <c> : runs command c every s seconds
|
|
117
|
+
timer_cancel <n> : cancels a timer (from its handle n)
|
|
118
|
+
timers : lists current timers
|
|
98
119
|
Messaging
|
|
99
120
|
msg <name> <msg> : send message to node by name m {
|
|
100
121
|
wait_ack : wait an ack wa }
|
|
@@ -135,6 +156,7 @@ Commands are given after arguments, they can be chained and some have shortcuts.
|
|
|
135
156
|
change_path <ct> <pth> : change the path to a contact cp
|
|
136
157
|
change_flags <ct> <f> : change contact flags (tel_l|tel_a|star)cf
|
|
137
158
|
req_telemetry <ct> : prints telemetry data as json rt
|
|
159
|
+
sub_telemetry : subscribes to push telemetry
|
|
138
160
|
req_mma <ct> : requests min/max/avg for a sensor rm
|
|
139
161
|
req_acl <ct> : requests access control list for sensor
|
|
140
162
|
pending_contacts : show pending contacts
|
|
@@ -220,7 +242,7 @@ Aliases can be saved using a redirection `> filename aliases` and loaded from a
|
|
|
220
242
|
|
|
221
243
|
#### Handlers
|
|
222
244
|
|
|
223
|
-
Shell processes can be attached to `rxlog` or `
|
|
245
|
+
Shell processes can be attached to `rxlog`, `msgs`, `chan_data` or `telemetry` using `handler_attach` and `handler_detach` commands.
|
|
224
246
|
|
|
225
247
|
For instance:
|
|
226
248
|
```
|
|
@@ -229,6 +251,18 @@ handler_attach rxlog cat
|
|
|
229
251
|
|
|
230
252
|
Will print out the content of `rx_log` as it comes in.
|
|
231
253
|
|
|
254
|
+
#### Timers
|
|
255
|
+
|
|
256
|
+
`timer [-j] [-c<contact>] [-s<scope>] <s> <line>` runs `line` every `s` seconds.
|
|
257
|
+
|
|
258
|
+
- `-c` sets the contact the line is run from (`~` for root).
|
|
259
|
+
- `-s` sets the scope for the line (default is the current scope of the node).
|
|
260
|
+
- `-j` forces json output for the timed line.
|
|
261
|
+
|
|
262
|
+
`timers` lists the running timers and `timer_cancel <n>` cancels timer `n`.
|
|
263
|
+
|
|
264
|
+
From the command line, timers only run while a command is waiting, so end the command list with `sleep <s>` or `wk` (`meshcli timer 60 "chan 1 hi" sleep 3600`). In chat mode, a `sleep` or `wk` holds up timers until it returns.
|
|
265
|
+
|
|
232
266
|
### Contact management
|
|
233
267
|
|
|
234
268
|
To receive a message from another user, it is necessary to have its public key. This key is stored on a contact list in the device, and this list has a finite size (50 when meshcore started, now over 350 for most devices).
|
|
@@ -1,21 +1,3 @@
|
|
|
1
|
-
Metadata-Version: 2.5
|
|
2
|
-
Name: meshcore-cli
|
|
3
|
-
Version: 1.6.10
|
|
4
|
-
Summary: Command line interface to meshcore companion radios and repeaters
|
|
5
|
-
Project-URL: Homepage, https://github.com/fdlamotte/meshcore-cli
|
|
6
|
-
Project-URL: Issues, https://github.com/fdlamotte/meshcore-cli/issues
|
|
7
|
-
Author-email: Florent de Lamotte <florent@frizoncorrea.fr>
|
|
8
|
-
License-Expression: MIT
|
|
9
|
-
License-File: LICENSE
|
|
10
|
-
Classifier: Operating System :: OS Independent
|
|
11
|
-
Classifier: Programming Language :: Python :: 3
|
|
12
|
-
Requires-Python: >=3.10
|
|
13
|
-
Requires-Dist: bleak>=0.22
|
|
14
|
-
Requires-Dist: meshcore>=2.3.16
|
|
15
|
-
Requires-Dist: prompt-toolkit>=3.0.50
|
|
16
|
-
Requires-Dist: requests>=2.28.0
|
|
17
|
-
Description-Content-Type: text/markdown
|
|
18
|
-
|
|
19
1
|
# meshcore-cli
|
|
20
2
|
|
|
21
3
|
meshcore-cli : CLI interface to MeshCore companion app over BLE, TCP or Serial
|
|
@@ -111,8 +93,11 @@ Commands are given after arguments, they can be chained and some have shortcuts.
|
|
|
111
93
|
alias <key> <cmd> : create an alias for key, see ?alias
|
|
112
94
|
aliases : list all aliases
|
|
113
95
|
aliases_load : load aliases from a file
|
|
114
|
-
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)
|
|
115
97
|
handler_detach <n> : detach an handler (from its handle n)
|
|
98
|
+
timer <s> <c> : runs command c every s seconds
|
|
99
|
+
timer_cancel <n> : cancels a timer (from its handle n)
|
|
100
|
+
timers : lists current timers
|
|
116
101
|
Messaging
|
|
117
102
|
msg <name> <msg> : send message to node by name m {
|
|
118
103
|
wait_ack : wait an ack wa }
|
|
@@ -153,6 +138,7 @@ Commands are given after arguments, they can be chained and some have shortcuts.
|
|
|
153
138
|
change_path <ct> <pth> : change the path to a contact cp
|
|
154
139
|
change_flags <ct> <f> : change contact flags (tel_l|tel_a|star)cf
|
|
155
140
|
req_telemetry <ct> : prints telemetry data as json rt
|
|
141
|
+
sub_telemetry : subscribes to push telemetry
|
|
156
142
|
req_mma <ct> : requests min/max/avg for a sensor rm
|
|
157
143
|
req_acl <ct> : requests access control list for sensor
|
|
158
144
|
pending_contacts : show pending contacts
|
|
@@ -238,7 +224,7 @@ Aliases can be saved using a redirection `> filename aliases` and loaded from a
|
|
|
238
224
|
|
|
239
225
|
#### Handlers
|
|
240
226
|
|
|
241
|
-
Shell processes can be attached to `rxlog` or `
|
|
227
|
+
Shell processes can be attached to `rxlog`, `msgs`, `chan_data` or `telemetry` using `handler_attach` and `handler_detach` commands.
|
|
242
228
|
|
|
243
229
|
For instance:
|
|
244
230
|
```
|
|
@@ -247,6 +233,18 @@ handler_attach rxlog cat
|
|
|
247
233
|
|
|
248
234
|
Will print out the content of `rx_log` as it comes in.
|
|
249
235
|
|
|
236
|
+
#### Timers
|
|
237
|
+
|
|
238
|
+
`timer [-j] [-c<contact>] [-s<scope>] <s> <line>` runs `line` every `s` seconds.
|
|
239
|
+
|
|
240
|
+
- `-c` sets the contact the line is run from (`~` for root).
|
|
241
|
+
- `-s` sets the scope for the line (default is the current scope of the node).
|
|
242
|
+
- `-j` forces json output for the timed line.
|
|
243
|
+
|
|
244
|
+
`timers` lists the running timers and `timer_cancel <n>` cancels timer `n`.
|
|
245
|
+
|
|
246
|
+
From the command line, timers only run while a command is waiting, so end the command list with `sleep <s>` or `wk` (`meshcli timer 60 "chan 1 hi" sleep 3600`). In chat mode, a `sleep` or `wk` holds up timers until it returns.
|
|
247
|
+
|
|
250
248
|
### Contact management
|
|
251
249
|
|
|
252
250
|
To receive a message from another user, it is necessary to have its public key. This key is stored on a contact list in the device, and this list has a finite size (50 when meshcore started, now over 350 for most devices).
|
|
@@ -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.12"
|
|
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.12"
|
|
39
39
|
|
|
40
40
|
# default ble address is stored in a config file
|
|
41
41
|
MCCLI_CONFIG_DIR = os.path.expanduser("~/.config/meshcore/")
|
|
@@ -118,10 +118,16 @@ 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
|
|
124
125
|
|
|
126
|
+
# Timers for repeating commands
|
|
127
|
+
TIMERS = {}
|
|
128
|
+
LAST_TIMER_ID = 0
|
|
129
|
+
CMD_LOCK = asyncio.Lock()
|
|
130
|
+
|
|
125
131
|
# is the companion supposed to have cli
|
|
126
132
|
HAS_CLI_CMD = False
|
|
127
133
|
|
|
@@ -156,6 +162,15 @@ LC_SORT_ORDER = ""
|
|
|
156
162
|
|
|
157
163
|
LAST_DISCOVERED_NODES = []
|
|
158
164
|
|
|
165
|
+
def parse_duration(s, unit="s"):
|
|
166
|
+
mult = {"s": 1, "m": 60, "h": 3600, "d": 86400}
|
|
167
|
+
s = str(s).strip()
|
|
168
|
+
if s and s[-1] in mult:
|
|
169
|
+
unit = s[-1]
|
|
170
|
+
s = s[:-1]
|
|
171
|
+
secs = float(s) * mult[unit]
|
|
172
|
+
return secs
|
|
173
|
+
|
|
159
174
|
def time_ago_from_timestamp (timestamp):
|
|
160
175
|
if timestamp == 0:
|
|
161
176
|
return "0"
|
|
@@ -227,6 +242,23 @@ def enqueue_handler_event(handler_type, payload):
|
|
|
227
242
|
except asyncio.QueueFull:
|
|
228
243
|
logger.warning(f"Handler {handler['id']} queue is full; dropping event")
|
|
229
244
|
|
|
245
|
+
async def run_timer(mc, timer):
|
|
246
|
+
while True:
|
|
247
|
+
await asyncio.sleep(timer["secs"])
|
|
248
|
+
async with CMD_LOCK:
|
|
249
|
+
base = set_scope.current_scope
|
|
250
|
+
if base is None:
|
|
251
|
+
base = ""
|
|
252
|
+
try:
|
|
253
|
+
if timer["scope"] != base:
|
|
254
|
+
await set_scope(mc, timer["scope"])
|
|
255
|
+
await process_redirected_line(mc, timer["cmd"], timer["contact"], timer["scope"], None, base, json_output=timer["json"], sink=sys.stdout)
|
|
256
|
+
except Exception as e:
|
|
257
|
+
logger.error(f"Timer {timer['id']}: {e}")
|
|
258
|
+
finally:
|
|
259
|
+
if timer["scope"] != base:
|
|
260
|
+
await set_scope(mc, base)
|
|
261
|
+
|
|
230
262
|
async def write_handler(handler):
|
|
231
263
|
try:
|
|
232
264
|
while True:
|
|
@@ -523,6 +555,9 @@ handle_log_rx.advert_echoes = False
|
|
|
523
555
|
handle_log_rx.mc = None
|
|
524
556
|
handle_log_rx.echo_unk_chans=False
|
|
525
557
|
|
|
558
|
+
async def handle_telemetry(event):
|
|
559
|
+
enqueue_handler_event("telemetry", event.payload)
|
|
560
|
+
|
|
526
561
|
async def handle_advert(event):
|
|
527
562
|
if not handle_advert.print_adverts:
|
|
528
563
|
return
|
|
@@ -745,15 +780,20 @@ def make_completion_dict(contacts, pending=None, to=None, channels=None):
|
|
|
745
780
|
"aliases" : None,
|
|
746
781
|
"aliases_load" : None,
|
|
747
782
|
"alias" : None,
|
|
748
|
-
"handler_attach": {"rxlog":None, "msgs":None, "chan_data":None},
|
|
783
|
+
"handler_attach": {"rxlog":None, "msgs":None, "chan_data":None, "telemetry":None},
|
|
749
784
|
"handler_detach": None,
|
|
750
785
|
"handlers": None,
|
|
786
|
+
"timer": None,
|
|
787
|
+
"timer_cancel": None,
|
|
788
|
+
"timers": None,
|
|
751
789
|
"login" : contact_list,
|
|
752
790
|
"cmd" : contact_list,
|
|
753
791
|
"req_status" : contact_list,
|
|
754
792
|
"req_neighbours": contact_list,
|
|
755
793
|
"logout" : contact_list,
|
|
756
794
|
"req_telemetry" : contact_list,
|
|
795
|
+
"sub_telemetry" : contact_list,
|
|
796
|
+
"unsub_telemetry" : contact_list,
|
|
757
797
|
"req_binary" : contact_list,
|
|
758
798
|
"req_mma" : contact_list,
|
|
759
799
|
"req_owner" : contact_list,
|
|
@@ -905,6 +945,7 @@ def make_completion_dict(contacts, pending=None, to=None, channels=None):
|
|
|
905
945
|
"?scope":None,
|
|
906
946
|
"?contact_info":None,
|
|
907
947
|
"?apply_to":None,
|
|
948
|
+
"?timer":None,
|
|
908
949
|
"?at":None,
|
|
909
950
|
"?lc":None,
|
|
910
951
|
"?node_discover":None,
|
|
@@ -944,8 +985,11 @@ def make_completion_dict(contacts, pending=None, to=None, channels=None):
|
|
|
944
985
|
"change_flags" : None,
|
|
945
986
|
"reset_advert_time" : None,
|
|
946
987
|
"req_telemetry" : None,
|
|
988
|
+
"sub_telemetry" : None,
|
|
989
|
+
"unsub_telemetry" : None,
|
|
947
990
|
"req_binary" : None,
|
|
948
991
|
"forget_password" : None,
|
|
992
|
+
"timer" : None,
|
|
949
993
|
}
|
|
950
994
|
|
|
951
995
|
client_completion_list = dict(contact_completion_list)
|
|
@@ -1167,9 +1211,6 @@ Some cmds have an help accessible with ?<cmd>. Do ?[Tab] to get a list.
|
|
|
1167
1211
|
|
|
1168
1212
|
last_ack = True
|
|
1169
1213
|
while True:
|
|
1170
|
-
# reset scope (if changed)
|
|
1171
|
-
scope = await set_scope(mc, scope)
|
|
1172
|
-
|
|
1173
1214
|
# reset sink to stdout
|
|
1174
1215
|
sink = sys.stdout
|
|
1175
1216
|
|
|
@@ -1273,40 +1314,15 @@ Some cmds have an help accessible with ?<cmd>. Do ?[Tab] to get a list.
|
|
|
1273
1314
|
if line == "quit" or line == "q" or line == "/quit" or line == "/q" :
|
|
1274
1315
|
break
|
|
1275
1316
|
|
|
1276
|
-
if line.startswith("@") and len(line) > 1: # alias => replace and resolve parameters
|
|
1277
|
-
args = shlex.split(line[1:])
|
|
1278
|
-
try:
|
|
1279
|
-
alias = ALIASES[args[0]]
|
|
1280
|
-
|
|
1281
|
-
if has_placeholder(alias, "c"):
|
|
1282
|
-
if not contact is None and contact["type"] > 0:
|
|
1283
|
-
keywords = {"c": contact['adv_name']}
|
|
1284
|
-
pargs = args[1:]
|
|
1285
|
-
else:
|
|
1286
|
-
keywords = {"c": args[1]}
|
|
1287
|
-
pargs = args[2:]
|
|
1288
|
-
else:
|
|
1289
|
-
keywords = {}
|
|
1290
|
-
pargs = args[1:]
|
|
1291
|
-
|
|
1292
|
-
line = formatter.format(alias, *pargs, **keywords)
|
|
1293
|
-
except IndexError as e:
|
|
1294
|
-
logger.error(f"Error {e}")
|
|
1295
|
-
continue
|
|
1296
|
-
except KeyError as e:
|
|
1297
|
-
logger.error(f"Error {e}")
|
|
1298
|
-
continue
|
|
1299
|
-
except ValueError as e:
|
|
1300
|
-
logger.error(f"Error {e}")
|
|
1301
|
-
continue
|
|
1302
|
-
|
|
1303
1317
|
jo = json_output
|
|
1304
1318
|
if line.startswith(".") : # toggle json-output for this loop
|
|
1305
1319
|
jo = True
|
|
1306
1320
|
line = line[1:].strip()
|
|
1307
1321
|
|
|
1308
1322
|
try:
|
|
1309
|
-
|
|
1323
|
+
async with CMD_LOCK:
|
|
1324
|
+
scope = await set_scope(mc, scope) # reset scope (if changed)
|
|
1325
|
+
(new_contact, new_scope, last_ack) = await process_redirected_line(mc, line, contact, scope, prev_contact, prev_scope, json_output=jo, sink=sink)
|
|
1310
1326
|
except Exception as e:
|
|
1311
1327
|
logger.error(f"Unexpected error: {e}")
|
|
1312
1328
|
logger.debug(traceback.format_exc())
|
|
@@ -1327,14 +1343,37 @@ Some cmds have an help accessible with ?<cmd>. Do ?[Tab] to get a list.
|
|
|
1327
1343
|
# Handle task cancellation from KeyboardInterrupt in asyncio.run()
|
|
1328
1344
|
sink.write("Exiting cli\n")
|
|
1329
1345
|
sink.flush()
|
|
1346
|
+
finally:
|
|
1347
|
+
for nb in list(TIMERS):
|
|
1348
|
+
TIMERS.pop(nb)["task"].cancel()
|
|
1330
1349
|
|
|
1331
1350
|
if platform.system() == "Darwin" or platform.system() == "Windows":
|
|
1332
1351
|
interactive_loop.classic = True
|
|
1333
1352
|
else:
|
|
1334
1353
|
interactive_loop.classic = False
|
|
1335
1354
|
|
|
1336
|
-
|
|
1337
1355
|
async def process_redirected_line(mc, line, contact=None, scope="*", prev_contact=None, prev_scope="*", json_output=False, sink=sys.stdout, end="\n"):
|
|
1356
|
+
if line.startswith("@") and len(line) > 1: # alias => replace and resolve parameters
|
|
1357
|
+
try:
|
|
1358
|
+
args = shlex.split(line[1:])
|
|
1359
|
+
alias = ALIASES[args[0]]
|
|
1360
|
+
|
|
1361
|
+
if has_placeholder(alias, "c"):
|
|
1362
|
+
if not contact is None and contact["type"] > 0:
|
|
1363
|
+
keywords = {"c": contact['adv_name']}
|
|
1364
|
+
pargs = args[1:]
|
|
1365
|
+
else:
|
|
1366
|
+
keywords = {"c": args[1]}
|
|
1367
|
+
pargs = args[2:]
|
|
1368
|
+
else:
|
|
1369
|
+
keywords = {}
|
|
1370
|
+
pargs = args[1:]
|
|
1371
|
+
|
|
1372
|
+
line = formatter.format(alias, *pargs, **keywords)
|
|
1373
|
+
except (IndexError, KeyError, ValueError) as e:
|
|
1374
|
+
logger.error(f"Error {e}")
|
|
1375
|
+
return contact, scope, True
|
|
1376
|
+
|
|
1338
1377
|
new_contact = contact
|
|
1339
1378
|
new_scope = scope
|
|
1340
1379
|
last_ack = True
|
|
@@ -1759,7 +1798,7 @@ async def process_contact_chat_line(mc, contact, line, inside=False, json_output
|
|
|
1759
1798
|
|
|
1760
1799
|
if line.startswith("sleep ") or line.startswith("s "):
|
|
1761
1800
|
try:
|
|
1762
|
-
sleeptime =
|
|
1801
|
+
sleeptime = parse_duration(line.split(" ",2)[1])
|
|
1763
1802
|
cmd_pos = 2
|
|
1764
1803
|
except IndexError: # nothing arg after sleep
|
|
1765
1804
|
sleeptime = 1
|
|
@@ -1798,6 +1837,7 @@ async def process_contact_chat_line(mc, contact, line, inside=False, json_output
|
|
|
1798
1837
|
line.startswith("path ") or line == "path" or\
|
|
1799
1838
|
line.startswith("advert_path") or line == "ap" or line.startswith("ap ") or\
|
|
1800
1839
|
line.startswith("reset_advert_time") or\
|
|
1840
|
+
line.startswith("unsub_telemetry") or\
|
|
1801
1841
|
line.startswith("logout") :
|
|
1802
1842
|
args = [line.split()[0], contact['adv_name']]
|
|
1803
1843
|
out_str = ""
|
|
@@ -1817,7 +1857,7 @@ async def process_contact_chat_line(mc, contact, line, inside=False, json_output
|
|
|
1817
1857
|
|
|
1818
1858
|
if line.startswith("set timeout "):
|
|
1819
1859
|
cmds=line.split(" ")
|
|
1820
|
-
contact["timeout"] =
|
|
1860
|
+
contact["timeout"] = parse_duration(cmds[2])
|
|
1821
1861
|
return True
|
|
1822
1862
|
|
|
1823
1863
|
if line == "get timeout":
|
|
@@ -1889,6 +1929,12 @@ async def process_contact_chat_line(mc, contact, line, inside=False, json_output
|
|
|
1889
1929
|
# same but for commands with a parameter
|
|
1890
1930
|
if " " in line:
|
|
1891
1931
|
cmds = line.split(" ", 1)
|
|
1932
|
+
|
|
1933
|
+
if cmds[0] == "timer": # timer on this contact (a user-given -c still overrides)
|
|
1934
|
+
args = shlex.split(line, posix=True)
|
|
1935
|
+
await process_cmds(mc, args[:1] + ["-c" + contact["adv_name"]] + args[1:], json_output=json_output, sink=sink)
|
|
1936
|
+
return True
|
|
1937
|
+
|
|
1892
1938
|
if "%" in cmds[0]:
|
|
1893
1939
|
dest_scope = cmds[0].split("%")[-1]
|
|
1894
1940
|
cmds[0] = cmds[0][:-len(dest_scope)-1]
|
|
@@ -1906,6 +1952,12 @@ async def process_contact_chat_line(mc, contact, line, inside=False, json_output
|
|
|
1906
1952
|
await process_cmds(mc, args, json_output=json_output, sink=sink)
|
|
1907
1953
|
return True
|
|
1908
1954
|
|
|
1955
|
+
cmds = line.split(" ")
|
|
1956
|
+
if cmds[0] == "sub_telemetry":
|
|
1957
|
+
args = [cmds[0], contact['adv_name'], cmds[1], cmds[2]]
|
|
1958
|
+
await process_cmds(mc, args, json_output=json_output, sink=sink)
|
|
1959
|
+
return True
|
|
1960
|
+
|
|
1909
1961
|
if line == "login": # use stored password or prompt for it
|
|
1910
1962
|
password_file = ""
|
|
1911
1963
|
password = ""
|
|
@@ -1975,12 +2027,8 @@ async def apply_command_to_contacts(mc, contact_filter, line, json_output=False,
|
|
|
1975
2027
|
elif f[0] == "u": #updated
|
|
1976
2028
|
val_str = f[2:]
|
|
1977
2029
|
t = time.time()
|
|
1978
|
-
if val_str[-1]
|
|
1979
|
-
t = t -
|
|
1980
|
-
elif val_str[-1] == "h": # value in hours
|
|
1981
|
-
t = t - float(val_str[0:-1]) * 3600
|
|
1982
|
-
elif val_str[-1] == "m": # value in minutes
|
|
1983
|
-
t = t - float(val_str[0:-1]) * 60
|
|
2030
|
+
if val_str[-1] in "smhd": # age
|
|
2031
|
+
t = t - parse_duration(val_str)
|
|
1984
2032
|
else:
|
|
1985
2033
|
t = int(val_str)
|
|
1986
2034
|
if f[1] == "<": #before
|
|
@@ -1993,12 +2041,8 @@ async def apply_command_to_contacts(mc, contact_filter, line, json_output=False,
|
|
|
1993
2041
|
elif f[0] == "a": # last advert
|
|
1994
2042
|
val_str = f[2:]
|
|
1995
2043
|
t = time.time()
|
|
1996
|
-
if val_str[-1]
|
|
1997
|
-
t = t -
|
|
1998
|
-
elif val_str[-1] == "h": # value in hours
|
|
1999
|
-
t = t - float(val_str[0:-1]) * 3600
|
|
2000
|
-
elif val_str[-1] == "m": # value in minutes
|
|
2001
|
-
t = t - float(val_str[0:-1]) * 60
|
|
2044
|
+
if val_str[-1] in "smhd": # age
|
|
2045
|
+
t = t - parse_duration(val_str)
|
|
2002
2046
|
else:
|
|
2003
2047
|
t = int(val_str)
|
|
2004
2048
|
if f[1] == "<": #before
|
|
@@ -2421,7 +2465,7 @@ async def next_cmd(mc, cmds, json_output=False, sink=sys.stdout, end="\n"):
|
|
|
2421
2465
|
""" process next command
|
|
2422
2466
|
returns (following, output_str)
|
|
2423
2467
|
"""
|
|
2424
|
-
global ARROW_HEAD, SLASH_START, SLASH_END, INVERT_SLASH, LAST_HANDLER_ID
|
|
2468
|
+
global ARROW_HEAD, SLASH_START, SLASH_END, INVERT_SLASH, LAST_HANDLER_ID, LAST_TIMER_ID
|
|
2425
2469
|
global LC_DISPLAY_TYPES, LC_OUTPUT_FORMAT, LC_SORT_ORDER
|
|
2426
2470
|
global LAST_DISCOVERED_NODES
|
|
2427
2471
|
output_str = ""
|
|
@@ -3481,7 +3525,7 @@ async def next_cmd(mc, cmds, json_output=False, sink=sys.stdout, end="\n"):
|
|
|
3481
3525
|
else:
|
|
3482
3526
|
output_str += f"Unknown contact {cmds[1]}{end}"
|
|
3483
3527
|
else:
|
|
3484
|
-
contact["timeout"] =
|
|
3528
|
+
contact["timeout"] = parse_duration(cmds[2])
|
|
3485
3529
|
|
|
3486
3530
|
case "disc_path" | "dp" :
|
|
3487
3531
|
argnum = 1
|
|
@@ -3728,6 +3772,53 @@ async def next_cmd(mc, cmds, json_output=False, sink=sys.stdout, end="\n"):
|
|
|
3728
3772
|
"lpp": res,
|
|
3729
3773
|
}, indent = 4) + end
|
|
3730
3774
|
|
|
3775
|
+
case "sub_telemetry" :
|
|
3776
|
+
argnum = 3
|
|
3777
|
+
await mc.ensure_contacts()
|
|
3778
|
+
contact = await get_contact_from_arg(mc, cmds[1])
|
|
3779
|
+
if contact is None:
|
|
3780
|
+
if json_output :
|
|
3781
|
+
output_str += json.dumps({"error" : "unknown contact"})+end
|
|
3782
|
+
else:
|
|
3783
|
+
output_str += f"Unknown contact {cmds[1]}{end}"
|
|
3784
|
+
else:
|
|
3785
|
+
duration = int(parse_duration(cmds[2]))
|
|
3786
|
+
if cmds[3].startswith('[') or cmds[3].startswith('{'): # json
|
|
3787
|
+
min_deltas = json.loads(cmds[3])
|
|
3788
|
+
else: # custom formating: chan:type:value,
|
|
3789
|
+
min_deltas = []
|
|
3790
|
+
for d in cmds[3].split(","):
|
|
3791
|
+
fields = d.split(":")
|
|
3792
|
+
if len(fields) < 3:
|
|
3793
|
+
raise(ValueError(f"incorrect encoding for min_delta: {d}"))
|
|
3794
|
+
try:
|
|
3795
|
+
lpp_type = int(fields[1])
|
|
3796
|
+
except ValueError:
|
|
3797
|
+
lpp_type = fields[1]
|
|
3798
|
+
min_deltas.append({
|
|
3799
|
+
"channel": int(fields[0]),
|
|
3800
|
+
"type": lpp_type,
|
|
3801
|
+
"value": float(fields[2]),
|
|
3802
|
+
})
|
|
3803
|
+
timeout = 0 if not "timeout" in contact else contact["timeout"]
|
|
3804
|
+
res = await mc.commands.telemetry_subscribe(contact, duration, min_deltas, timeout=timeout)
|
|
3805
|
+
output_str += str(res) + end
|
|
3806
|
+
|
|
3807
|
+
case "unsub_telemetry" :
|
|
3808
|
+
argnum = 1
|
|
3809
|
+
await mc.ensure_contacts()
|
|
3810
|
+
contact = await get_contact_from_arg(mc, cmds[1])
|
|
3811
|
+
if contact is None:
|
|
3812
|
+
if json_output :
|
|
3813
|
+
output_str += json.dumps({"error" : "unknown contact"})+end
|
|
3814
|
+
else:
|
|
3815
|
+
output_str += f"Unknown contact {cmds[1]}{end}"
|
|
3816
|
+
else:
|
|
3817
|
+
timeout = 0 if not "timeout" in contact else contact["timeout"]
|
|
3818
|
+
res = await mc.commands.req_unsubscribe_sync(contact)
|
|
3819
|
+
output_str += "OK" if res else "ERROR"
|
|
3820
|
+
output_str += end
|
|
3821
|
+
|
|
3731
3822
|
case "req_status"|"rs" :
|
|
3732
3823
|
argnum = 1
|
|
3733
3824
|
contact = await get_contact_from_arg(mc, cmds[1])
|
|
@@ -3757,22 +3848,8 @@ async def next_cmd(mc, cmds, json_output=False, sink=sys.stdout, end="\n"):
|
|
|
3757
3848
|
else:
|
|
3758
3849
|
output_str += f"Unknown contact {cmds[1]}{end}"
|
|
3759
3850
|
else:
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
elif cmds[2][-1] == "m":
|
|
3763
|
-
from_secs = int(cmds[2][0:-1]) * 60
|
|
3764
|
-
elif cmds[2][-1] == "h":
|
|
3765
|
-
from_secs = int(cmds[2][0:-1]) * 3600
|
|
3766
|
-
else :
|
|
3767
|
-
from_secs = int(cmds[2]) * 60 # same as tdeck
|
|
3768
|
-
if cmds[3][-1] == "s":
|
|
3769
|
-
to_secs = int(cmds[3][0:-1])
|
|
3770
|
-
elif cmds[3][-1] == "m":
|
|
3771
|
-
to_secs = int(cmds[3][0:-1]) * 60
|
|
3772
|
-
elif cmds[3][-1] == "h":
|
|
3773
|
-
to_secs = int(cmds[3][0:-1]) * 3600
|
|
3774
|
-
else :
|
|
3775
|
-
to_secs = int(cmds[3]) * 60
|
|
3851
|
+
from_secs = int(parse_duration(cmds[2], "m")) # minutes by default, same as tdeck
|
|
3852
|
+
to_secs = int(parse_duration(cmds[3], "m"))
|
|
3776
3853
|
timeout = 0 if not "timeout" in contact else contact["timeout"]
|
|
3777
3854
|
res = await mc.commands.req_mma_sync(contact, from_secs, to_secs, timeout)
|
|
3778
3855
|
if res is None :
|
|
@@ -4386,7 +4463,7 @@ async def next_cmd(mc, cmds, json_output=False, sink=sys.stdout, end="\n"):
|
|
|
4386
4463
|
|
|
4387
4464
|
case "sleep" | "s" :
|
|
4388
4465
|
argnum = 1
|
|
4389
|
-
await asyncio.sleep(
|
|
4466
|
+
await asyncio.sleep(parse_duration(cmds[1]))
|
|
4390
4467
|
|
|
4391
4468
|
case "wait_key" | "wk" :
|
|
4392
4469
|
try :
|
|
@@ -4410,7 +4487,7 @@ async def next_cmd(mc, cmds, json_output=False, sink=sys.stdout, end="\n"):
|
|
|
4410
4487
|
|
|
4411
4488
|
case "trywait_msg" | "wmt" :
|
|
4412
4489
|
argnum = 1
|
|
4413
|
-
if await mc.wait_for_event(EventType.MESSAGES_WAITING, timeout=
|
|
4490
|
+
if await mc.wait_for_event(EventType.MESSAGES_WAITING, timeout=parse_duration(cmds[1])) :
|
|
4414
4491
|
res = await mc.commands.get_msg()
|
|
4415
4492
|
logger.debug(res)
|
|
4416
4493
|
output_str += await process_event_message(mc, res, json_output)
|
|
@@ -4502,7 +4579,7 @@ async def next_cmd(mc, cmds, json_output=False, sink=sys.stdout, end="\n"):
|
|
|
4502
4579
|
process = None
|
|
4503
4580
|
|
|
4504
4581
|
try:
|
|
4505
|
-
if not htype in ["msgs", "rxlog", "chan_data"]:
|
|
4582
|
+
if not htype in ["msgs", "rxlog", "chan_data", "telemetry"]:
|
|
4506
4583
|
raise ValueError (f"Unknown handler type {htype}")
|
|
4507
4584
|
process = await asyncio.create_subprocess_exec(
|
|
4508
4585
|
*shlex.split(cmd, posix=True),
|
|
@@ -4540,7 +4617,7 @@ async def next_cmd(mc, cmds, json_output=False, sink=sys.stdout, end="\n"):
|
|
|
4540
4617
|
case "handler_detach":
|
|
4541
4618
|
argnum = 1
|
|
4542
4619
|
nb = int(cmds[1])
|
|
4543
|
-
handlers = HANDLERS["msgs"]|HANDLERS["rxlog"]|HANDLERS["chan_data"]
|
|
4620
|
+
handlers = HANDLERS["msgs"]|HANDLERS["rxlog"]|HANDLERS["chan_data"]|HANDLERS["telemetry"]
|
|
4544
4621
|
handler = handlers[nb]
|
|
4545
4622
|
handler["closed"] = True
|
|
4546
4623
|
for task_name in ("writer_task", "output_task"):
|
|
@@ -4570,6 +4647,86 @@ async def next_cmd(mc, cmds, json_output=False, sink=sys.stdout, end="\n"):
|
|
|
4570
4647
|
case "handlers":
|
|
4571
4648
|
output_str += json.dumps(HANDLERS, default=str)+end
|
|
4572
4649
|
|
|
4650
|
+
case "timer":
|
|
4651
|
+
argnum = 2 # [-j] [-c<contact>] [-s<scope>] secs line
|
|
4652
|
+
t_contact = None
|
|
4653
|
+
t_scope = set_scope.current_scope
|
|
4654
|
+
if t_scope is None:
|
|
4655
|
+
t_scope = ""
|
|
4656
|
+
t_json = json_output
|
|
4657
|
+
valid = True
|
|
4658
|
+
|
|
4659
|
+
args = cmds[1:]
|
|
4660
|
+
while len(args) > 0 and args[0][0] == "-":
|
|
4661
|
+
argnum += 1
|
|
4662
|
+
|
|
4663
|
+
if args[0].startswith("-j"): # force json output for the timer
|
|
4664
|
+
t_json = True
|
|
4665
|
+
|
|
4666
|
+
if args[0].startswith("-c"): # contact (~ for root)
|
|
4667
|
+
c = args[0][2:]
|
|
4668
|
+
if c == "~" or c == "/":
|
|
4669
|
+
t_contact = None
|
|
4670
|
+
else:
|
|
4671
|
+
t_contact = await get_contact_from_arg(mc, c)
|
|
4672
|
+
if t_contact is None:
|
|
4673
|
+
if c == "public":
|
|
4674
|
+
t_contact = {"adv_name" : "public", "type" : 0, "chan_nb" : 0}
|
|
4675
|
+
if hasattr(mc, "channels"):
|
|
4676
|
+
t_contact["adv_name"] = mc.channels[0]["channel_name"]
|
|
4677
|
+
elif c.startswith("ch") and c[2:].isnumeric():
|
|
4678
|
+
nb = int(c[2:])
|
|
4679
|
+
t_contact = {"adv_name" : c, "type" : 0, "chan_nb" : nb}
|
|
4680
|
+
if hasattr(mc, "channels"):
|
|
4681
|
+
t_contact["adv_name"] = mc.channels[nb]["channel_name"]
|
|
4682
|
+
else:
|
|
4683
|
+
chan = await get_channel_by_name(mc, c)
|
|
4684
|
+
if chan is None:
|
|
4685
|
+
valid = False
|
|
4686
|
+
logger.error(f"Unknown contact {c}")
|
|
4687
|
+
else:
|
|
4688
|
+
t_contact = {"adv_name": chan["channel_name"],
|
|
4689
|
+
"type": 0,
|
|
4690
|
+
"chan_nb": chan["channel_idx"],}
|
|
4691
|
+
|
|
4692
|
+
if args[0].startswith("-s"): # scope
|
|
4693
|
+
t_scope = args[0][2:]
|
|
4694
|
+
|
|
4695
|
+
args = args[1:]
|
|
4696
|
+
|
|
4697
|
+
if valid:
|
|
4698
|
+
LAST_TIMER_ID = LAST_TIMER_ID + 1
|
|
4699
|
+
timer = {}
|
|
4700
|
+
timer["id"] = LAST_TIMER_ID
|
|
4701
|
+
timer["secs"] = parse_duration(args[0])
|
|
4702
|
+
timer["cmd"] = args[1]
|
|
4703
|
+
timer["scope"] = t_scope
|
|
4704
|
+
timer["contact"] = t_contact
|
|
4705
|
+
timer["json"] = t_json
|
|
4706
|
+
timer["task"] = asyncio.create_task(run_timer(mc, timer))
|
|
4707
|
+
TIMERS[LAST_TIMER_ID] = timer
|
|
4708
|
+
if json_output:
|
|
4709
|
+
output_str += json.dumps(timer, default=str)+end
|
|
4710
|
+
else:
|
|
4711
|
+
output_str += f"New timer {timer['id']}{end}"
|
|
4712
|
+
|
|
4713
|
+
case "timer_cancel":
|
|
4714
|
+
argnum = 1
|
|
4715
|
+
nb = int(cmds[1])
|
|
4716
|
+
timer = TIMERS.pop(nb)
|
|
4717
|
+
timer["task"].cancel()
|
|
4718
|
+
try:
|
|
4719
|
+
await timer["task"]
|
|
4720
|
+
except asyncio.CancelledError:
|
|
4721
|
+
pass
|
|
4722
|
+
if json_output:
|
|
4723
|
+
output_str += json.dumps({"timer": timer, "status": "cancelled"}, default=str)+end
|
|
4724
|
+
else:
|
|
4725
|
+
output_str += f"Cancelled timer {nb} of cmd {timer['cmd']}{end}"
|
|
4726
|
+
|
|
4727
|
+
case "timers":
|
|
4728
|
+
output_str += json.dumps(TIMERS, default=str)+end
|
|
4729
|
+
|
|
4573
4730
|
case "chat" | "im" | "interactive":
|
|
4574
4731
|
# kept for retrocompatibility, but this is now not
|
|
4575
4732
|
# allowed to do chat from chat so this will break the loop
|
|
@@ -4650,8 +4807,11 @@ def command_help():
|
|
|
4650
4807
|
alias <key> <cmd> : create an alias for key, see ?alias
|
|
4651
4808
|
aliases : list all aliases
|
|
4652
4809
|
aliases_load : load aliases from a file
|
|
4653
|
-
handler_attach <d> <c> : attach c as a handler for d
|
|
4810
|
+
handler_attach <d> <c> : attach c as a handler for d
|
|
4654
4811
|
handler_detach <n> : detach an handler (from its handle n)
|
|
4812
|
+
timer <s> <c> : runs command c every s seconds
|
|
4813
|
+
timer_cancel <n> : cancels a timer (from its handle n)
|
|
4814
|
+
timers : lists current timers
|
|
4655
4815
|
Messaging
|
|
4656
4816
|
msg <name> <msg> : send message to node by name m {
|
|
4657
4817
|
wait_ack : wait an ack wa }
|
|
@@ -4696,6 +4856,8 @@ def command_help():
|
|
|
4696
4856
|
change_flags <ct> <f> : change contact flags (tel_l|tel_a|star)cf
|
|
4697
4857
|
req_acl <ct> : requests access control list for node ra
|
|
4698
4858
|
req_telemetry <ct> : prints telemetry data as json rt
|
|
4859
|
+
sub_telemetry c d md : subscribe to pushed telemetry
|
|
4860
|
+
unsub_telemetry c : unsubscribe to pushed telemetry
|
|
4699
4861
|
req_regions <ct> : prints regions from repeater rr
|
|
4700
4862
|
req_owner <ct> : prints owner for a repeater ro
|
|
4701
4863
|
req_clock <ct> : prints repeater timestamp (for sync)
|
|
@@ -5063,6 +5225,50 @@ Output format is given as a string with one character by field. Name is always d
|
|
|
5063
5225
|
d: distance (in km)
|
|
5064
5226
|
b: flag bits (as hex)
|
|
5065
5227
|
Use get/set lc_output_format to get or set default value
|
|
5228
|
+
""")
|
|
5229
|
+
|
|
5230
|
+
elif "telemetry" in cmdname :
|
|
5231
|
+
print("""req_telemetry/sub_telemetry/unsub_telemetry: telemetry management in meshcore-cli
|
|
5232
|
+
|
|
5233
|
+
There are two ways to deal with telemetry in meshcore:
|
|
5234
|
+
|
|
5235
|
+
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.
|
|
5236
|
+
|
|
5237
|
+
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.
|
|
5238
|
+
|
|
5239
|
+
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).
|
|
5240
|
+
|
|
5241
|
+
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>`.
|
|
5242
|
+
|
|
5243
|
+
To unsubscribe to pushed telemetry call `unsub_telemetry
|
|
5244
|
+
|
|
5245
|
+
""")
|
|
5246
|
+
|
|
5247
|
+
elif "handler" in cmdname :
|
|
5248
|
+
print("""handler_attach/handler_detach/handlers: special handling for incoming data
|
|
5249
|
+
|
|
5250
|
+
meshcore-cli lets you attach shell process to msg rx_log chan_data or telemetry
|
|
5251
|
+
|
|
5252
|
+
* `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.
|
|
5253
|
+
|
|
5254
|
+
* `handler_detach <n>` detaches handler with number `n`
|
|
5255
|
+
* `handlers` lists current handlers
|
|
5256
|
+
""")
|
|
5257
|
+
|
|
5258
|
+
elif "timer" in cmdname:
|
|
5259
|
+
print("""timer [-j] [-c<contact>] [-s<scope>] <s> <line>: runs line every s seconds (s can be postfixed with s, m, h or d)
|
|
5260
|
+
|
|
5261
|
+
* args:
|
|
5262
|
+
- `-j` forces json output for the timed line.
|
|
5263
|
+
- `-c` sets the contact the line is run from (`~` for root).
|
|
5264
|
+
- `-s` sets the scope for the line, defaults to the current scope.
|
|
5265
|
+
|
|
5266
|
+
* `timer_cancel <n>` cancels timer number `n`
|
|
5267
|
+
* `timers` lists current timers
|
|
5268
|
+
|
|
5269
|
+
* Note:
|
|
5270
|
+
- The line has to be quoted if it has more than one word, redirections can be used inside the quotes.
|
|
5271
|
+
|
|
5066
5272
|
""")
|
|
5067
5273
|
|
|
5068
5274
|
else:
|
|
@@ -5593,7 +5799,7 @@ async def main(argv):
|
|
|
5593
5799
|
usage()
|
|
5594
5800
|
return
|
|
5595
5801
|
case "-T" :
|
|
5596
|
-
timeout =
|
|
5802
|
+
timeout = parse_duration(arg)
|
|
5597
5803
|
case "-v":
|
|
5598
5804
|
version()
|
|
5599
5805
|
return
|
|
@@ -5783,6 +5989,7 @@ async def main(argv):
|
|
|
5783
5989
|
mc.subscribe(EventType.PATH_UPDATE, handle_path_update)
|
|
5784
5990
|
mc.subscribe(EventType.NEW_CONTACT, handle_new_contact)
|
|
5785
5991
|
mc.subscribe(EventType.RX_LOG_DATA, handle_log_rx)
|
|
5992
|
+
mc.subscribe(EventType.PUSHED_TELEMETRY, handle_telemetry)
|
|
5786
5993
|
|
|
5787
5994
|
mc.auto_update_contacts = True
|
|
5788
5995
|
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
|