You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+66-61Lines changed: 66 additions & 61 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,9 +20,9 @@ If you want meshcore-cli to remember last BLE device, you should have some `$HOM
20
20
$ meshcli <args><commands>
21
21
</pre>
22
22
23
-
If using BLE, don't forget to pair your device first (using `bluetoothctl` for instance on Linux) or meshcli won't be able to communicate.
23
+
If using BLE, don't forget to pair your device first (using `bluetoothctl` for instance on Linux) or meshcli won't be able to communicate. There is a device selector for BLE, you'll just have to use `meshcli -S` to select your device, subsequent calls to meshcli will be send to that device.
24
24
25
-
## Configuration
25
+
###Configuration
26
26
27
27
Configuration files are stored in ```$HOME/.config/meshcore```
28
28
@@ -35,7 +35,7 @@ If there is an initialization script file called ```init```, it will be executed
35
35
Arguments mostly deals with ble connection
36
36
37
37
<pre>
38
-
-h : prints this help
38
+
-h : prints this help
39
39
-j : json output
40
40
-D : print debug messages
41
41
-S : BLE device selector
@@ -53,49 +53,68 @@ Arguments mostly deals with ble connection
53
53
Commands are given after arguments, they can be chained and some have shortcuts. Also prefixing a command with a dot ```.``` will force it to output json instead of synthetic result.
54
54
55
55
<pre>
56
-
General commands
56
+
General commands
57
57
chat : enter the chat (interactive) mode
58
-
chat_to <ct> : enter chat with contact to
59
-
script <file> : executes script stored in file
58
+
chat_to <ct> : enter chat with contact to
59
+
script <filename>: execute commands in filename
60
60
infos : print informations about the node i
61
61
card : export this node URI e
62
62
ver : firmware version v
63
63
reboot : reboots node
64
-
sleep <secs> : sleeps for a given amount of secs s
64
+
sleep <secs> : sleeps for a given amount of secs s
65
+
wait_key : wait until user presses <Enter> wk
65
66
Messenging
66
-
msg <name><msg> : send message to node by name m {
67
+
msg <name><msg> : send message to node by name m {
67
68
wait_ack : wait an ack wa }
68
-
chan <nb><msg> : send message to channel number <nb> ch
69
-
public : send message to public channel (0) dch
69
+
chan <nb><msg> : send message to channel number <nb> ch
70
+
public <msg> : send message to public channel (0) dch
70
71
recv : reads next msg r
71
-
sync_msgs : gets all unread msgs from the node sm
72
72
wait_msg : wait for a message and read it wm
73
+
sync_msgs : gets all unread msgs from the node sm
74
+
msgs_subscribe : display msgs as they arrive ms
73
75
Management
74
76
advert : sends advert a
75
77
floodadv : flood advert
76
-
get <param> : gets a param, "get help" for more
77
-
set <param><value> : sets a param, "set help" for more
78
-
time <epoch> : sets time to given epoch
78
+
get <param> : gets a param, "get help" for more
79
+
set <param><value> : sets a param, "set help" for more
80
+
time <epoch> : sets time to given epoch
79
81
clock : get current time
80
82
clock sync : sync device clock st
81
83
cli : send a cmd to node's cli (if avail) @
82
84
Contacts
83
85
contacts / list : gets contact list lc
84
-
share_contact <ct> : share a contact with others sc
85
-
export_contact <ct> : get a contact's URI ec
86
-
remove_contact <ct> : removes a contact from this node
87
-
reset_path <ct> : resets path to a contact to flood rp
88
-
change_path <ct><pth> : change the path to a contact cp
86
+
share_contact <ct> : share a contact with others sc
87
+
export_contact <ct> : get a contact's URI ec
88
+
remove_contact <ct> : removes a contact from this node
89
+
reset_path <ct> : resets path to a contact to flood rp
90
+
change_path <ct><pth> : change the path to a contact cp
89
91
Repeaters
90
-
login <name><pwd> : log into a node (rep) with given pwd l [[
91
-
wait_login : wait for login (timeouts after 5sec) wl ]]
92
-
cmd <name><cmd> : sends a command to a repeater (no ack) c [
92
+
login <name><pwd> : log into a node (rep) with given pwd l
93
+
logout <name>: log out of a repeater
94
+
cmd <name><cmd> : sends a command to a repeater (no ack) c [
93
95
wmt8 : wait for a msg (reply) with a timeout ]
94
-
req_status <name> : requests status from a node rs
95
-
wait_status : wait and print reply ws
96
+
req_status <name> : requests status from a node rs
96
97
</pre>
97
98
98
-
### Examples
99
+
### Interactive Mode
100
+
101
+
aka Instant Message or chat mode ...
102
+
103
+
Chat mode lets you interactively interact with your node or remote nodes. It is automatically triggered when no option is given on the command line.
104
+
105
+
You'll get a prompt with the name of your node. From here you can type meshcore-cli commands. The prompt has history and a basic completion (pressing tab will display possible command or argument options).
106
+
107
+
The `to` command is specific to chat mode, it lets you enter the recipient for next command. By default you're on your node but you can enter other nodes or public rooms. Here are some examples :
108
+
*`to <nodename>` : will enter nodename
109
+
*`to /`, `to ~` : will go to the root (your node)
110
+
*`to ..` : will go to the last node (it will switch between the two last nodes, this is just a 1-depth history)
111
+
*`to !` : will switch to the node you received last message from
112
+
113
+
When you are connected to a node, the behaviour will depend on the node type, if you're on a chat node, it will send messages by default and you can chat. On a repeater or a room server, it will send commands (autocompletioin has been set to comply with the CommonCli class of meshcore). To send a message through a room you'll have to prefix the message with a quote or use the send command.
114
+
115
+
You can alse set a channel as recipient, `to public` will switch to the public channel, and `to ch1` to channel 1.
116
+
117
+
## Examples
99
118
100
119
<pre>
101
120
# gets info from first ble MC device it finds (was -s but now used for serial port)
@@ -131,32 +150,25 @@ INFO:meshcore:BLE Connection started
131
150
"time": 1744957249
132
151
}
133
152
134
-
# Using -j, meshcli will return a json array of replies ...
153
+
# Using -j, meshcli will return replies in json format ...
135
154
$ meshcli -j -a C2:2B:A1:D5:3E:B6 clock
136
-
[
137
155
{
138
156
"time": 1744957261
139
157
}
140
-
]
141
158
142
159
# So if I reboot the node, and want to set time, I can chain the commands
143
160
# and get that kind of output (even better by feeding it to jq)
144
161
$ meshcli reboot
145
162
INFO:meshcore:BLE Connection started
146
-
$ meshcli -j clock clock sync clock | jq
147
-
[
148
-
{
149
-
"time": 1715770360
150
-
},
151
-
{},
152
-
{
153
-
"time": 1744957460
154
-
}
155
-
]
163
+
$ meshcli -j clock clock sync clock | jq -c
164
+
{ "time": 1715770371 }
165
+
{ "ok": "time synced" }
166
+
{ "time": 1745996105 }
167
+
156
168
# Now check if time is ok with human output (I don't read epoch time yet)
157
169
$ meshcli clock
158
170
INFO:meshcore:BLE Connection started
159
-
Current time : 2025-04-18 08:26:25 (1744957585)
171
+
Current time : 2025-04-30 08:56:27 (1745996187)
160
172
161
173
# Now you'll probably want to send some messages ...
162
174
# For that, there is the msg command, wait_ack
@@ -172,33 +184,26 @@ INFO:meshcore:BLE Connection started
172
184
t114_fdl(0): Hello T-Echo
173
185
174
186
# And reply using json output for more verbosity
175
-
[
176
-
{
177
-
"type": 0,
178
-
"expected_ack": "83059275",
179
-
"suggested_timeout": 4446
180
-
},
181
-
{
182
-
"code": "83059275"
183
-
}
184
-
]
185
-
186
-
# But this could have been done easier using the chat mode
187
+
# here I've used jq with -cs to get a compact array
0 commit comments