meshcore-cli 0.3__tar.gz → 0.3.2__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: meshcore-cli
3
- Version: 0.3
3
+ Version: 0.3.2
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
@@ -10,27 +10,29 @@ License-File: LICENSE
10
10
  Classifier: Operating System :: OS Independent
11
11
  Classifier: Programming Language :: Python :: 3
12
12
  Requires-Python: >=3.10
13
- Requires-Dist: meshcore
13
+ Requires-Dist: meshcore>=0.3.2
14
14
  Description-Content-Type: text/markdown
15
15
 
16
- # mccli
16
+ # meshcore-cli
17
17
 
18
- mccli.py : CLI interface to MeschCore companion app over BLE, TCP or Serial
18
+ meshcore-cli : CLI interface to MeschCore companion app over BLE, TCP or Serial
19
19
 
20
20
  ## Install
21
21
 
22
- You should install (meshcore)[https://github.com/fdlamotte/meshcore_py] package first via pip.
22
+ Meshcore-cli depends on the [python meshcore](https://github.com/fdlamotte/meshcore_py) package. You can install both via `pip` or `pipx` using the command :
23
23
 
24
24
  <pre>
25
- $ pip install meshcore
25
+ $ pipx install meshcore-cli
26
26
  </pre>
27
27
 
28
- Then you can put `mccli.py` program in your path.
28
+ It will install you `meshcore-cli` and `meshcli`, which is an alias to the former.
29
+
30
+ If you want meshcore-cli to remember last BLE device, you should have some `$HOME/.config/meshcore` where configuration for meschcore-cli will be stored (if not it will use first device it finds).
29
31
 
30
32
  ## Usage
31
33
 
32
34
  <pre>
33
- $ mccli.py &lt;args&gt; &lt;commands&gt;
35
+ $ meshcli &lt;args&gt; &lt;commands&gt;
34
36
  </pre>
35
37
 
36
38
  ### Arguments
@@ -84,14 +86,14 @@ Commands are given after arguments, they can be chained and some have shortcuts.
84
86
 
85
87
  <pre>
86
88
  # gets info from first MC device it finds (was -s but now used for serial port)
87
- $ ./mccli.py -d "" infos
89
+ $ meshcli -d "" infos
88
90
  Scanning for devices
89
91
  Found device : F0:F5:BD:4F:9B:AD: MeshCore
90
92
  Connexion started
91
93
  {'adv_type': 1, 'public_key': '54c11cff0c2a861cfc5b0bd6e4b81cd5e6ca85e058bf53932d86c87dc7a20011', 'device_loc': '000000000000000000000000', 'radio_freq': 867500, 'radio_bw': 250000, 'radio_sf': 10, 'radio_cr': 5, 'name': 'toto'}
92
94
  cmd ['infos'] processed ...
93
95
 
94
- $ ./mccli.py -a F0:F5:BD:4F:9B:AD get_time
96
+ $ meshcli -a F0:F5:BD:4F:9B:AD get_time
95
97
  Connexion started
96
98
  Current time : 2024-05-15 12:52:53 (1715770373)
97
99
  cmd ['get_time'] processed ...
@@ -99,19 +101,19 @@ cmd ['get_time'] processed ...
99
101
  $ date
100
102
  Tue Feb 4 12:55:05 CET 2025
101
103
 
102
- $ ./mccli.py -a F0:F5:BD:4F:9B:AD sync_time get_time
104
+ $ meshcli -a F0:F5:BD:4F:9B:AD sync_time get_time
103
105
  Connexion started
104
106
  True
105
107
  cmd ['sync_time'] processed ...
106
108
  Current time : 2025-02-04 12:55:24 (1738670124)
107
109
  cmd ['get_time'] processed ...
108
110
 
109
- $ ./mccli.py -a F0:F5:BD:4F:9B:AD contacts
111
+ $ meshcli -a F0:F5:BD:4F:9B:AD contacts
110
112
  Connexion started
111
113
  {}
112
114
  cmd ['contacts'] processed ...
113
115
 
114
- $ ./mccli.py -a F0:F5:BD:4F:9B:AD sleep 10 contacts
116
+ $ meshcli -a F0:F5:BD:4F:9B:AD sleep 10 contacts
115
117
  Connexion started
116
118
  Advertisment received
117
119
  cmd ['sleep', '10'] processed ...
@@ -131,7 +133,7 @@ cmd ['sleep', '10'] processed ...
131
133
  }
132
134
  cmd ['contacts'] processed ...
133
135
 
134
- $ ./mccli.py -a F0:F5:BD:4F:9B:AD sendto flo2 "Hello flo2" sleep 10
136
+ $ meshcli -a F0:F5:BD:4F:9B:AD sendto flo2 "Hello flo2" sleep 10
135
137
  Connexion started
136
138
  {'type': 1, 'expected_ack': b'9\x05\x0c\x12', 'suggested_timeout': 3260}
137
139
  cmd ['sendto', 'flo2', 'Hello flo2'] processed ...
@@ -140,20 +142,20 @@ Received ACK
140
142
  Msgs are waiting
141
143
  cmd ['sleep', '10'] processed ...
142
144
 
143
- $ ./mccli.py -a F0:F5:BD:4F:9B:AD recv
145
+ $ meshcli -a F0:F5:BD:4F:9B:AD recv
144
146
  Connexion started
145
147
  {'type': 'PRIV', 'pubkey_prefix': 'd6e43f8e9ef2', 'path_len': 255, 'txt_type': 0, 'sender_timestamp': 1738670421, 'text': 'hi'}
146
148
  cmd ['recv'] processed ...
147
149
 
148
150
  # logs into a repeater (HomeRep) and check time
149
- $ ./mccli.py -d t1000 login HomeRep password
151
+ $ meshcli -d t1000 login HomeRep password
150
152
  Scanning for devices
151
153
  Found device : FB:F2:5C:40:4F:77: MeshCore-t1000
152
154
  Connexion started
153
155
  {'type': 0, 'expected_ack': b'\x82yU\x02', 'suggested_timeout': 4446}
154
156
  cmd ['login', 'HomeRep', 'password'] processed ...
155
157
 
156
- $ ./mccli.py cmd HomeRep clock wait_msg
158
+ $ meshcli cmd HomeRep clock wait_msg
157
159
  Connexion started
158
160
  {'type': 0, 'expected_ack': b'\x00\x00\x00\x00', 'suggested_timeout': 2724}
159
161
  cmd ['cmd', 'HomeRep', 'clock'] processed ...
@@ -1,21 +1,23 @@
1
- # mccli
1
+ # meshcore-cli
2
2
 
3
- mccli.py : CLI interface to MeschCore companion app over BLE, TCP or Serial
3
+ meshcore-cli : CLI interface to MeschCore companion app over BLE, TCP or Serial
4
4
 
5
5
  ## Install
6
6
 
7
- You should install (meshcore)[https://github.com/fdlamotte/meshcore_py] package first via pip.
7
+ Meshcore-cli depends on the [python meshcore](https://github.com/fdlamotte/meshcore_py) package. You can install both via `pip` or `pipx` using the command :
8
8
 
9
9
  <pre>
10
- $ pip install meshcore
10
+ $ pipx install meshcore-cli
11
11
  </pre>
12
12
 
13
- Then you can put `mccli.py` program in your path.
13
+ It will install you `meshcore-cli` and `meshcli`, which is an alias to the former.
14
+
15
+ If you want meshcore-cli to remember last BLE device, you should have some `$HOME/.config/meshcore` where configuration for meschcore-cli will be stored (if not it will use first device it finds).
14
16
 
15
17
  ## Usage
16
18
 
17
19
  <pre>
18
- $ mccli.py &lt;args&gt; &lt;commands&gt;
20
+ $ meshcli &lt;args&gt; &lt;commands&gt;
19
21
  </pre>
20
22
 
21
23
  ### Arguments
@@ -69,14 +71,14 @@ Commands are given after arguments, they can be chained and some have shortcuts.
69
71
 
70
72
  <pre>
71
73
  # gets info from first MC device it finds (was -s but now used for serial port)
72
- $ ./mccli.py -d "" infos
74
+ $ meshcli -d "" infos
73
75
  Scanning for devices
74
76
  Found device : F0:F5:BD:4F:9B:AD: MeshCore
75
77
  Connexion started
76
78
  {'adv_type': 1, 'public_key': '54c11cff0c2a861cfc5b0bd6e4b81cd5e6ca85e058bf53932d86c87dc7a20011', 'device_loc': '000000000000000000000000', 'radio_freq': 867500, 'radio_bw': 250000, 'radio_sf': 10, 'radio_cr': 5, 'name': 'toto'}
77
79
  cmd ['infos'] processed ...
78
80
 
79
- $ ./mccli.py -a F0:F5:BD:4F:9B:AD get_time
81
+ $ meshcli -a F0:F5:BD:4F:9B:AD get_time
80
82
  Connexion started
81
83
  Current time : 2024-05-15 12:52:53 (1715770373)
82
84
  cmd ['get_time'] processed ...
@@ -84,19 +86,19 @@ cmd ['get_time'] processed ...
84
86
  $ date
85
87
  Tue Feb 4 12:55:05 CET 2025
86
88
 
87
- $ ./mccli.py -a F0:F5:BD:4F:9B:AD sync_time get_time
89
+ $ meshcli -a F0:F5:BD:4F:9B:AD sync_time get_time
88
90
  Connexion started
89
91
  True
90
92
  cmd ['sync_time'] processed ...
91
93
  Current time : 2025-02-04 12:55:24 (1738670124)
92
94
  cmd ['get_time'] processed ...
93
95
 
94
- $ ./mccli.py -a F0:F5:BD:4F:9B:AD contacts
96
+ $ meshcli -a F0:F5:BD:4F:9B:AD contacts
95
97
  Connexion started
96
98
  {}
97
99
  cmd ['contacts'] processed ...
98
100
 
99
- $ ./mccli.py -a F0:F5:BD:4F:9B:AD sleep 10 contacts
101
+ $ meshcli -a F0:F5:BD:4F:9B:AD sleep 10 contacts
100
102
  Connexion started
101
103
  Advertisment received
102
104
  cmd ['sleep', '10'] processed ...
@@ -116,7 +118,7 @@ cmd ['sleep', '10'] processed ...
116
118
  }
117
119
  cmd ['contacts'] processed ...
118
120
 
119
- $ ./mccli.py -a F0:F5:BD:4F:9B:AD sendto flo2 "Hello flo2" sleep 10
121
+ $ meshcli -a F0:F5:BD:4F:9B:AD sendto flo2 "Hello flo2" sleep 10
120
122
  Connexion started
121
123
  {'type': 1, 'expected_ack': b'9\x05\x0c\x12', 'suggested_timeout': 3260}
122
124
  cmd ['sendto', 'flo2', 'Hello flo2'] processed ...
@@ -125,20 +127,20 @@ Received ACK
125
127
  Msgs are waiting
126
128
  cmd ['sleep', '10'] processed ...
127
129
 
128
- $ ./mccli.py -a F0:F5:BD:4F:9B:AD recv
130
+ $ meshcli -a F0:F5:BD:4F:9B:AD recv
129
131
  Connexion started
130
132
  {'type': 'PRIV', 'pubkey_prefix': 'd6e43f8e9ef2', 'path_len': 255, 'txt_type': 0, 'sender_timestamp': 1738670421, 'text': 'hi'}
131
133
  cmd ['recv'] processed ...
132
134
 
133
135
  # logs into a repeater (HomeRep) and check time
134
- $ ./mccli.py -d t1000 login HomeRep password
136
+ $ meshcli -d t1000 login HomeRep password
135
137
  Scanning for devices
136
138
  Found device : FB:F2:5C:40:4F:77: MeshCore-t1000
137
139
  Connexion started
138
140
  {'type': 0, 'expected_ack': b'\x82yU\x02', 'suggested_timeout': 4446}
139
141
  cmd ['login', 'HomeRep', 'password'] processed ...
140
142
 
141
- $ ./mccli.py cmd HomeRep clock wait_msg
143
+ $ meshcli cmd HomeRep clock wait_msg
142
144
  Connexion started
143
145
  {'type': 0, 'expected_ack': b'\x00\x00\x00\x00', 'suggested_timeout': 2724}
144
146
  cmd ['cmd', 'HomeRep', 'clock'] processed ...
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "meshcore-cli"
7
- version = "0.3"
7
+ version = "0.3.2"
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" ]
20
+ dependencies = [ "meshcore>=0.3.2" ]
21
21
 
22
22
  [project.urls]
23
23
  Homepage = "https://github.com/fdlamotte/meshcore-cli"
@@ -18,7 +18,7 @@ from meshcore import printerr
18
18
  from meshcore import MeshCore
19
19
 
20
20
  # default address is stored in a config file
21
- MCCLI_CONFIG_DIR = str(Path.home()) + "/.config/mc-cli/"
21
+ MCCLI_CONFIG_DIR = str(Path.home()) + "/.config/meshcore/"
22
22
  MCCLI_ADDRESS = MCCLI_CONFIG_DIR + "default_address"
23
23
 
24
24
  # Fallback address if config file not found
@@ -171,15 +171,18 @@ async def next_cmd(mc, cmds):
171
171
  case "sleep" | "s" :
172
172
  argnum = 1
173
173
  await asyncio.sleep(int(cmds[1]))
174
+ case "cli" :
175
+ argnum = 1
176
+ print (await mc.send_cli(cmds[1]))
174
177
 
175
178
  printerr (f"cmd {cmds[0:argnum+1]} processed ...")
176
179
  return cmds[argnum+1:]
177
180
 
178
181
  def usage () :
179
182
  """ Prints some help """
180
- print("""mccli.py : CLI interface to MeschCore BLE companion app
183
+ print("""meshcore-cli : CLI interface to MeschCore BLE companion app
181
184
 
182
- Usage : mccli.py <args> <commands>
185
+ Usage : meshcore-cli <args> <commands>
183
186
 
184
187
  Arguments :
185
188
  -h : prints this help
@@ -0,0 +1 @@
1
+ from meshcore_cli import cli; cli()
File without changes
File without changes