Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
en:iot:examples:setup:ittiot [2020/07/20 11:26] – external edit 127.0.0.1en: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://gitlab.robolabor.ee/heikopikner/ittiot|Git]]
 +  * PlatformIO web page: [[https://platformio.org/lib/show/1681/ITTIoT|PlatformIO]]
  
 +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://en.wikipedia.org/wiki/MQTT|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==== ====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.
  
-{{:en:iot:examples:setup:ittiotframework.png|}} +{{:en:iot:examples:setup:ittiot_framework.png|}}
 ====List of ITTIoT framework methods==== ====List of ITTIoT framework methods====
  
-^Method^Description^ +^ Method                                                   ^ Description                                                                                                                                                                                                                                                                                                                             
-|iot.setup()|Sets up the ITTIoT framework and connects to the broker.| +| iot.setup()                                              | Sets up the ITTIoT framework and connects to the broker.                                                                                                                                                                                                                                                                                | 
-|iot.printConfig()|Prints the configuration of the module to the serial.| +| iot.setConfig(String parameter, String value)            | Sets the selected configuration parameter.                                                                                                                                                                                                                                                                                              | 
-|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()                                        | Prints the configuration of the module to the serial.                                                                                                                                                                                                                                                                                   | 
-|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.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_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()                                             | 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.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_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.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)|+| 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.1595244384.txt.gz · Last modified: 2020/07/20 09:00 (external edit)
CC Attribution-Share Alike 4.0 International
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0