WebThingsIO / webthing-upy

MicroPython implementation of a Web Thing server
MIT License
53 stars 16 forks source link

Less hurdles for beginners.. #21

Open hoihu opened 5 years ago

hoihu commented 5 years ago

I was having troubles to get started with the web things upy and would like to propose some enhancenments for first time users, to get users started quickly.

As I understand, microwebsrv should be available as frozen module within uPy - which in turns requires to have the full build toolchain available. It also means you have to checkout the version from the repository from @dhylands, which may not be the most recent version of the loboris fork. Both of this steps are not very straightforward to do.

I would be nice to have a known-good prebuild binary available that can be flashed to the ESP-WROVER-KIT or SparkFun ESP32 Thing, to get new users started quickly with uPy + WebThings.

Possibly, since I belive the upstream repository from https://github.com/jczic/MicroWebSrv has merged the changes from @dhylands, new users may fork this official repo and then apply these changes to the loboris repo (I haven't tested this though).

And then a wish: Would it be possible to extend the supported devices to the new pyboard D series? Possbily this device could run microwebsrv.py even as precompiled and/or python code (not frozen) - that would allow to simply drag&drop the files to the pyboard flash mass storage without installing any build toolchains (which really should be the goal to make uPy-webthings more attractive IMO).

Thanks for your feedback and it's great that mozilla is supporting uPy!

hoihu commented 5 years ago

So I quickly tested the pyboard D serie with microwebsrv.py (not frozen) and it seems to work at first glance (demo http page was shown) with minimal changes.

But.. The pyboard's network support does not support mDNS out of the box. But that's needed to run the webthing support. Not sure if it's mandatory.

I tried to add the slimDNS repo https://github.com/nickovs/slimDNS/blob/master/slimDNS.py but didn't succeed either since an error was thrown OSError: [Errno 98] EADDRINUSE. I'm not sure if the pyboard D series actually has the mDNS port open as default. So that's where I am, still struggling.

hoihu commented 5 years ago

I figured out that on the Pyboard D series, mDNS is enabled, see also https://forum.micropython.org/viewtopic.php?f=20&t=6674

I was also able to run the microwebsrv and set/clear an LED via API after making some minor changes to the microwebsrv code (also I believe there is a bug in server.py, see https://github.com/mozilla-iot/webthing-upy/issues/24)