This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| en:iot:examples:setup:ittiot [2021/03/04 17:08] – [MQTT default topics] heiko.pikner | en:iot:examples:setup:ittiot [Unknown date] (current) – external edit (Unknown date) 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | =====ITTIoT framework===== | ||
| + | * Source code: [[http:// | ||
| + | * PlatformIO web page: [[https:// | ||
| + | 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 ([[https:// | ||
| + | * 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 | ||
| + | | iot.setup() | ||
| + | | iot.setConfig(String parameter, String value) | ||
| + | | iot.setBootPin(uint8_t pin) | Sets the pin to restart ESP8266. | ||
| + | | iot.printConfig() | ||
| + | | iot.restart(uint8_t bootMode = normalMode) | ||
| + | | iot.handle() | ||
| + | | iot_connected() | ||
| + | | iot.subscribe(String 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 " | ||
| + | | iot.publishMsgTo(String topic, String msg, bool retain) | ||
| + | |||
| + | ====List of ITTIoT framework configuration parameters==== | ||
| + | |||
| + | ^ Conficuration parameter | ||
| + | | dname | Device name | | ||
| + | | mpass | Broker password | ||
| + | | mport | Broker port | | ||
| + | | msrv | Broker address | ||
| + | | mssl | Enable SSL/ | ||
| + | | 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 " | ||
| + | |||
| + | ^ Topic ^ Direction | ||
| + | | /log | outgoing | ||
| + | | /link | outgoing | ||
| + | | /stat | outgoing | ||
| + | | /cfg | incoming | ||
| + | |||
| + | 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” | ||