Skip to content

A NodeMCU app implementing control over verious devices such as LEDs, motors, fans, etc via MQTT.

Notifications You must be signed in to change notification settings

dstrelnikov/nodemcu-mqtt-handler

Repository files navigation

NodeMCU: MQTT handler

A NodeMCU app implementing control over verious devices such as LEDs, motors, fans, etc via MQTT.

License: MIT

Features

  • declare devices and their features in the config file
  • assign functions to process messagess addressed to a certain device (handlers)

Usage

Adjust the config file to your needs: Wi-Fi network, MQTT broker IP, MQTT client ID, etc. Declare devices in the config file according to the following example:

config.objects.example = {
    pwmpins = {[1] = 0, [2] = 0, [3] = 0}, -- {pin_no = initial_value}
    subtopic = "/example",
    qos = 0,
    -- handlers must be a flat table
    handlers = {
        feature_1 = handler_1, -- handler is a function of (object, message)
        feature_2 = handler_2
    }
}

Implement more handlers for your devices if neccessary and import them in init.lua.

TODO

  • add telnet server for debugging
  • implement OTA updates

About

A NodeMCU app implementing control over verious devices such as LEDs, motors, fans, etc via MQTT.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages