Hi everyone, I’m prototyping a small ESP32 sensor node (BMP/BME style) that will send temperature/pressure readings to a server; I followed this practical tutorial that shows how an ESP32 reads a BMP/BME sensor and uploads data to a cloud endpoint, which helped shape my data-publishing idea: https://www.theengineeringprojects.com/2022/03/esp32-bmp280-sensor-interfacing-with-thingspeak-webserver.html. I’m weighing two simple approaches for integrating with Frappe/ERPNext: (A) have the ESP32 do an authenticated HTTP POST directly to a Frappe REST endpoint, or (B) publish to a local MQTT broker (Mosquitto) and let a tiny bridge forward messages into Frappe. Any suggestions on which is simpler and more robust for a beginner, and are there pitfalls with auth/session handling or JSON schema that I should watch for?
If you let the microcontroller device send it to the API, it must be able to handle the ERPNext API protocol (including SSL if needed) and also be ready to deal with an ERPNext Instance which might not immediately reply and which could lag for reasons of load, depending on the circumstances, so you must ensure it won’t somehow block (but rather skip measurements if it can’t buffer them on-device). Or so.
A MQTT broker might be more regularly available to the controller, because it’s optimized for such simple message reception and resending (“brokering”) to its listeners. But it’s an additional software to reliably operate over time, if it is needed besides ERPNext. Thus, speaking directly to the API might be simpler and easier after all.
Instead of relying on some ThingSpeak (Cloud) server, I’d like to point out that there are other projects handling the same kind of data, with rather robust guaranties of respecting the user and their data:
- https://esphome.io/ - Sensor device programming framework, having lots and lots (thousands) of sensor integration scripts/software ready to be used.
- https://www.home-assistant.io/ - Software for a small device used as a server, and a framework to gather data from these and update the devices over the air. (Also includes an MQTT plugin.) Uses Docker to separate certain concerns during updates of the device itself and rebuilding of the sensor device firmwares if there are updates available.
I didn’t check in detail how ThingSpeak operates, but even at first glance it seems to be more commercially oriented than the ones I’m listing above.
Disclaimer: I myself run some home devices with these two projects, which I specifically chose because of the ethics they display, and the possibility to keep the data out of external servers, and of course the sheer number of supported devices.
So, which projects better represents the real open source spirit so forcefully and with integrity cherished by the frappe ecosystem is left as an exercise to the reader.