Using webrepl instead of USB connection with Thonny IDE
Using webrepl instead of USB connection with Thonny IDE
Hi,
After trying out nearly a dozen IDE's, I've finally settled for Thonny. Seems really great for small to medium projects with MicroPython and my ESP8266. Only thing is, having USB cable plugged in during development is extremely inconvenient, especially with moving projects (robots and such).
How can I set up Thonny IDE to allow me to run or upload scripts and manage files via webrepl, without USB connection? I see that previous versions of Thonny used to have webrepl as experimental feature, but now it is gone for some reason. So how do I use it? Or do I need to use something other than webrepl? The final goal is to have a one-click setup from within IDE to get my code to and from my ESP8266 over WiFi.
I see that Thonny is pretty popular around here, so I'd love to hear how you guys solved this.
After trying out nearly a dozen IDE's, I've finally settled for Thonny. Seems really great for small to medium projects with MicroPython and my ESP8266. Only thing is, having USB cable plugged in during development is extremely inconvenient, especially with moving projects (robots and such).
How can I set up Thonny IDE to allow me to run or upload scripts and manage files via webrepl, without USB connection? I see that previous versions of Thonny used to have webrepl as experimental feature, but now it is gone for some reason. So how do I use it? Or do I need to use something other than webrepl? The final goal is to have a one-click setup from within IDE to get my code to and from my ESP8266 over WiFi.
I see that Thonny is pretty popular around here, so I'd love to hear how you guys solved this.
-
- Posts: 67
- Joined: Fri Sep 04, 2020 9:27 am
- Location: Hanko, Finland
- Contact:
Re: Using webrepl instead of USB connection with Thonny IDE
I am interested about this topic too.laukejas wrote: ↑Thu Oct 22, 2020 3:01 pmHi,
After trying out nearly a dozen IDE's, I've finally settled for Thonny. Seems really great for small to medium projects with MicroPython and my ESP8266. Only thing is, having USB cable plugged in during development is extremely inconvenient, especially with moving projects (robots and such).
How can I set up Thonny IDE to allow me to run or upload scripts and manage files via webrepl, without USB connection? I see that previous versions of Thonny used to have webrepl as experimental feature, but now it is gone for some reason. So how do I use it? Or do I need to use something other than webrepl? The final goal is to have a one-click setup from within IDE to get my code to and from my ESP8266 over WiFi.
I see that Thonny is pretty popular around here, so I'd love to hear how you guys solved this.
I am using PyCharm with Micropython plugin and PuTTY for serial (USB) and WebREPL. PyCharm can send code to the ESP32 and 8266, but since last updates it's serial REPL is broken and that is why I have to use PuTTY for serial connection REPL.
The WebREPL I have used for remote updates file by file (like import os, os.remove('main.py')) mainly because I have not yet implemented OTA-updates.
Perhaps WebREPL client side code can be integrated with IDEs, but I do not know how.
- aivarannamaa
- Posts: 171
- Joined: Fri Sep 22, 2017 3:19 pm
- Location: Estonia
- Contact:
Re: Using webrepl instead of USB connection with Thonny IDE
Thonny has WebREPL support, but currently it's either unreliable or slow (depending on the configuration) because of https://github.com/micropython/micropython/issues/2497.
I have some ideas about workaround and I can let you know when it's ready.
I have some ideas about workaround and I can let you know when it's ready.
Aivar Annamaa
https://thonny.org
https://thonny.org
-
- Posts: 67
- Joined: Fri Sep 04, 2020 9:27 am
- Location: Hanko, Finland
- Contact:
Re: Using webrepl instead of USB connection with Thonny IDE
I presume websocket_helper.py, webrepl_pli.py and FileSaver.js https://github.com/micropython/webrepl can be added to Thonny and other IDEs as is? Perhaps these same standard libraries can be used for some sort of central management as well.
- aivarannamaa
- Posts: 171
- Joined: Fri Sep 22, 2017 3:19 pm
- Location: Estonia
- Contact:
Re: Using webrepl instead of USB connection with Thonny IDE
Thonny has a custom solution, and currently it would be hard to use outside of Thonny, but you could check out https://github.com/Hermann-SW/webrepl by @HermannSW for central management.Divergentti wrote: ↑Sat Oct 24, 2020 8:45 amI presume websocket_helper.py, webrepl_pli.py and FileSaver.js https://github.com/micropython/webrepl can be added to Thonny and other IDEs as is? Perhaps these same standard libraries can be used for some sort of central management as well.
Aivar Annamaa
https://thonny.org
https://thonny.org
Re: Using webrepl instead of USB connection with Thonny IDE
Just to confirm is this something that is in development but not available to users or a feature that should be accessible but may not work well. I ask as I have seen tutorials on using webrepl with thonny but can't access it in either the windows or linux versions.aivarannamaa wrote: ↑Thu Oct 22, 2020 6:23 pmThonny has WebREPL support, but currently it's either unreliable or slow (depending on the configuration) because of https://github.com/micropython/micropython/issues/2497.
I have some ideas about workaround and I can let you know when it's ready.
Just to add another use case to the one mentioned above, the main reason for my interest is that I am using Chrome OS which currently doesn't support CH340 connections in its Crosinti Linux environment
- aivarannamaa
- Posts: 171
- Joined: Fri Sep 22, 2017 3:19 pm
- Location: Estonia
- Contact:
Re: Using webrepl instead of USB connection with Thonny IDE
WebREPL support has been experimentally enabled in some Thonny version and disabled in others. The best state of it is in Thonny's code repository and I hope to publish it as the next beta of version 3.3 in couple of days.Minyiky wrote: ↑Sat Oct 24, 2020 5:57 pmJust to confirm is this something that is in development but not available to users or a feature that should be accessible but may not work well. I ask as I have seen tutorials on using webrepl with thonny but can't access it in either the windows or linux versions.
Aivar Annamaa
https://thonny.org
https://thonny.org
- aivarannamaa
- Posts: 171
- Joined: Fri Sep 22, 2017 3:19 pm
- Location: Estonia
- Contact:
Re: Using webrepl instead of USB connection with Thonny IDE
I just released the next beta of Thonny 3.3, which should work much better with WebREPL: https://github.com/thonny/thonny/releases/tag/v3.3.0b7
Looking forward to your feedback!
Looking forward to your feedback!
Aivar Annamaa
https://thonny.org
https://thonny.org
Re: Using webrepl instead of USB connection with Thonny IDE
It's great. Far fewer exceptions that in the previous build I tried. Amazing software. I do have a question. Is it possible to dynamically capture keystrokes on Thonny and send them to ESP8266 via REPL? I have built a simple robot, and I would like to have an option to manually control it with arrow keys on my keyboard over WiFi, rather than entering commands and having to press Enter each time. Does REPL support this?aivarannamaa wrote: ↑Mon Nov 02, 2020 9:12 pmI just released the next beta of Thonny 3.3, which should work much better with WebREPL: https://github.com/thonny/thonny/releases/tag/v3.3.0b7
Looking forward to your feedback!
- aivarannamaa
- Posts: 171
- Joined: Fri Sep 22, 2017 3:19 pm
- Location: Estonia
- Contact:
Re: Using webrepl instead of USB connection with Thonny IDE
Nope, Thonny's Shell does not support capturing keystrokes. Actually, I don't see how you could capture keystrokes in MicroPython even if you were using a proper terminal emulator.
> Far fewer exceptions that in the previous build I tried
Do you mean misbehaviors of Thonny? Please report them at https://github.com/thonny/thonny/issues/new
> Far fewer exceptions that in the previous build I tried
Do you mean misbehaviors of Thonny? Please report them at https://github.com/thonny/thonny/issues/new
Aivar Annamaa
https://thonny.org
https://thonny.org