ITTIoT framework

ITTIoT is a full-featured IoT framework for the ESP8266 platform. The IoT framework aims to significantly simplify the creation of IoT applications on the ESP8266 platform. The MQTT protocol (Wiki), which is widely used in the IoT field, is used to exchange data with the server. The IoT framework includes:

  • WiFi network / MQTT server connection management
  • sending / receiving messages from the server
  • save/change settings on the device
  • Remote device management

Code structure

The following image shows the typical code structure when creating a program with the ITTIoT framework. The program is structured as following:

  • Includes and global variables - here you include any libraries you need as well as create global variables.
  • iot_received() - this callback function is called when the module receives a message from a subscribed topic. Messages from all topics call the same function, so switching based on the topic is required.
  • iot_connected() - this callback function is called when the module first connects to the broker. Here you should subscribe to topics.
  • Setup - regular Arduino setup. But be sure to include a call to iot.setup() method.
  • Main loop - regular Arduino main loop. Be sure to include iot.handle() to each iteration.

List of ITTIoT framework methods

Method Description
iot.setup() Sets up the ITTIoT framework and connects to the broker.
iot.setConfig(String parameter, String value) Sets the selected configuration parameter.
iot.setBootPin(uint8_t pin) Sets the pin to restart ESP8266.
iot.printConfig() Prints the configuration of the module to the serial.
iot.restart(uint8_t bootMode = normalMode) Allows you to restart the device from a user program. iot.restart () starts the device in normal mode, iot.restart (ITT :: configMode) starts the device in configuration mode.
iot.handle() Does the necessary background work for the operation of the framework. For example it checks if any new messages have been received and if necessary, calls the callback methods. This method has to be called periodically in the main loop.
iot_connected() Callback function that is defined by the user. This method gets called when the module manages to connect to the broker. Mainly used to subscribe to topics.
iot.subscribe(String topic) Subscribes to the topic inserted as the operand. For example iot.subscribe(“livingroom/temp”) subscribes to the “livingroom/temp” topic.
iot_received(String topic, String msg) User defined callback method that gets called if any messages are received from subscribed topics. The user can then use the topic and message in his/her code.
iot.publishMsg(String topic, String msg) The module will publish a message to topic “controllername/topic”. Note that the method will automatically add the modules name behind the topic inserted. For example, publishing to topic “temp” will actually publish to topic “controllername/topic”. If this is undesirable then use the iot.publishMsgTo() method instead.
iot.publishMsgTo(String topic, String msg, bool retain) This method works similarly to the previous but does not add the module name to the topic. That means that messages published to “topic” will indeed be published to “topic”. With this method you can also choose if you want the broker to retain the last message received. If you are not interested in this, then leave it false)

List of ITTIoT framework configuration parameters

Conficuration parameter Explanation
dname Device name
mpass Broker password
mport Broker port
msrv Broker address
mssl Enable SSL/TLS
muser Broker user name
wname Wifi name
wpass Wifi password

MQTT default topics

IoT Framework defines some default themes used for device monitoring and remote management. If necessary, topics can be created for the user as needed. The device name is used to create the topic name. The device name is a unique name specified by the user that is a prefix to device themes. For example, if the device name is “ESP30”, then the device themes would be “ESP30/log”, “ESP30/cfg” and so on.

Topic Direction Description
/log outgoing General messages from the IoT framework, messages from the user via the iot.log () function
/link outgoing Device status: „Online”/”Offline”
/stat outgoing Automatically sent statistics 1x per minute
/cfg incoming Topic for device setup / firmware update via the MQTT server.

Statistics on the device and connection are sent periodically (by default once a minute) to the topic /stat. The last sent message is stored on the server (retained message) Saving the last status message allows you to evaluate the status of the device (amount of free memory, signal strength). The status message contains the following data, in the form of a string and separated by tabs:

  • uptime in seconds
  • WiFi signal strength (dBm)
  • a number of messages desired to send
  • a number of messages successfully sent
  • free RAM in the device (in bytes)

Example: „2237734 -62 1409765 1409431 19272”

en/iot/examples/setup/ittiot.txt · Last modified: 2021/03/04 17:48 by heiko.pikner
CC Attribution-Share Alike 4.0 International Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0