Skip to content
Sergiu Toporjinschi edited this page Dec 11, 2018 · 1 revision

ESPManager

A wrapper over Wifi and MQTT.

Dependencies:

For details using SettingsManager please see the read.me file.

Constructor

ESPManager(<string spiffConfFile>, <int mqttQOS>, <boolean sendStatus>);

  • Initialise MQTT;
  • Reading settings from SPIFFS;
  • Configure WIFI as station;

addOutputEventHandler

addOutputEventHandler(<string mqttTopic>, <long intervalToSubmit>, <function executeFn> ) Will execute the executeFn in interval of intervalToSubmit and submit the returned value to mqttTopic topic;

  • mqttTopic a string with mqtt topic;
  • intervalToSubmit time to delay until next function trigger;
  • executeFn a function which returns the string that will be sent over MQTT;

addInputEventHandler

addInputEventHandler(<string mqttTopic>, <function onCall>) Creates a listener on a specific MQTT topic and will execute the onCall when something has been submitted;

  • mqttTopic a string with MQTT topic;
  • onCall a void function;

createConnections;

createConnections() Creates connections and starts the process.

Clone this wiki locally