thinx-firmware-esp8266-lua
THiNX ESP8266 Vanilla Firmware for NodeMCU (Lua)
Can be assembled and managed by Remote Things Management based on THiNX OpenSource IoT platform.
Prerequisites
-
ESP8266-based microcontroller
-
NodeMCU firmware with following modules:
http
,cjson/sjson
,mqtt
,net
,wifi
-
ESPlorer or any other compatible IDE
Tools
-
NodeMCU Firmware Builder - customize your NodeMCU Lua firmware
-
ESPTool - upload your firmware, erase flash, de-brick
-
ESPlorer - edit/upload your Lua code to device
-
MQTT.fx - subscribe/post to the message queue
-
NodeMCU DevKit - explore original devkit
How to
-
Create your own THiNX Account
-
After validating your account, go to API Keys page and create new API Key for this device (it will be shown only once to you, make sure you have a copy in your clipboard).
-
Insert this API Key as
THINX_API_KEY
along with your owner-id asTHiNX_OWNER_ID
into the config.lua file. You should also adjust yourwifi_ssid
andwifi_password
credentials, until those are injected using THiNX Environment Variables or captive portal will be supported (you're free to submit a PR). -
Upload
thinx.lua
,config.lua
andinit.lua
to your ESP8266 (e.g. using ESPTool) and reboot. -
The device should now connect to WiFi, check-in to the THiNX server and acquire its own unique device identifier (unless already registered).
-
As a next step it will connect to the MQTT Message Broker on its own channel
/devices/[owner_id]/[device_id]
and publish its status. It may receive response from the THiNX Messenger about available firmware update. -
In case the device has
auto_update
enabled and source code update from attached attached repository is available, it should perform self-update and reboot. -
THiNX now supports building whole NodeMCU firmware using the dockerized builder. In near future, it will allow for module customization.
Custom firmware
You can build your own custom firmware using nodemcu-docker-build.
Example of thinx.yml
file used to remote-configure the builder:
- Build type can be either
firmware
(build firmware) orlua
(application files only). - If you need to build firmware with integer support, set
float: false
nodemcu:
build:
type: firmware
float: true
modules:
c:
- coap
- crypto
- dhtlib
- driver
- esp-gdbstub
- fatfs
- http
- include
- libc
- lua
- lwip
- mapfile
- mbedtls
- misc
- modules
- mqtt
- net
- pcm
- platform
- pm
- sjson
- smart
- spiffs
- swTimer
- task
- tsl2561
- u8glib
- ucglib
- user
- websocket
- wofs
lua:
- bh1750
- bmp085
- dht_lib
- ds18b20
- ds3231
- email
- hdc1000
- http
- lm92
- mcp23008
- redis
- si7021
- thinx
- tsl2561
- yeelink