See my write-up on IoT with Mongoose OS. Here you can find a brief write-up about my projects based on Mongoose OS and my general experience with this IoT platform.
This is a Mongoose OS project containing a configuration template and code written in the so-called minimal JavaScript or mJS.
If you have ever used a smart switch this project does basically the same thing, but responds to messages sent over MQTT. If you were to try something like this yourself, I would recommend looking at platforms that make this work a more compatible out the box with other automation frameworks such as Tasmota.
At startup, GPIO channels are initialized and a timer is enabled to publish heartbeat messages. Using the configured topic paths, an MQTT client is created to receive control JSON-encoded control messages and then respond with the latest switch state. Switch state changes update globals which are used in MQTT message responses and heartbeats because GPIO channel states could not be read with the GPIO channels in OUTPUT
mode.
Technologies that help make this project useful:
Here is some detail about the intended use of this project.
Your development environment needs to have the mos
tool available to build firmware binaries and for first-time configuration of the device. Mongoose OS has a good getting started guide with installation instructions.
The Mongoose OS documentation provides a detailed but concise instruction on how to use the mos
tool to build the binaries that can then either be flashed directly to a USB-connected IoT device or that can be uploaded to the mDash site and delivered as an OTA update.
Distributed under the MIT License. See LICENSE for more information.