micrOSDevToolKit 2.9.10__py3-none-any.whl → 2.10.2__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.
Potentially problematic release.
This version of micrOSDevToolKit might be problematic. Click here for more details.
- micrOS/release_info/micrOS_ReleaseInfo/system_analysis_sum.json +19 -19
- micrOS/source/Common.py +4 -4
- micrOS/source/InterConnect.py +14 -11
- micrOS/source/LM_espnow.py +27 -1
- micrOS/source/LM_intercon.py +3 -0
- micrOS/source/LM_light_sensor.py +7 -15
- micrOS/source/LM_oled_ui.py +18 -22
- micrOS/source/LM_oledui.py +13 -16
- micrOS/source/LM_presence.py +8 -11
- micrOS/source/LM_system.py +7 -6
- micrOS/source/LM_telegram.py +21 -16
- micrOS/source/Shell.py +22 -19
- micrOS/source/Tasks.py +30 -15
- micrOS/source/Web.py +3 -2
- micrOS/source/__pycache__/Common.cpython-312.pyc +0 -0
- {micrOSDevToolKit-2.9.10.dist-info → micrOSDevToolKit-2.10.2.dist-info}/METADATA +60 -28
- {micrOSDevToolKit-2.9.10.dist-info → micrOSDevToolKit-2.10.2.dist-info}/RECORD +41 -38
- toolkit/DevEnvOTA.py +13 -9
- toolkit/dashboard_apps/SystemTest.py +17 -6
- toolkit/lib/Repository.py +64 -0
- toolkit/lib/micrOSClient.py +25 -6
- toolkit/simulator_lib/__pycache__/aioespnow.cpython-312.pyc +0 -0
- toolkit/simulator_lib/aioespnow.py +28 -0
- toolkit/socketClient.py +2 -3
- toolkit/workspace/precompiled/Common.mpy +0 -0
- toolkit/workspace/precompiled/InterConnect.mpy +0 -0
- toolkit/workspace/precompiled/LM_espnow.py +27 -1
- toolkit/workspace/precompiled/LM_intercon.mpy +0 -0
- toolkit/workspace/precompiled/LM_light_sensor.mpy +0 -0
- toolkit/workspace/precompiled/LM_oled_ui.mpy +0 -0
- toolkit/workspace/precompiled/LM_oledui.mpy +0 -0
- toolkit/workspace/precompiled/LM_presence.mpy +0 -0
- toolkit/workspace/precompiled/LM_system.mpy +0 -0
- toolkit/workspace/precompiled/LM_telegram.mpy +0 -0
- toolkit/workspace/precompiled/Shell.mpy +0 -0
- toolkit/workspace/precompiled/Tasks.mpy +0 -0
- toolkit/workspace/precompiled/Web.mpy +0 -0
- {micrOSDevToolKit-2.9.10.data → micrOSDevToolKit-2.10.2.data}/scripts/devToolKit.py +0 -0
- {micrOSDevToolKit-2.9.10.dist-info → micrOSDevToolKit-2.10.2.dist-info}/LICENSE +0 -0
- {micrOSDevToolKit-2.9.10.dist-info → micrOSDevToolKit-2.10.2.dist-info}/WHEEL +0 -0
- {micrOSDevToolKit-2.9.10.dist-info → micrOSDevToolKit-2.10.2.dist-info}/top_level.txt +0 -0
micrOS/source/LM_telegram.py
CHANGED
|
@@ -4,6 +4,11 @@ from Notify import Notify
|
|
|
4
4
|
from Config import cfgget
|
|
5
5
|
from Common import micro_task, syslog, console_write
|
|
6
6
|
from LM_system import ifconfig
|
|
7
|
+
from utime import localtime
|
|
8
|
+
|
|
9
|
+
def _timestamp():
|
|
10
|
+
_time = [str(k) for k in localtime()[3:6]]
|
|
11
|
+
return ':'.join(_time)
|
|
7
12
|
|
|
8
13
|
|
|
9
14
|
class Telegram(Notify):
|
|
@@ -106,12 +111,12 @@ class Telegram(Notify):
|
|
|
106
111
|
Update known chat_id-s and cache them
|
|
107
112
|
- return active chat_id frm resp_json
|
|
108
113
|
"""
|
|
109
|
-
console_write("[NTFY GET] update chatIDs")
|
|
110
114
|
_cid = None
|
|
111
115
|
if resp_json.get("ok", None) and len(resp_json["result"]) > 0:
|
|
112
116
|
_cid = resp_json["result"][-1]["message"]["chat"]["id"]
|
|
113
117
|
# LIMIT Telegram._CHAT_IDS NOTIFICATION CACHE TO 3 IDs
|
|
114
|
-
if len(Telegram._CHAT_IDS) < 4:
|
|
118
|
+
if len(Telegram._CHAT_IDS) < 4 and _cid not in Telegram._CHAT_IDS:
|
|
119
|
+
console_write("[NTFY GET] update chatIDs")
|
|
115
120
|
_ids = len(Telegram._CHAT_IDS)
|
|
116
121
|
Telegram._CHAT_IDS.add(_cid)
|
|
117
122
|
if len(Telegram._CHAT_IDS) - _ids > 0: # optimized save (slow storage access)
|
|
@@ -135,7 +140,7 @@ class Telegram(Notify):
|
|
|
135
140
|
return None
|
|
136
141
|
response = {'sender': None, 'text': None, 'm_id': -1, 'c_id': None}
|
|
137
142
|
url = f"https://api.telegram.org/bot{bot_token}/getUpdates{Telegram._API_PARAMS}"
|
|
138
|
-
console_write(f"\
|
|
143
|
+
console_write(f"\t[GET] request: {url}")
|
|
139
144
|
|
|
140
145
|
_, resp_json = urequests.get(url, jsonify=True, sock_size=128)
|
|
141
146
|
|
|
@@ -145,7 +150,7 @@ class Telegram(Notify):
|
|
|
145
150
|
response['sender'] = f"{resp['chat']['first_name']}{resp['chat']['last_name']}" if resp['chat'].get(
|
|
146
151
|
'username', None) is None else resp['chat']['username']
|
|
147
152
|
response['text'], response['m_id'] = resp['text'], resp['message_id']
|
|
148
|
-
console_write(f"\
|
|
153
|
+
console_write(f"\t\t[GET] response: {response}")
|
|
149
154
|
return response
|
|
150
155
|
|
|
151
156
|
@staticmethod
|
|
@@ -160,7 +165,7 @@ class Telegram(Notify):
|
|
|
160
165
|
return None
|
|
161
166
|
response = {'sender': None, 'text': None, 'm_id': -1, 'c_id': None}
|
|
162
167
|
url = f"https://api.telegram.org/bot{bot_token}/getUpdates{Telegram._API_PARAMS}"
|
|
163
|
-
console_write(f"\
|
|
168
|
+
console_write(f"\t[aGET] request: {url}")
|
|
164
169
|
|
|
165
170
|
_, resp_json = await urequests.aget(url, jsonify=True, sock_size=128)
|
|
166
171
|
|
|
@@ -170,7 +175,7 @@ class Telegram(Notify):
|
|
|
170
175
|
response['sender'] = f"{resp['chat']['first_name']}{resp['chat']['last_name']}" if resp['chat'].get(
|
|
171
176
|
'username', None) is None else resp['chat']['username']
|
|
172
177
|
response['text'], response['m_id'] = resp['text'], resp['message_id']
|
|
173
|
-
console_write(f"\
|
|
178
|
+
console_write(f"\t\t[aGET] response: {response}")
|
|
174
179
|
return response
|
|
175
180
|
|
|
176
181
|
@staticmethod
|
|
@@ -183,14 +188,14 @@ class Telegram(Notify):
|
|
|
183
188
|
console_write("[NTFY] EVAL sequence")
|
|
184
189
|
verdict = None
|
|
185
190
|
|
|
186
|
-
def
|
|
191
|
+
def _lm_execute(cmd_args):
|
|
187
192
|
nonlocal verdict, m_id
|
|
188
193
|
access, output = Telegram.lm_execute(cmd_args)
|
|
189
194
|
if access:
|
|
190
|
-
verdict = f'[UP] Exec: {" ".join(cmd_args[0])}'
|
|
195
|
+
verdict = f'{_timestamp()} [UP] Exec: {" ".join(cmd_args[0])}'
|
|
191
196
|
Telegram.send_msg(output, reply_to=m_id)
|
|
192
197
|
else:
|
|
193
|
-
verdict = f'[UP] NoAccess: {cmd_args[0]}'
|
|
198
|
+
verdict = f'{_timestamp()} [UP] NoAccess: {cmd_args[0]}'
|
|
194
199
|
Telegram._IN_MSG_ID = m_id
|
|
195
200
|
|
|
196
201
|
# -------------------------- FUNCTION MAIN -------------------------- #
|
|
@@ -211,12 +216,12 @@ class Telegram(Notify):
|
|
|
211
216
|
cmd_lm = msg_in.strip().split()[1:]
|
|
212
217
|
# [Compare] cmd selected device param with DEVFID (device/prompt name)
|
|
213
218
|
if cmd_lm[0] in Telegram._DEVFID:
|
|
214
|
-
|
|
219
|
+
_lm_execute(cmd_lm[1:])
|
|
215
220
|
else:
|
|
216
|
-
verdict = f'[UP] NoSelected: {cmd_lm[0]}'
|
|
221
|
+
verdict = f'{_timestamp()} [UP] NoSelected: {cmd_lm[0]}'
|
|
217
222
|
elif msg_in.startswith('/cmd'):
|
|
218
223
|
cmd_lm = msg_in.strip().split()[1:]
|
|
219
|
-
|
|
224
|
+
_lm_execute(cmd_lm)
|
|
220
225
|
elif msg_in.startswith('/notify'):
|
|
221
226
|
param = msg_in.strip().split()[1:]
|
|
222
227
|
if len(param) > 0:
|
|
@@ -226,8 +231,7 @@ class Telegram(Notify):
|
|
|
226
231
|
# Send is still synchronous (OK)
|
|
227
232
|
Telegram.send_msg(verdict, reply_to=m_id)
|
|
228
233
|
else:
|
|
229
|
-
verdict = "[UP] NoExec"
|
|
230
|
-
console_write(f"\tBOT: {verdict}")
|
|
234
|
+
verdict = f"{_timestamp()} [UP] NoExec"
|
|
231
235
|
return verdict
|
|
232
236
|
|
|
233
237
|
@staticmethod
|
|
@@ -241,11 +245,12 @@ class Telegram(Notify):
|
|
|
241
245
|
period = period if period > 0 else 1
|
|
242
246
|
period_ms = period * 1000
|
|
243
247
|
with micro_task(tag=tag) as my_task:
|
|
244
|
-
my_task.out = "[UP] Running"
|
|
248
|
+
my_task.out = f"{_timestamp()} [UP] Running"
|
|
245
249
|
while True:
|
|
246
250
|
# Normal task period
|
|
247
251
|
await my_task.feed(sleep_ms=period_ms)
|
|
248
252
|
try:
|
|
253
|
+
# await asyncio.wait_for(Telegram.receive_eval(), 5) # 5 sec timeout???
|
|
249
254
|
v = await Telegram.receive_eval()
|
|
250
255
|
my_task.out = "Missing bot token" if v is None else f"{v} ({period}s)"
|
|
251
256
|
cancel_cnt = 0
|
|
@@ -254,7 +259,7 @@ class Telegram(Notify):
|
|
|
254
259
|
# Auto scale - blocking nature - in case of serial failures (5) - hibernate task (increase async sleep)
|
|
255
260
|
cancel_cnt += 1
|
|
256
261
|
if cancel_cnt > 5:
|
|
257
|
-
my_task.out = f"[DOWN] {e} (wait 1min)"
|
|
262
|
+
my_task.out = f"{_timestamp()} [DOWN] {e} (wait 1min)"
|
|
258
263
|
cancel_cnt = 5
|
|
259
264
|
# SLOW DOWN - hibernate task
|
|
260
265
|
await my_task.feed(sleep_ms=60_000)
|
micrOS/source/Shell.py
CHANGED
|
@@ -25,7 +25,7 @@ from Debug import errlog_add
|
|
|
25
25
|
|
|
26
26
|
class Shell:
|
|
27
27
|
__slots__ = ['__devfid', '__auth_mode', '__hwuid', '__auth_ok', '__conf_mode']
|
|
28
|
-
MICROS_VERSION = '2.
|
|
28
|
+
MICROS_VERSION = '2.10.2-0'
|
|
29
29
|
|
|
30
30
|
def __init__(self):
|
|
31
31
|
"""
|
|
@@ -106,6 +106,7 @@ class Shell:
|
|
|
106
106
|
# No msg to work with
|
|
107
107
|
return True
|
|
108
108
|
msg_list = msg.strip().split()
|
|
109
|
+
local_cmd = not msg_list[-1].startswith(">>") # intercon request check for shell commands
|
|
109
110
|
|
|
110
111
|
##########################################
|
|
111
112
|
# [1] Handle built-in shell commands #
|
|
@@ -113,7 +114,7 @@ class Shell:
|
|
|
113
114
|
##########################################
|
|
114
115
|
|
|
115
116
|
# Hello message
|
|
116
|
-
if msg_list[0] == 'hello':
|
|
117
|
+
if local_cmd and msg_list[0] == 'hello':
|
|
117
118
|
# For low level device identification - hello msg
|
|
118
119
|
await self.a_send(f"hello:{self.__devfid}:{self.__hwuid}")
|
|
119
120
|
return True
|
|
@@ -126,60 +127,62 @@ class Shell:
|
|
|
126
127
|
return True
|
|
127
128
|
|
|
128
129
|
# Version handling
|
|
129
|
-
if msg_list[0] == 'version':
|
|
130
|
+
if local_cmd and msg_list[0] == 'version':
|
|
130
131
|
# For micrOS system version info
|
|
131
132
|
await self.a_send(str(Shell.MICROS_VERSION))
|
|
132
133
|
return True
|
|
133
134
|
|
|
134
135
|
# Reboot micropython VM
|
|
135
|
-
if msg_list[0] == 'reboot':
|
|
136
|
+
if local_cmd and msg_list[0] == 'reboot':
|
|
136
137
|
hard = False
|
|
137
138
|
if len(msg_list) >= 2 and "-h" in msg_list[1]:
|
|
138
139
|
# reboot / reboot -h
|
|
139
140
|
hard = True
|
|
140
141
|
await self.reboot(hard)
|
|
141
142
|
|
|
142
|
-
if msg_list[0].startswith('webrepl'):
|
|
143
|
+
if local_cmd and msg_list[0].startswith('webrepl'):
|
|
143
144
|
if len(msg_list) == 2 and '-u' in msg_list[1]:
|
|
144
145
|
await Shell.webrepl(msg_obj=self.a_send, update=True)
|
|
145
146
|
return await Shell.webrepl(msg_obj=self.a_send)
|
|
146
147
|
|
|
147
148
|
# CONFIGURE MODE STATE: ACCESS FOR NODE_CONFIG.JSON
|
|
148
|
-
if msg_list[0].startswith('conf'):
|
|
149
|
+
if local_cmd and msg_list[0].startswith('conf'):
|
|
149
150
|
self.__conf_mode = True
|
|
150
151
|
return True
|
|
151
|
-
if msg_list[0].startswith('noconf'):
|
|
152
|
+
if local_cmd and msg_list[0].startswith('noconf'):
|
|
152
153
|
self.__conf_mode = False
|
|
153
154
|
return True
|
|
154
155
|
|
|
155
156
|
# HELP MSG
|
|
156
|
-
if msg_list[0] == "help":
|
|
157
|
-
await self.a_send("[MICROS]
|
|
158
|
-
await self.a_send(" hello
|
|
159
|
-
await self.a_send(" modules
|
|
160
|
-
await self.a_send(" version
|
|
161
|
-
await self.a_send(" exit
|
|
162
|
-
await self.a_send(" reboot
|
|
163
|
-
await self.a_send(" webrepl
|
|
157
|
+
if local_cmd and msg_list[0] == "help":
|
|
158
|
+
await self.a_send("[MICROS] - built-in shell commands")
|
|
159
|
+
await self.a_send(" hello - hello msg - for device identification")
|
|
160
|
+
await self.a_send(" modules - show active Load Modules")
|
|
161
|
+
await self.a_send(" version - returns micrOS version")
|
|
162
|
+
await self.a_send(" exit - exit from shell socket prompt")
|
|
163
|
+
await self.a_send(" reboot - system soft reboot (vm), hard reboot (hw): reboot -h")
|
|
164
|
+
await self.a_send(" webrepl - start webrepl, for file transfers use with --update")
|
|
164
165
|
await self.a_send("[CONF] Configure mode - built-in shell commands")
|
|
165
166
|
await self.a_send(" conf - Enter conf mode")
|
|
166
167
|
await self.a_send(" dump - Dump all data")
|
|
167
168
|
await self.a_send(" key - Get value")
|
|
168
169
|
await self.a_send(" key value - Set value")
|
|
169
170
|
await self.a_send(" noconf - Exit conf mode")
|
|
170
|
-
await self.a_send("[TASK] postfix:
|
|
171
|
-
await self.a_send(" task list - list tasks
|
|
171
|
+
await self.a_send("[TASK] postfix: ...&x - one-time, ...&&x - periodic, x: wait ms [x min: 20ms]")
|
|
172
|
+
await self.a_send(" task list - list tasks by <tag>s")
|
|
172
173
|
await self.a_send(" task kill <tag> - stop task")
|
|
173
174
|
await self.a_send(" task show <tag> - show task output")
|
|
174
175
|
await self.a_send("[EXEC] Command mode (LMs):")
|
|
175
|
-
await self.a_send("
|
|
176
|
+
await self.a_send(" >>node01.local - INTERCON postfix, execute command on remote device")
|
|
177
|
+
await self.a_send(" >json - JSON postfix, request json formatted output")
|
|
178
|
+
await self.a_send(" help lm - list ALL LoadModules")
|
|
176
179
|
if "lm" in str(msg_list):
|
|
177
180
|
return await Shell._show_lm_funcs(msg_obj=self.a_send)
|
|
178
181
|
return await Shell._show_lm_funcs(msg_obj=self.a_send, active_only=True)
|
|
179
182
|
|
|
180
183
|
# [2] EXECUTE:
|
|
181
184
|
# @1 Configure mode
|
|
182
|
-
if self.__conf_mode and len(msg_list) > 0:
|
|
185
|
+
if local_cmd and self.__conf_mode and len(msg_list) > 0:
|
|
183
186
|
# Lock thread under config handling is threads available
|
|
184
187
|
return await Shell._configure(self.a_send, msg_list)
|
|
185
188
|
# @2 Command mode
|
micrOS/source/Tasks.py
CHANGED
|
@@ -199,12 +199,9 @@ class MagicTask(TaskBase):
|
|
|
199
199
|
- self.__inloop: lm call type - one-shot (False) / looped (True)
|
|
200
200
|
- self.__msg_buf: lm msg object redirect to variable - store lm output
|
|
201
201
|
"""
|
|
202
|
-
jsonify = self.__callback[-1] == '>json'
|
|
203
|
-
if jsonify:
|
|
204
|
-
self.__callback = self.__callback[:-1]
|
|
205
202
|
while True:
|
|
206
203
|
await self.feed(self.__sleep)
|
|
207
|
-
state, self.out = _exec_lm_core(self.__callback
|
|
204
|
+
state, self.out = _exec_lm_core(self.__callback)
|
|
208
205
|
if not state or not self.__inloop:
|
|
209
206
|
break
|
|
210
207
|
self.task_gc() # Task pool cleanup
|
|
@@ -227,6 +224,7 @@ class Manager:
|
|
|
227
224
|
__slots__ = ['_initialized', 'idle_counter']
|
|
228
225
|
INSTANCE = None # Manager object
|
|
229
226
|
LOAD = 0 # CPU overload measure
|
|
227
|
+
INTERCON = None # Dynamic ref. for interconnect calls
|
|
230
228
|
|
|
231
229
|
def __new__(cls):
|
|
232
230
|
"""
|
|
@@ -419,19 +417,34 @@ def exec_builtins(func):
|
|
|
419
417
|
- modules - show active modules list
|
|
420
418
|
- task kill ... - task termination
|
|
421
419
|
show ... - task output dump
|
|
422
|
-
- ... >json - postfix to
|
|
420
|
+
- ... >json - postfix to jsonify the output
|
|
423
421
|
"""
|
|
424
|
-
def wrapper(arg_list, jsonify=None):
|
|
422
|
+
def wrapper(arg_list:list, jsonify=None):
|
|
425
423
|
# Ensure the parameter is a list of strings
|
|
426
424
|
if isinstance(arg_list, list) and arg_list:
|
|
427
|
-
#
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
425
|
+
# Postfix operator handling
|
|
426
|
+
# ... >json - command output format option
|
|
427
|
+
# ... >>node01.local - intercon: command execution on remote device by hostname/IP address
|
|
428
|
+
arg_list, json_flag = (arg_list[:-1], True) if arg_list[-1] == '>json' else (arg_list, False)
|
|
429
|
+
arg_list, intercon_target = (arg_list[:-1], arg_list[-1].replace(">>", "")) if arg_list[-1].startswith('>>') else (arg_list, None)
|
|
431
430
|
json_flag = jsonify if isinstance(jsonify, bool) else json_flag
|
|
431
|
+
|
|
432
|
+
# INTERCONNECT
|
|
433
|
+
if intercon_target:
|
|
434
|
+
if Manager.INTERCON is None:
|
|
435
|
+
from InterConnect import send_cmd
|
|
436
|
+
Manager.INTERCON = send_cmd
|
|
437
|
+
try:
|
|
438
|
+
out = Manager.INTERCON(host=intercon_target, cmd=arg_list)
|
|
439
|
+
except Exception as e:
|
|
440
|
+
out = {}
|
|
441
|
+
errlog_add(f"[ERR] Intercon: {e}")
|
|
442
|
+
return True, out
|
|
443
|
+
|
|
432
444
|
# MODULES
|
|
433
445
|
if arg_list[0] == 'modules':
|
|
434
446
|
return True, list((m.strip().replace('LM_', '') for m in modules if m.startswith('LM_'))) + ['task']
|
|
447
|
+
|
|
435
448
|
# Handle task manipulation commands: list, kill, show - return True -> Command handled
|
|
436
449
|
if 'task' == arg_list[0]:
|
|
437
450
|
arg_len = len(arg_list)
|
|
@@ -448,13 +461,13 @@ def exec_builtins(func):
|
|
|
448
461
|
if 'show' == arg_list[1]:
|
|
449
462
|
return True, Manager.show(tag=arg_list[2])
|
|
450
463
|
return True, "Invalid task cmd! Help: task list / kill <taskID> / show <taskID>"
|
|
464
|
+
|
|
451
465
|
# Call the decorated function with the additional flag
|
|
452
466
|
return func(arg_list, json_flag)
|
|
453
467
|
return wrapper
|
|
454
468
|
|
|
455
469
|
|
|
456
|
-
|
|
457
|
-
def lm_exec(arg_list, jsonify):
|
|
470
|
+
def lm_exec(arg_list:list, jsonify:bool=None):
|
|
458
471
|
"""
|
|
459
472
|
Main LM executor function with
|
|
460
473
|
- async (background)
|
|
@@ -489,6 +502,7 @@ def lm_exec(arg_list, jsonify):
|
|
|
489
502
|
return state, out
|
|
490
503
|
|
|
491
504
|
|
|
505
|
+
@exec_builtins
|
|
492
506
|
def _exec_lm_core(cmd_list, jsonify):
|
|
493
507
|
"""
|
|
494
508
|
[CORE] Single command executor: MODULE.FUNCTION...
|
|
@@ -535,11 +549,12 @@ def _exec_lm_core(cmd_list, jsonify):
|
|
|
535
549
|
# ------------ LM output format: dict(jsonify) / str(raw) ------------- #
|
|
536
550
|
# Handle LM output data
|
|
537
551
|
if isinstance(lm_output, dict):
|
|
538
|
-
#
|
|
552
|
+
# jsonify (True) json output, (False) default, "human readable" output)
|
|
539
553
|
lm_output = dumps(lm_output) if jsonify else '\n'.join(
|
|
540
554
|
[f" {key}: {value}" for key, value in lm_output.items()])
|
|
541
555
|
if lm_func == 'help':
|
|
542
|
-
# Special case
|
|
556
|
+
# Special case:
|
|
557
|
+
# jsonify (True) json output, (False) default, "human readable" formatted output)
|
|
543
558
|
lm_output = dumps(lm_output) if jsonify else '\n'.join([f" {out}," for out in lm_output])
|
|
544
559
|
# Return LM exec result
|
|
545
560
|
return True, str(lm_output)
|
|
@@ -582,7 +597,7 @@ def exec_lm_pipe(taskstr):
|
|
|
582
597
|
for cmd in (cmd.strip().split() for cmd in taskstr.split(';') if len(cmd) > 0):
|
|
583
598
|
if len(cmd) > 0 and cmd[0].startswith("#"):
|
|
584
599
|
console_write(f"[SKIP] exec_lm_pipe: {' '.join(cmd)}")
|
|
585
|
-
|
|
600
|
+
continue
|
|
586
601
|
if not lm_exec(cmd)[0]:
|
|
587
602
|
errlog_add(f"[WARN] exec_lm_pipe: {cmd}")
|
|
588
603
|
except Exception as e:
|
micrOS/source/Web.py
CHANGED
|
@@ -102,8 +102,9 @@ class WebEngine:
|
|
|
102
102
|
cmd = url.replace('/rest', '')
|
|
103
103
|
if len(cmd) > 1:
|
|
104
104
|
# REST sub-parameter handling (rest commands)
|
|
105
|
-
cmd = (cmd.replace('/', ' ').replace('
|
|
106
|
-
.replace('%E2%80%
|
|
105
|
+
cmd = (cmd.replace('/', ' ').replace('-', ' ').replace("%3E", ">")
|
|
106
|
+
.replace('%22', '"').replace('%E2%80%9C', '"').replace('%E2%80%9D', '"')
|
|
107
|
+
.strip().split())
|
|
107
108
|
# EXECUTE COMMAND - LoadModule
|
|
108
109
|
if WebEngine.AUTH:
|
|
109
110
|
state, out = lm_exec(cmd, jsonify=True) if lm_is_loaded(cmd[0]) else (True, 'Auth:Protected')
|
|
Binary file
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: micrOSDevToolKit
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.10.2
|
|
4
4
|
Summary: Development and deployment environment for micrOS, the diy micropython automation OS (IoT)
|
|
5
5
|
Home-page: https://github.com/BxNxM/micrOS
|
|
6
6
|
Author: Marcell Ban
|
|
@@ -126,14 +126,6 @@ Link for python 3.9+ [download](https://www.python.org/downloads/release/python-
|
|
|
126
126
|
> Note: **Allow extend system path** with that python version (installation parameter) </br>
|
|
127
127
|
> On **Windows**: RUN AS ADMINISTARTOR
|
|
128
128
|
|
|
129
|
-
### 1.2 Install git
|
|
130
|
-
|
|
131
|
-
Link for git [download](https://git-scm.com/downloads)
|
|
132
|
-
|
|
133
|
-
> Git is a distributed version control system that helps developers track changes, collaborate on code, and manage project history efficiently.
|
|
134
|
-
|
|
135
|
-
It is needed to be able to download webrepl client (automatic), that is used for OverTheAir file transfers and other features.
|
|
136
|
-
|
|
137
129
|
----------------------------------------
|
|
138
130
|
|
|
139
131
|
### 2. Install micrOS devToolKit GUI
|
|
@@ -495,29 +487,74 @@ Official [DockerHub](https://hub.docker.com/repository/docker/bxnxm/micros-gatew
|
|
|
495
487
|
|
|
496
488
|
## FUTURE RELEASE PLANS
|
|
497
489
|
|
|
498
|
-
Version **3.0.0-0**
|
|
490
|
+
Version **3.0.0-0** `micrOS-Autonomous`
|
|
499
491
|
|
|
500
492
|
```
|
|
501
493
|
Core:
|
|
502
|
-
- Async SSL/TLS integration (micropython 1.22+ required)
|
|
503
|
-
- urequest module async redesign for rest clients
|
|
504
|
-
- LM_telegram (Notify) + server (listener - chatbot)
|
|
505
|
-
|
|
506
|
-
-
|
|
507
|
-
- ??? New intercon syntax ???:
|
|
494
|
+
- (1) Async SSL/TLS integration (micropython 1.22+ required) [DONE]
|
|
495
|
+
- urequest module async redesign for rest clients [OK]
|
|
496
|
+
- LM_telegram (Notify) + server (listener - chatbot) [OK]
|
|
497
|
+
- (2) ESP-NOW (peer-to-peer communication) integration into InterCon [PoC:OK][TODO]
|
|
498
|
+
- (3) New intercon syntax - command level integration: [DONE]
|
|
508
499
|
- rgb toggle >>RingLight.local
|
|
509
|
-
- similar as: intercon sendcmd host="RingLight.local" cmd="rgb toggle"
|
|
500
|
+
- similar as (obsolete): intercon sendcmd host="RingLight.local" cmd="rgb toggle"
|
|
501
|
+
- (4) Create multi level project structure (curret is flat fs) [TODO?] FS
|
|
502
|
+
- New micrOS FS structure:
|
|
503
|
+
- Note:
|
|
504
|
+
- On device (boot) micrOS Hooks.py/os_dir_fs_hook (check+correct) [Phase1-FS:TODO]
|
|
505
|
+
- DevToolKit USB & OTA feature adaptation [Phase2-FS:TODO]
|
|
506
|
+
- os_dir_fs_handler (usb+webrepl) features
|
|
507
|
+
|
|
508
|
+
- root fs (stays untouched (approx.: 24)): /
|
|
509
|
+
- micrOS.py (core)
|
|
510
|
+
- Config.py (core)
|
|
511
|
+
- Tasks.py (core)
|
|
512
|
+
- Shell.py (core)
|
|
513
|
+
- Web.py (core)
|
|
514
|
+
- Server.py (core)
|
|
515
|
+
- node_config,json (core config)
|
|
516
|
+
- etc... (core)
|
|
517
|
+
|
|
518
|
+
- module folder - mip complient: /lib
|
|
519
|
+
- LM_* (approx.: 54)
|
|
520
|
+
- IO_* (approx.: 5)
|
|
521
|
+
- *.py/.mpy (driver)
|
|
522
|
+
- Dynamic/Runtime (approx.: 0-8):
|
|
523
|
+
- *.pds (LM app cache - persistent data storage)
|
|
524
|
+
- *.dat (Common datalogger output)
|
|
525
|
+
|
|
526
|
+
- web folder: /web
|
|
527
|
+
- *.html
|
|
528
|
+
- *.js
|
|
529
|
+
- *.css
|
|
530
|
+
|
|
531
|
+
- /logs
|
|
532
|
+
- still there (created runtime)
|
|
533
|
+
|
|
534
|
+
- (5) Proper mip installer support (/lib) [TODO]
|
|
535
|
+
- Note: Autonomous package management over wifi (github)
|
|
536
|
+
- pacman download
|
|
537
|
+
- pacman ls
|
|
538
|
+
- pacman dirtree
|
|
539
|
+
- pacman ...
|
|
510
540
|
```
|
|
511
541
|
|
|
512
|
-
Version **3.1.0-0**
|
|
542
|
+
Version **3.1.0-0** `micrOS-SecurePower`
|
|
513
543
|
|
|
514
544
|
```
|
|
515
545
|
Core:
|
|
516
546
|
- Async socket servers with SSL/TLS integration (with auth.)
|
|
517
547
|
- WebCli (https?), ShellCli (ssocket/sterminal) and InterCon
|
|
548
|
+
- Low power mode with ESPNOW + (AP mode?)
|
|
549
|
+
- Remote controller / Sensor UseCase
|
|
550
|
+
- --- client mode (fyi: normally micrOS operates in server mode)
|
|
551
|
+
- Intercon-Wire (?)
|
|
552
|
+
- Idea of wired message communication protocol same as Intercon-Shell/Intercon-espnow
|
|
553
|
+
- Possible HW protocols: i2c / onewire / uart BUT it should support bidirectional message transfers
|
|
554
|
+
- Goal: CoProcessor easy integration feature - Arduino env support
|
|
518
555
|
```
|
|
519
556
|
|
|
520
|
-
Version **4.0.0-0**
|
|
557
|
+
Version **4.0.0-0** `micrOS-???`
|
|
521
558
|
|
|
522
559
|
```
|
|
523
560
|
Core:
|
|
@@ -525,6 +562,7 @@ Version **4.0.0-0**
|
|
|
525
562
|
- Network
|
|
526
563
|
- wifi (defualt, current interfaces)
|
|
527
564
|
- Study of BLE (Shell)
|
|
565
|
+
- Com. (wifi/now/ble...lora?/etc?.) as plugin architecture (?)
|
|
528
566
|
- Low power mode (with BLE) and soft-sleep / deep-sleep
|
|
529
567
|
```
|
|
530
568
|
|
|
@@ -696,8 +734,6 @@ devToolKit.py -c -p '--dev BedLamp help'
|
|
|
696
734
|
help
|
|
697
735
|
dht22
|
|
698
736
|
help
|
|
699
|
-
intercon
|
|
700
|
-
help
|
|
701
737
|
robustness
|
|
702
738
|
help
|
|
703
739
|
system
|
|
@@ -827,8 +863,6 @@ BedLamp $ help
|
|
|
827
863
|
help
|
|
828
864
|
dht22
|
|
829
865
|
help
|
|
830
|
-
intercon
|
|
831
|
-
help
|
|
832
866
|
robustness
|
|
833
867
|
help
|
|
834
868
|
system
|
|
@@ -919,10 +953,9 @@ micrOS Load Module resources
|
|
|
919
953
|
43 105 LM_lmpacman.py (mlint: True) (pylint: 8.38) (ref.: 0)
|
|
920
954
|
44 176 LM_gameOfLife.py (mlint: True) (pylint: 9.29) (ref.: 2)
|
|
921
955
|
45 58 LM_catgame.py (mlint: True) (pylint: 8.46) (ref.: 0)
|
|
922
|
-
46
|
|
923
|
-
47
|
|
924
|
-
48
|
|
925
|
-
49 34 LM_sdcard.py (mlint: True) (pylint: 7.88) (ref.: 0)
|
|
956
|
+
46 43 LM_ds18.py (mlint: True) (pylint: 5.0) (ref.: 2)
|
|
957
|
+
47 250 LM_i2s_mic.py (mlint: False) (pylint: 8.71) (ref.: 1)
|
|
958
|
+
48 34 LM_sdcard.py (mlint: True) (pylint: 7.88) (ref.: 0)
|
|
926
959
|
|
|
927
960
|
SUM CODE LINES (WITH COMMENTS, WITHOUT EMPTY LINES): 6822
|
|
928
961
|
```
|
|
@@ -1013,7 +1046,6 @@ micrOS/toolkit/workspace/precompiled
|
|
|
1013
1046
|
│ ├── LM_esp32.py
|
|
1014
1047
|
│ ├── LM_genIO.mpy
|
|
1015
1048
|
│ ├── LM_i2c.py
|
|
1016
|
-
│ ├── LM_intercon.mpy
|
|
1017
1049
|
│ ├── LM_light_sensor.mpy
|
|
1018
1050
|
│ ├── LM_neoeffects.mpy
|
|
1019
1051
|
│ ├── LM_neopixel.mpy
|