micrOSDevToolKit 2.9.10__py3-none-any.whl → 2.9.11__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.

@@ -319,7 +319,7 @@
319
319
  23
320
320
  ],
321
321
  "load": [
322
- 9061,
322
+ 9087,
323
323
  55
324
324
  ],
325
325
  "core_dep": [
@@ -1,23 +1,49 @@
1
1
  import Espnow
2
2
 
3
3
  def load():
4
+ """
5
+ Initialize ESPNOW protocal
6
+ """
4
7
  return Espnow.initialize()
5
8
 
6
- def send(peer, msg='ping'):
9
+ def send(peer, msg='modules'):
10
+ """
11
+ Send message to peer (by mac address)
12
+ :param peer: mac address of espnow device
13
+ :param msg: message string/load module call
14
+ """
7
15
  return Espnow.espnow_send(peer, msg)
8
16
 
9
17
  def start_server():
18
+ """
19
+ Start ESPNOW server/listener
20
+ - this can receive espnow messages
21
+ - it includes Load Module execution logic (beta)
22
+ """
10
23
  return Espnow.espnow_server()
11
24
 
12
25
  def stats():
26
+ """
27
+ Get ESPNOW stats
28
+ """
13
29
  return Espnow.stats()
14
30
 
15
31
  def add_peer(peer):
32
+ """
33
+ Add ESPNOW peer to known hosts
34
+ - It is needed before first send(...)
35
+ """
16
36
  now = Espnow.initialize()
17
37
  return Espnow.add_peer(now, peer)
18
38
 
19
39
  def mac_address():
40
+ """
41
+ Get ESPNOW compatible mac address
42
+ """
20
43
  return Espnow.mac_address()
21
44
 
22
45
  def help():
46
+ """
47
+ [beta] ESPNOW sender/receiver with LM execution
48
+ """
23
49
  return 'load', 'send <peer> "ping"', 'start_server', 'add_peer <peer>', 'stats', 'mac_address'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: micrOSDevToolKit
3
- Version: 2.9.10
3
+ Version: 2.9.11
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,71 @@ 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
- - Time (ntp location + sunset/sunrise api)
506
- - ESP-NOW (peer-to-peer communication) integration into InterCon
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][TODO]
498
+ - (3) New intercon syntax - command level integration: [TODO]
508
499
  - rgb toggle >>RingLight.local
509
500
  - similar as: 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
+ - (5) Proper mip installer support (/lib) [TODO]
532
+ - Note: Autonomous package management over wifi (github)
533
+ - pacman download
534
+ - pacman ls
535
+ - pacman dirtree
536
+ - pacman ...
510
537
  ```
511
538
 
512
- Version **3.1.0-0**
539
+ Version **3.1.0-0** `micrOS-SecurePower`
513
540
 
514
541
  ```
515
542
  Core:
516
543
  - Async socket servers with SSL/TLS integration (with auth.)
517
544
  - WebCli (https?), ShellCli (ssocket/sterminal) and InterCon
545
+ - Low power mode with ESPNOW + (AP mode?)
546
+ - Remote controller / Sensor UseCase
547
+ - --- client mode (fyi: normally micrOS operates in server mode)
548
+ - Intercon-Wire (?)
549
+ - Idea of wired message communication protocol same as Intercon-Shell/Intercon-espnow
550
+ - Possible HW protocols: i2c / onewire / uart BUT it should support bidirectional message transfers
551
+ - Goal: CoProcessor easy integration feature - Arduino env support
518
552
  ```
519
553
 
520
- Version **4.0.0-0**
554
+ Version **4.0.0-0** `micrOS-???`
521
555
 
522
556
  ```
523
557
  Core:
@@ -525,6 +559,7 @@ Version **4.0.0-0**
525
559
  - Network
526
560
  - wifi (defualt, current interfaces)
527
561
  - Study of BLE (Shell)
562
+ - Com. (wifi/now/ble...lora?/etc?.) as plugin architecture (?)
528
563
  - Low power mode (with BLE) and soft-sleep / deep-sleep
529
564
  ```
530
565
 
@@ -32,7 +32,7 @@ micrOS/micropython/esp32s3_spiram_oct-20231005-v1.21.0.bin,sha256=S-sv_QeL_Tylg1
32
32
  micrOS/micropython/esp32s3_spiram_oct-20241129-v1.24.1.bin,sha256=VbOF_F0YeqttkQd2ePTW66Jd34RU8u9ccFfcv8kxO_U,1662672
33
33
  micrOS/micropython/rpi-pico-w-20241129-v1.24.1.uf2,sha256=v4aYIbWaE94_f6DDzBWS-a9L1BzlcdkZwld9R7bOVA4,1727488
34
34
  micrOS/micropython/tinypico-20241129-v1.24.1.bin,sha256=Kf3cr766a5SK99CZy8bwdWjwvAZxls3tBYvaHBsw7ac,1527200
35
- micrOS/release_info/micrOS_ReleaseInfo/system_analysis_sum.json,sha256=8-NZSImslog5jRt31IYIPyCUzYyomKWmp2NI_sEILsE,5759
35
+ micrOS/release_info/micrOS_ReleaseInfo/system_analysis_sum.json,sha256=hUcG245oSHjZoAqx0yjbKXGGUHWNa7p0kcyDvMwxEKo,5759
36
36
  micrOS/source/.DS_Store,sha256=1lFlJ5EFymdzGAUAaI30vcaaLHt3F1LwpG7xILf9jsM,6148
37
37
  micrOS/source/Common.py,sha256=PAdtseGY6QxUM-5elOAcApUv8AwGQ_smsYex0FeV5w8,7937
38
38
  micrOS/source/Config.py,sha256=E3OTMRI1_T94GMADcvG7MKiuGsKsnbLn17KXHcjhqXM,8795
@@ -67,7 +67,7 @@ micrOS/source/LM_dimmer.py,sha256=Jhpeh0Kq7Dnt9nA8PVobENbsf1x-U7rOv9EGGdhC_30,83
67
67
  micrOS/source/LM_distance.py,sha256=iVqQchaUOvK8Ilzr7qMi-ESvS_U8RsBwdqNHY_4qZ-c,4394
68
68
  micrOS/source/LM_ds18.py,sha256=mLaH97j8d4lUXcjS8hNtwU8hL5Ybt-Q1WuoiWPnk5Ho,1807
69
69
  micrOS/source/LM_esp32.py,sha256=yUIMWsfimCAhgyV4pT4sh-kqE_mDL83cmAZji_2uFpI,1738
70
- micrOS/source/LM_espnow.py,sha256=0ihRds2Uzl5neSfVHxFP4Zdj9o66fN-NPqKe2iMYblw,475
70
+ micrOS/source/LM_espnow.py,sha256=Tto5JGnhbqyKT0hzDlJ_G-o_34dVf0CIaiMPbP-xbHU,1070
71
71
  micrOS/source/LM_gameOfLife.py,sha256=Mvr_S5zsJ6x_pMCGrkdgl5QdejNQjAF9mBYLN5-OA38,7685
72
72
  micrOS/source/LM_genIO.py,sha256=rTiFByly8ImjHBgc2RceGczGp1rzti7Juz_Vvg5hrtc,5013
73
73
  micrOS/source/LM_haptic.py,sha256=W0WiuOCxIu9RB-pWu8r8fvHmvuseet1UI7RSc9WO8zo,2862
@@ -130,9 +130,9 @@ micrOS/source/uwidgets_pro.js,sha256=gbkk3SVttEVvDCwde-pJhAh4k7GuCFPdcWNq32pcKPE
130
130
  micrOS/source/__pycache__/Common.cpython-312.pyc,sha256=qugnjE4Q1mMrR3VJaMhq71hsOoWLuft2lwv4O8Bo6ts,10366
131
131
  micrOS/source/__pycache__/Logger.cpython-312.pyc,sha256=CCdkMRG0lBy7nVsc4DHwdRK0Ap0Mu9yB5fa_Hxx-RHY,5075
132
132
  micrOS/source/__pycache__/Server.cpython-312.pyc,sha256=xy1ImeXPtGhtYlAWpuWaxLmJO2nLVGdefOuqltABR9k,20615
133
- micrOSDevToolKit-2.9.10.data/scripts/devToolKit.py,sha256=4GutIOErF1ny0HSNWQZzEneZdUWhSdqKPBjpRFTr5do,11192
133
+ micrOSDevToolKit-2.9.11.data/scripts/devToolKit.py,sha256=4GutIOErF1ny0HSNWQZzEneZdUWhSdqKPBjpRFTr5do,11192
134
134
  toolkit/DevEnvCompile.py,sha256=H19-60ZpHzP30C-wqR5QTzMDHHpWrTk0Uzh--TZHxvw,12148
135
- toolkit/DevEnvOTA.py,sha256=OkEtO5cpym-kEgGpE3TQbyZ-nQOzZpGzbFdbgCibe7I,25356
135
+ toolkit/DevEnvOTA.py,sha256=vNa827MOhbNQbeMGGu72YmGlNN_Tm9D6Trdnz3YGpyU,25499
136
136
  toolkit/DevEnvUSB.py,sha256=G-Ram-OR27flvVhul8J_ObiMY07Wjvom6Prc4dTfkmo,34108
137
137
  toolkit/Gateway.py,sha256=OSsJYeAmFhNnb1uu2bjLvZzE3A32O7lza8-NxlGr1DQ,25335
138
138
  toolkit/LM_to_compile.dat,sha256=TmcSZcPNVtJKWdyMxY1YtHPnqbD6zcI7B7FISbr6as4,579
@@ -168,6 +168,7 @@ toolkit/dashboard_apps/_micPlotting.py,sha256=zYXhyYKyyA_13ZQybccO4a6t8uyaFJNxlh
168
168
  toolkit/dashboard_apps/_presencePlotting.py,sha256=cHWR_4YqbNLB6d4mmHjGCYb3Dg5rqWIyu2lpnz0l-Hs,3737
169
169
  toolkit/dashboard_apps/uLightDemo.py,sha256=Q8PL56coysM71qV9SCU05yTyCsAMhtzDSjVeg_CkBtc,3163
170
170
  toolkit/lib/LocalMachine.py,sha256=m5xaWRx1PumKFLQ5_O8vVxC4NTclF1h9J3__pK8N-C4,18734
171
+ toolkit/lib/Repository.py,sha256=DVoS67rCJzHtJvPTZt-r4Gkmt28ZuC7UYdSAuczsPs0,2440
171
172
  toolkit/lib/SafeInput.py,sha256=gMXsMalPcFCwlN6niJlG2twOHfoGsEgHL9-Uh2YQJHE,855
172
173
  toolkit/lib/SearchDevices.py,sha256=1nnJDwo_U5cCN2xsdNUT6EQqdt2fW-qAWXWzyzXzyyc,5813
173
174
  toolkit/lib/SerialDriverHandler.py,sha256=Zn0zeq4mshTMVc6fzycvrOZiKt6w6YOxJcTWw3BMN2M,7344
@@ -180,6 +181,7 @@ toolkit/lib/micrOSClientHistory.py,sha256=EyCqbFeMy940bfXq4Yfu8dcvb7GnBvuHHxOAIg
180
181
  toolkit/lib/pip_package_installer.py,sha256=jpC-y1KR72_PJlqyUR6-U5b6l1szVqnIZ4nrSgUsOTM,4262
181
182
  toolkit/simulator_lib/.DS_Store,sha256=1lFlJ5EFymdzGAUAaI30vcaaLHt3F1LwpG7xILf9jsM,6148
182
183
  toolkit/simulator_lib/IO_darwin.py,sha256=f8HOfQKJvniShvjpBe6f4nisr6oJd9SnvxPsbdNIGQk,2336
184
+ toolkit/simulator_lib/aioespnow.py,sha256=NPAX85zLCb6ZJVW8n18tULV4NbHK1IzHYMR43QXAxUQ,480
183
185
  toolkit/simulator_lib/camera.py,sha256=BIyj6dF_PoszzTZ3Ea_-gsJ3aly_xGy5NMKeJGVSbFI,1485
184
186
  toolkit/simulator_lib/dht.py,sha256=WB56YlZJYop4a2wnFWyWSI9FsPC_zH885a-A4rDNGKo,278
185
187
  toolkit/simulator_lib/dotstar.py,sha256=Le6RvSAz3byjiF2RX4JWB8LVsNQtfMqPfM47fg-YFzs,95
@@ -207,6 +209,7 @@ toolkit/simulator_lib/view01.jpg,sha256=YI_faDB9yyFLzJKTCu1nW4XXxyvGPLfgdYtzW7vm
207
209
  toolkit/simulator_lib/view02.jpg,sha256=7EWtt8StDpLw3yDMG1nD8XjJgsC0ixpAq3SwPCb842k,35580
208
210
  toolkit/simulator_lib/webrepl.py,sha256=owxkwtNlV9zrE2inPtoLCc8U2QgmZOhxpcsX3wMPbik,37
209
211
  toolkit/simulator_lib/__pycache__/IO_darwin.cpython-312.pyc,sha256=LKUIXwaw3DBrvvRhIFi93xolxnI6W7CR6WePeApVo7I,1823
212
+ toolkit/simulator_lib/__pycache__/aioespnow.cpython-312.pyc,sha256=25jb4hcOhdbJnWJCH_Vh0Uwc6I8tvpFw3xpFznP4BQA,1555
210
213
  toolkit/simulator_lib/__pycache__/camera.cpython-312.pyc,sha256=hzK7NNmBQsIigz7Gof9FNblwVnP4Ffc3cILPLI-US6w,3152
211
214
  toolkit/simulator_lib/__pycache__/dht.cpython-312.pyc,sha256=-02X-tLNXpZIb2DhJI_-Qi1m-MmddzbQIpZUZVH9HZk,946
212
215
  toolkit/simulator_lib/__pycache__/dht.cpython-39.pyc,sha256=YwCF50_3cJ9QvAaVa5Mkl0EeASSIr8gwPtREzFcCEmk,878
@@ -303,7 +306,7 @@ toolkit/workspace/precompiled/LM_dimmer.mpy,sha256=dRdDr3WfFy-um3-fRiK4IuZdwBTUD
303
306
  toolkit/workspace/precompiled/LM_distance.mpy,sha256=6VoSsyd-hQ4P16USDnSqpq5gpi0v2WbseeHnTFJxuJA,1506
304
307
  toolkit/workspace/precompiled/LM_ds18.mpy,sha256=1TYvc8hj1ypE1v52l6u83e8XqUi0_Rjwil-BnYXDSKI,644
305
308
  toolkit/workspace/precompiled/LM_esp32.py,sha256=yUIMWsfimCAhgyV4pT4sh-kqE_mDL83cmAZji_2uFpI,1738
306
- toolkit/workspace/precompiled/LM_espnow.py,sha256=0ihRds2Uzl5neSfVHxFP4Zdj9o66fN-NPqKe2iMYblw,475
309
+ toolkit/workspace/precompiled/LM_espnow.py,sha256=Tto5JGnhbqyKT0hzDlJ_G-o_34dVf0CIaiMPbP-xbHU,1070
307
310
  toolkit/workspace/precompiled/LM_gameOfLife.mpy,sha256=mAOivt472fRGOcpgx6xShyfbrpT0GTbLhT2vujncS4w,2051
308
311
  toolkit/workspace/precompiled/LM_genIO.mpy,sha256=F9utR5Ng-QuTq5R5ISvYPO8xASEdSnndc1hFfxcNWOE,1722
309
312
  toolkit/workspace/precompiled/LM_haptic.mpy,sha256=46BgYkjC3AdNaJaKflFnY0oEUsd9qg6yGquX7jyFLnM,1276
@@ -364,8 +367,8 @@ toolkit/workspace/precompiled/urequests.mpy,sha256=-JDY-DOtJrGdwQo0-P809zZu-cJBR
364
367
  toolkit/workspace/precompiled/ustyle.css,sha256=P-s8ENwAcWoZi5bocrK3_kVzEjaRFKtFvEF6JRh4MBY,1429
365
368
  toolkit/workspace/precompiled/uwidgets.js,sha256=BGeUSbNHn6PClgIgIE6QszwQVJ6j7lzgCBwvIX8cYgo,6631
366
369
  toolkit/workspace/precompiled/uwidgets_pro.js,sha256=gbkk3SVttEVvDCwde-pJhAh4k7GuCFPdcWNq32pcKPE,3639
367
- micrOSDevToolKit-2.9.10.dist-info/LICENSE,sha256=hIahDEOTzuHCU5J2nd07LWwkLW7Hko4UFO__ffsvB-8,34523
368
- micrOSDevToolKit-2.9.10.dist-info/METADATA,sha256=YVrj02zAhSoulyDir7LmXfcWVUWoAIUhzxc1nN6aBsQ,53805
369
- micrOSDevToolKit-2.9.10.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
370
- micrOSDevToolKit-2.9.10.dist-info/top_level.txt,sha256=rOGOIXqLBdGZAoDTiLdZ9B_leFB7bMv7YabLwuIc2bc,25
371
- micrOSDevToolKit-2.9.10.dist-info/RECORD,,
370
+ micrOSDevToolKit-2.9.11.dist-info/LICENSE,sha256=hIahDEOTzuHCU5J2nd07LWwkLW7Hko4UFO__ffsvB-8,34523
371
+ micrOSDevToolKit-2.9.11.dist-info/METADATA,sha256=BqgNJ6O6FQZJclGKfkWwg2h04G8pL1_n1zVdaSVRsVY,55250
372
+ micrOSDevToolKit-2.9.11.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
373
+ micrOSDevToolKit-2.9.11.dist-info/top_level.txt,sha256=rOGOIXqLBdGZAoDTiLdZ9B_leFB7bMv7YabLwuIc2bc,25
374
+ micrOSDevToolKit-2.9.11.dist-info/RECORD,,
toolkit/DevEnvOTA.py CHANGED
@@ -12,6 +12,7 @@ try:
12
12
  from .lib.TerminalColors import Colors
13
13
  from .lib.SafeInput import input_with_timeout
14
14
  from .lib.file_extensions import check_all_extensions
15
+ from .lib.Repository import git_clone_archive, git_clone
15
16
  except Exception as e:
16
17
  print("Import warning __name__:{}: {}".format(__name__, e))
17
18
  from DevEnvCompile import Compile
@@ -19,8 +20,10 @@ except Exception as e:
19
20
  from lib.TerminalColors import Colors
20
21
  from lib.SafeInput import input_with_timeout
21
22
  from lib.file_extensions import check_all_extensions
22
- sys.path.append(MYPATH)
23
- import socketClient
23
+ from lib.Repository import git_clone_archive, git_clone
24
+
25
+ sys.path.append(MYPATH)
26
+ import socketClient
24
27
 
25
28
 
26
29
  #################################################
@@ -52,15 +55,17 @@ class OTA(Compile):
52
55
  # Change workdir
53
56
  workdir_handler = LocalMachine.SimplePopPushd()
54
57
  workdir_handler.pushd(os.path.dirname(os.path.dirname(webrepl_path)))
58
+ webrepl_url = 'https://github.com/micropython/webrepl.git'
55
59
 
56
- command = 'git clone {url} {name}'.format(
57
- name='webrepl',
58
- url='https://github.com/micropython/webrepl.git')
59
- self.console("Clone webrepl repo: {}".format(command))
60
+ self.console(f"Clone webrepl repo: {webrepl_url}")
60
61
  if self.dry_run:
61
- exitcode, stdout, stderr = 0, 'dry-run', ''
62
+ exitcode, stdout, stderr = 0, "", ""
62
63
  else:
63
- exitcode, stdout, stderr = LocalMachine.CommandHandler.run_command(command, shell=True)
64
+ # Git clone with command line tool
65
+ exitcode, stdout, stderr = git_clone(url=webrepl_url)
66
+ if exitcode != 0:
67
+ # Git clone archive - without git
68
+ exitcode, stdout, stderr = git_clone_archive(url=webrepl_url)
64
69
 
65
70
  # Restore workdir
66
71
  workdir_handler.popd()
@@ -156,7 +161,6 @@ class OTA(Compile):
156
161
  def update_with_webrepl(self, force=False, device=None, lm_only=False, loader_update=False, ota_password='ADmin123'):
157
162
  """
158
163
  OTA UPDATE via webrepl
159
- git clone https://github.com/micropython/webrepl.git
160
164
  info: https://techoverflow.net/2020/02/22/how-to-upload-files-to-micropython-using-webrepl-using-webrepl_cli-py/
161
165
  ./webrepl/webrepl_cli.py -p <password> <input_file> espressif.local:<output_file>
162
166
  """
@@ -0,0 +1,64 @@
1
+ import requests
2
+ import zipfile
3
+ import io
4
+ import os
5
+
6
+ try:
7
+ from .LocalMachine import CommandHandler
8
+ except:
9
+ from LocalMachine import CommandHandler
10
+
11
+
12
+ def git_clone_archive(url):
13
+ """
14
+ Clone git repo as archive (without git installed)
15
+ Note: No git history, it is just a snapshot
16
+ :param url: https://github.com/micropython/webrepl
17
+ """
18
+ print(f"CLONE ARCHIVE: {url}")
19
+ url = url.replace(".git", "") if url.endswith(".git") else url
20
+ # URL of the repository zip archive (adjust branch name if needed)
21
+ target_name = url.split("/")[-1].strip()
22
+ zip_url = f"{url}/archive/refs/heads/master.zip"
23
+ response = requests.get(zip_url)
24
+ if response.status_code == 200:
25
+ # Read the downloaded content as a binary stream
26
+ with zipfile.ZipFile(io.BytesIO(response.content)) as z:
27
+ for member in z.infolist():
28
+ # Each member's filename is something like 'webrepl-master/filename'
29
+ # Remove the first directory component
30
+ parts = member.filename.split('/', 1)
31
+ if len(parts) > 1:
32
+ relative_path = parts[1]
33
+ else:
34
+ relative_path = parts[0]
35
+
36
+ # Build the target path relative to the current directory
37
+ target_path = os.path.join(target_name, relative_path)
38
+
39
+ if member.is_dir():
40
+ os.makedirs(target_path, exist_ok=True)
41
+ else:
42
+ os.makedirs(os.path.dirname(target_path), exist_ok=True)
43
+ with z.open(member) as source, open(target_path, 'wb') as target_file:
44
+ target_file.write(source.read())
45
+ print(f"\tRepository extracted successfully: {target_name}")
46
+ return 0, zip_url, ""
47
+ print(f"\tFailed to download repository archive: {target_name}")
48
+ return 1, zip_url, ""
49
+
50
+
51
+ def git_clone(url):
52
+ """
53
+ Git clone - subshell call
54
+ - git is needed to be preinstalled
55
+ """
56
+ print(f"GIT CLONE: {url}")
57
+ target_name = url.split("/")[-1].strip().replace(".git", "")
58
+ command = 'git clone {url} {name}'.format(name=target_name, url=url)
59
+ exitcode, stdout, stderr = CommandHandler.run_command(command, shell=True)
60
+ if exitcode == 0:
61
+ print(f"\tRepository was cloned successfully: {target_name}")
62
+ else:
63
+ print(f"\tRepository clone failed: {target_name}")
64
+ return exitcode, stdout, stderr
@@ -0,0 +1,28 @@
1
+
2
+
3
+ class AIOESPNow:
4
+
5
+ def __init__(self):
6
+ self._active = False
7
+ self.peers_table = None
8
+
9
+ def active(self, state=None):
10
+ if state is not None:
11
+ self._active = state
12
+ return self._active
13
+
14
+ def stats(self):
15
+ pass
16
+
17
+ def add_peer(self, mac):
18
+ pass
19
+
20
+ async def asend(self, mac, full_msg):
21
+ pass
22
+
23
+ def send(self, mac, full_msg):
24
+ pass
25
+
26
+ def __iter__(self):
27
+ return (i for i in range(0, 3))
28
+
@@ -1,23 +1,49 @@
1
1
  import Espnow
2
2
 
3
3
  def load():
4
+ """
5
+ Initialize ESPNOW protocal
6
+ """
4
7
  return Espnow.initialize()
5
8
 
6
- def send(peer, msg='ping'):
9
+ def send(peer, msg='modules'):
10
+ """
11
+ Send message to peer (by mac address)
12
+ :param peer: mac address of espnow device
13
+ :param msg: message string/load module call
14
+ """
7
15
  return Espnow.espnow_send(peer, msg)
8
16
 
9
17
  def start_server():
18
+ """
19
+ Start ESPNOW server/listener
20
+ - this can receive espnow messages
21
+ - it includes Load Module execution logic (beta)
22
+ """
10
23
  return Espnow.espnow_server()
11
24
 
12
25
  def stats():
26
+ """
27
+ Get ESPNOW stats
28
+ """
13
29
  return Espnow.stats()
14
30
 
15
31
  def add_peer(peer):
32
+ """
33
+ Add ESPNOW peer to known hosts
34
+ - It is needed before first send(...)
35
+ """
16
36
  now = Espnow.initialize()
17
37
  return Espnow.add_peer(now, peer)
18
38
 
19
39
  def mac_address():
40
+ """
41
+ Get ESPNOW compatible mac address
42
+ """
20
43
  return Espnow.mac_address()
21
44
 
22
45
  def help():
46
+ """
47
+ [beta] ESPNOW sender/receiver with LM execution
48
+ """
23
49
  return 'load', 'send <peer> "ping"', 'start_server', 'add_peer <peer>', 'stats', 'mac_address'