This winter I need to install a lot of sensors in my home. Currently I am using EspEasy on my ESP32 boards, and I am very pleased with it. But my ultimate dream is to have running Node-RED all over the place. Now at last there is a way to accomplish that: by using node-red-mcu from @phoddie, in combination with the node-red-mcu-plugin from @ralphwetzel.
But since this project is in early development, I found it very difficult to determine if it might be useful for me in the future. Because at the moment e.g. the list of supported sensors/boards/... is still rather limited. So I asked them some noob questions yesterday (see here), and those guys are really very helpful and open to support new features (sensors, ...).
So I would like to ask a favor from this community: are there any folks that can experiment a bit with this new technology, and share their experiences here with us. We have some very talented folks in our community, with a lot of knowledge about ESP32/ESP8266 boards. It would be really helpfull to see some tutorials arriving, to get people (like me) started quickly.
I truly believe this project has a lot of potential for us. And projects like this one can use all the help they can get...
I've been rebuilding my sensors to use ESPHome which I've found very reliable and flexible but mostly uses simple configuration but allows C++ code if you need something bespoke (e.g. standardising output for ESP's with displays).
As I can run this on even the meanest of ESP8266's right through to the most powerful ES32, it is a far better option for me at the moment. Especially since you can (and I have) split the config into separate common files. Making the config for each individual device just a matter of a series of file includes and changing the name & IP.
For me, what I ask of a microprocessor IoT platform is very different to what I ask of my home automation server so Node-RED is of much less value there. Perhaps that will change in the future.
@TotallyInformation – thanks for sharing your thoughts. I'd like to respond to a couple of points. I may not change your mind, but at least you'll have the facts.
...but allows C++ code if you need something bespoke...
As I can run this on even the meanest of ESP8266's right through to the most powerful ES32...
As does Node-RED MCU Edition. It Edition runs on baseline ESP8266, ESP32, and Raspberry Pi Pico. In my presentation at Node-RED Con, I showed it running on an ESP8266-powered lightbulb.
Especially since you can (and I have) split the config into separate common files. Making the config for each individual device just a matter of a series of file includes and changing the name & IP.
This sounds similar to our project manifests. In the Node-RED model, I suppose that would be done with the Environment Variables feature (which is working nicely in Node-RED MCU Edition)
For people that are wondering what this is all about, please have a look at this video from Peter about node-red-mcu. Then you can see how easy you can run Node-RED on your microcontrollers, even with UI stuff
Of course the amount of supported hardware (sensors, ...) is pretty limited in this early stage. But with some interest/support from our community, I am convinced they will manage to solve that...
This is fantastic work! I always thought about - what if you could run "microservices" on an MCU, like a webserver - yes i know this is possible with arduino/micropython, but using node-red flows to build it is fantastic. I can imagine this is a tremendous amount of work to make flows work/compile. Best of all is that you can create things with tools I already like to work with: node-red, while it could act like esp-home/easy but with your own logic. Great stuff, thanks!
That is all that is needed in order to send the sensor outputs to MQTT.
Not trying to take away from that amazing work that has been done with node-red-mcu, only saying that I'm not sure it makes sense for me. I don't want the MCU's to do lots of complex things. I want them mostly to simply & reliably send me data and occasionally respond to a button. Node-RED on my home automation server does the complex things anyway.
Of course, other people may well be wanting more complexity in the MCU and I would certainly consider this project for that purpose.
I run web servers on all of my MCU's. They show the available outputs, current config, allow changing of settings and OTA updates. Most of the firmwares have these capabilities.
If you prefer using yaml files instead of configuring and wiring nodes, I would advice you to have a look at HomeAssistant as well and just drop Node-RED entirely
Anyway we are going a bit off-topic. It was not my intention to discuss here all the alternative firmwares (which we already know), but instead making Node-RED and dataflow lovers a bit warm to run flows also on their microprocessors.
And indeed the current set of sensors is rather limited - as mentioned already a couple of times above. But hopefully that will improve in the near future.
here is the configuration file for a BH1750 light sensor:
Yes and where is the logic, if else then, transform messages ?
That is the point of this project; build the complete logic flow, read/write local files, control/read GPIO, send data to databases (this is fantastic in combination with surrealdb), mqtt and whatnot, compile, flash and let it run forever. I like it a lot.
I'm not denying that it will be really helpful where you need more complex logic. My point is that, for me, I rarely need much logic because the pre-configured sensors and other tooling gives me most of what I want. So the simple config is more than enough for nearly all my MCU needs. A quick dip into a lambda for some simple custom logic (as you can se in the last example) or very rarely a .h C++ include file gives me more complex logic such as what I built to have a simple "page" layout tool for the M5 Basic's built-in screen.
When there is a good range of pre-built sensors and controls, I'll be able to try it out.
I guess the question from me would be - are there modules/nodes/??? that directly support the wide range of pre-configured sensors
There is a large and growing suite of sensors. Just this week we added the APDS9301 ambient light sensor and the VL6180 Time-of-Flight Range Finder (which also includes an ambient light sensor).
We do something neat that makes adding new sensors to Node-RED MCU easy. There is a single MCU Sensor node that works with all the sensors. The MCU Sensor node works with Sensor classes that follow the ECMA-419 Sensor Class Pattern standard.
The MCU Sensor node has a simulation implementation that runs in full Node-RED. It generates random sample data so you can test your flows independently of an MCU. That's very useful for development.
A group of developers in Japan has been working very successfully with the MCU Sensor node. One published a great article on Qiita (even if you don't read Japanese, it is worth a look) and recently published a small book on Node-RED MCU Edition to teach others about it.
That is all that is needed in order to send the sensor outputs to MQTT.
Right! That's a three node flow. I think you know how to do that already.
Not trying to take away from that amazing work that has been done with node-red-mcu, only saying that I'm not sure it makes sense for me. I don't want the MCU's to do lots of complex things. I want them mostly to simply & reliably send me data and occasionally respond to a button
Thanks for that. I get it. I think there are a some points you might consider looking ahead:
Node-RED Is good at doing simple things too.
There is a simplicity in having both the server and the sensor nodes running the same software. That lets you use the same knowledge and skills to manage both.
The sensor node supports sensor classes that conform the Ecma-419. But I don't see for example anything related to power/energy/voltage in that list, even in the proposal to add new sensor types. As a result is not clear how Andy can implement the pzem-004t for me? Would be nice if you could explain that.
Interesting sounding stuff, will have to put FlexDash dev on pause for a while...
Unlike Julian, I do like to run logic on my nodes. (Using micropython so far.) The primary reason is that I want stuff to work even if the wifi/network/server/Node-RED is having a bad day.
watering controllers: I want the watering schedule to continue regardless
greenhouse environmental controls: I don't want my plants to feeze/cook
house shutters: need to continue working else the boss comes storming in
weather station: continue recording and buffering data, catch up later
I don't have lighting controls, but again, I wouldn't want to be in the dark
The more I add to home automation the more I want "end nodes" to have some autonomy...
I certainly recognise a possible need, just that I don't have that need myself right now since my lighting and heating controls are not ESP-based For my custom sensors, I don't really care if I miss a bit of data. But that is just me. It isn't that I don't like the idea of this, merely that I don't currently have time to do anything with it.
@BartButenaers, thanks for the questions about the ECMA-419 Sensor Class Pattern.
But I don't see for example anything related to power/energy/voltage in that list...
Right, it isn't there. Not yet. But that's not a problem.
As a result is not clear how Andy can implement the pzem-004t for me? Would be nice if you could explain that.
The Sensor Class Pattern is a pattern by design. Anyone can create a compatible sensor by following the pattern. To conform to the pattern, the driver must implement the four required calls - constructor, close, configure, and sample - as defined by the standard. That's pretty straightforward. For your pzem-004t, the options for configure and the output of sample will be defined based on the sensor's data sheet.
TC53 (the committee responsible for ECMA-419) accepts proposals for new sensor classes. We could roll an Energy Sensor into a future version of the standard. We want to standardize things that are broadly useful, not favoring any single manufacturer. So, when we do that, the committee looks at a variety of sensors of the same type from various manufacturers, so that the standard configure and sample options can be used by all sensors of that type. This approach has worked very nicely. For example, in projects at Moddable we've swapped in temperatures, accelerometers, and an RTC just by changing to a different ECMA-419 compatible driver -- with no code changes to the project.
I hope that makes sense. ECMA-419 is kind of a different standard in this way. Where most standards strictly limit what can be done, the use of Class Patterns in ECMA-419 provides flexibility to support new kinds of hardware in a compatible way.
Can someone clarify how node-red-mcu and more specifically node-red-mcu-plugin works from an overall architecture perspective? I can't glean it from the docs and I have been unsuccessful getting it to run so far (open issues).
The specific question I have is how it integrates into a Node-RED environment as a whole. I understand that I create a flow, mark the flow as being an MCU flow in the plugin sidebar, and it gets compiled, yadda, yadda...
The first question I have is whether I can send messages from a regular server flow to an MCU flow and vice-versa? If so, how are they transported? If not, are the MCU flow just "aliens" in the overall Node-RED project? Or perhaps it's a "yet to come" feature?
The second question is how does "deploy" look in practice. I haven't figured out whether moddable always produces a full flash image or whether the user app (NR flows in this case) can be a thin overlay over a base system so the amount of stuff that gets flashed in an edit-experiment cycle is small.