I don't know if the original Rails would have run on mruby though (if it had existed at the time), and Rails certainly did a lot of things the author of microdot would have considered "dark magic".
I'm fascinated by your approach where you used your own temperature and humidity monitors. Apologies if this is in the links in the article, but I wondered how you controlled your heating unit. The reason I ask is that I have a nest device talking to my AC unit, which means I'm locked into the Google ecosystem. It works well, but it doesn't connect to the Home Assistant system for everything else in the house. I would like to remove the Nest dependency, or at least have multiple ways I could start optimizing the power utilization of my AC unit.
As part of the service, this controller gives you the option to send commands through an app, or by sending SMS (the device comes with a SIM card and gets its own mobile number). The commands would allow you to ask if the heating is running or not, to turn the heating on or off, and so on.
I first implemented the SMS interface with Twilio, but then found that the number of texts you can send to the device is capped. I don't remember what was the monthly allowance, but I reached it in a few days after querying the device every 15 minutes or so 24/7.
I then found a project on GitHub with the reverse-engineered API that the phone app used to send commands. So I then reimplemented the command logic using this API to be able to talk to the controller without limitations.
I'm not familiar with the Nest devices, but I'd suggest you do a search on GitHub to see if someone figured how to reverse-engineer its API.
Really appreciate you sharing this work, really fun stuff!
Directly controlling the HVAC with a relay board would also be very doable, but is a more involved project.
The problem is that if I look here I cannot tell the first thing about which device is supported and how well. HA does not have a great filtering system.
Cheers!
1 - https://blog.miguelgrinberg.com/post/benchmarking-micropytho...
The article you are referring to is intended to benchmark microcontrollers running MicroPython. Nothing to do with Microdot.
I'm not really sure what conclusions you expect to reach if you had a Microdot benchmark that gives you a requests per second number. I would not stop using microcontrollers if the number was low, and I wouldn't start more projects if the number was high. I don't really care. It works for the intended purpose.
What's great is that signals and fd_sets are supported, so it can really tie the web services and the hardware together nicely. I can easily wire up GPIO, for example.
I haven't dug into Microdot yet - but are there similar mechanisms? I love my Lua projects based on TurboLua, but wouldn't mind seeing some python chops get sharpened, same-wise ...
Edit: I dug in, and I guess the things I want are to be found in the python batteries included anyway .. plus, Microdot is a very small tack-on to microPython, and a pleasure to read ..
These devices have no concept of processes, your application is the only thing that runs. Most devices do not support threads, and those that do have really big limitations. Like for example, a device with two cores would allow you to spawn just one thread, to run on the second core and that's it. This is due to the lack of a proper operating system with a scheduler that can move threads in and out of the CPU.
It also uses libraries for most "extensions" that are available, defeating the purpose and bending the claim that it's 1,700 lines of code including the extensions. Just jinja, one of the dependencies, is 18,000 lines of code. If that counts my Nanodot server which calls flask.app.run() is one line...
The only two extensions that use dependencies are the one that adds template rendering, and the one that implements secure user sessions.
For templates, you can use Jinja on CPython (where you wouldn't normally have space issues), or the uTemplate library (https://github.com/pfalcon/utemplate) on MicroPython, which is quite small.
For secure sessions, on CPython you have to add PyJWT. On MicroPython you need to add the HMAC and JWT modules from the MicroPython standard library, which are not installed by default. These are also very small.
How do you explain why virtually all frameworks end up requiring an order of magnitude more LoC?
I made a similar "framework" in PHP years back as an experiment and it was a couple hundred lines AT MOST.
Not necessarily. For example, some minimal web frameworks actually provide multiple routing strategies because different implementation strategy have tradeoffs.
Having pulled down a copy just now, the framework itself is 526 lines of PHP, and the sample site (a newsfeed that pulls from the BBC) is perhaps 300 lines in models and controllers. I use the framework to this day to serve out my blog and other small sites, seems to work well without getting in the way.
Webassembly in the browser would be… webassembly.
Not sure what’s going on in this thread, but I see an unusual high number of low quality comments.
Version 2 of Microdot incorporates feedback received from users of earlier releases, and attempts to improve and correct some design decisions that have proven to be problematic.
For this reason most applications built for earlier versions will need to be updated to work correctly with Microdot 2. The Migration Guide describes the backwards incompatible changes that were made.
Elsewhere on HN right now is a post about a dermatologist vibecoding an app for skin stuff. I view the “need/use ai for coding” as an indictment against how complex software development has become. What I think we marvel at is the surprise that sometimes reall can be just that simple. 99% of the people who are using Django/flask/etc don’t really understand how they work under the hood all that well. And so it’s always an “is that all??” moment when we do these “back to the basics” exposé’s where we show that 80% of our needs are covered by something simple and understandable.
One other way to look at it is that software is realizing enough of the dreams of reusability that cobbling together scripts at such a high level with only the smallest understanding is finally becoming possible. I'm not going full Pangloss here, development is still a massive clusterfuck in many places and probably always will be by its nature, but the frontiers have pushed waaaaay back since I got started.
...JavaScript? (half joking)
There's a reason why, in the late 90s and early 2000s, people were able to jump out of non-technical careers into development using languages like ASP and ColdFusion. There were some shortcomings of the stacks of the day, but functionally, the ability to meet many business cases really hasn't changed since those days.
Notwithstanding that shadow IT is the bane of my existence these days, I sometimes need to be reminded of how far a motivated individual can come when they have access to adequate tools and information.
I read somewhere that the number of Excel "programmers" is an order or magnitude larger than all professional programmers in all other languages put together.
Makes you wonder which is the "shadow IT"!
emil-lp•1d ago
It is a single 765-line file with routing, JSON handling, cookies, streaming, and TLS. Created to provide a web server for IoT devices.
homarp•1d ago
enkrs•1d ago