/thinx-firmware-esp8266-lua

THiNX ESP8266 Vanilla Firmware for NodeMCU (LUA)

Primary LanguageLuaMIT LicenseMIT

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

  • Free THiNX Account

  • ESP8266-based microcontroller

  • NodeMCU firmware with following modules: http, cjson/sjson, mqtt, net, wifi

  • ESPlorer or any other compatible IDE

Tools

How to

  1. Create your own THiNX Account

  2. 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).

  3. Insert this API Key as THINX_API_KEY along with your owner-id as THiNX_OWNER_ID into the config.lua file. You should also adjust your wifi_ssid and wifi_password credentials, until those are injected using THiNX Environment Variables or captive portal will be supported (you're free to submit a PR).

  4. Upload thinx.lua, config.lua and init.lua to your ESP8266 (e.g. using ESPTool) and reboot.

  5. The device should now connect to WiFi, check-in to the THiNX server and acquire its own unique device identifier (unless already registered).

  6. 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.

  7. 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.

  8. 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) or lua (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