This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
en:iot:examples:setup:ittiot [2020/07/20 11:26] – external edit 127.0.0.1 | en:iot:examples:setup:ittiot [Unknown date] (current) – external edit (Unknown date) 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
=====ITTIoT framework===== | =====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==== | ====Code structure==== | ||
Line 11: | Line 18: | ||
* Main loop - regular Arduino main loop. Be sure to include iot.handle() to each iteration. | * Main loop - regular Arduino main loop. Be sure to include iot.handle() to each iteration. | ||
- | {{: | + | {{: |
====List of ITTIoT framework methods==== | ====List of ITTIoT framework methods==== | ||
- | ^Method^Description^ | + | ^ Method |
- | |iot.setup()|Sets up the ITTIoT framework and connects to the broker.| | + | | iot.setup() |
- | |iot.printConfig()|Prints the configuration of the module to the serial.| | + | | iot.setConfig(String parameter, String value) |
- | |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.setBootPin(uint8_t pin) | Sets the pin to restart ESP8266. |
- | |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.printConfig() |
- | |iot.subscribe(String topic)|Subscribes to the topic inserted as the operand. For example iot.subscribe(" | + | | iot.restart(uint8_t bootMode = normalMode) |
- | |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.handle() |
- | |iot.publishMsg(String topic, String msg)|The module will publish a message to topic " | + | | iot_connected() |
- | |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 " | + | | iot.subscribe(String topic) |
+ | | iot_received(String topic, String msg) | ||
+ | | iot.publishMsg(String topic, String msg) | ||
+ | | 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” |