Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/splitbrain/nodemcu-scripts
scripts to power my nodemcu boards
https://github.com/splitbrain/nodemcu-scripts
Last synced: 27 days ago
JSON representation
scripts to power my nodemcu boards
- Host: GitHub
- URL: https://github.com/splitbrain/nodemcu-scripts
- Owner: splitbrain
- Created: 2017-06-04T16:22:22.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2021-07-28T21:15:56.000Z (over 3 years ago)
- Last Synced: 2024-10-05T13:16:11.214Z (about 1 month ago)
- Language: Lua
- Size: 20.5 KB
- Stars: 3
- Watchers: 4
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# NodeMCU Scripts
> Scripts to power my NodeMCU boardsThis is a simple framework to run on a [NodeMCU](https://www.nodemcu.com/) controller.
It provides an easy way to:
- Configure the WiFi.
- Subscribe and publish MQTT messages, handling all the possible errors by reconnecting.I will probably run multiple NodeMCUs in the future. To make it easier, they
will all receive the same Lua files, but each one will run a specific `app_*.lua`Which NodeMCU is responsible for what is configured in the `nodenames` table of
[config.lua](/config.lua), the `node.chipid()` is used to figure out where we run.The [config.lua](/config.lua) also contains some basic setup for the WiFi and the MQTT broker.
Passwords have to be placed in an unversioned `secrets.lua`.
See the [secrets.lua.dist](/secrets.lua.dist) file for a template.The wifi setup has a `g.wifi.waitThen()` method accepting a callback that will
be run only after an IP address has been assigned. You will probably want to wait
for that before starting the MQTT client.See [app_balcony.lua](/app_balcony.lua) for an example application. It allows the control of a water
pump via MQTT. However, the pump will not run when the water level is too low.