ITT IoT framework

ITT IoT is an IoT framework for the ESP8266 platform. The purpose of the IoT Framework is to greatly simplify the creation of IoT applications for the ESP8266 platform. Data exchange with the server the widely used MQTT protocol (https://en.wikipedia.org/wiki/MQTT) is used in the IoT field. The IoT framework includes:

  • To initialize the mode (network / server parameter setting)
  • Managing a WiFi network / MQTT server connection
  • sending / receiving messages from the server
  • save / change settings on the device
  • remote management of the device
  • tracking the status
  • periodic statistics
  • change the settings
  • software update

To use ITT IoT framework, you need to include the source code of the framework

#include <ittiot.h>

Setup mode

This operating mode is required to initialize the device to allow the device to start in normal operation and create a community WiFi connection and a MQTT server. The easiest way to set up your device is to use the IoTConfigurator Android application. In set mode, the device will start the WiFi base station, the network name will be IoT- <ESP_ID>, where ESP_ID is device chip id. In addition, the web server will be launched to load the settings and ArduinoOTA a service that allows you to download new software in setup mode, if necessary. To download the settings and info, the device uses JSON format data structures and HTTP GET and POST to exchange data inquiries.

Setup mode HTTP interface

The information in this section is not relevant when used for configuring IoTConfigurator Android app. However, the following may be important if the device is desired configure via HTTP queries, automate reset or if you want to create a new one application for setting up the device.

Device visibility check (ping)

http: <ipaddr> / ping query allows you to check the device's visibility from the network. Every successful query extends the setting time by 1 minute. In case of a successful inquiry, returns: <code c>{“success”: “true”}<code> ==== Device Hardware Information Query ==== http: <ipaddr> / get / info query provides a quick overview of the device. Returns:

{
"cpu_freq": "80",
"f_free": "2797568",
f_size: 4194304,
f_speed: "40000000",
"fw_build": "May 27 2017 17:25:08", "
"fw_size": "344528",
"id": "1f0355",
mac: "5C: CF: 7F: 1F: 03: 55", "sdk_version": "1.5.3 (aec24ac9)"
}

Download the settings from your device

http: <ipaddr> / get / config query loads the device settings (if any). <code c> { “dname”: “itt / esp / dev1” mpass: passwd123 mport: 1883 msrv: domain.com mssl: false “muser”: user123 “wname”: MyNet wpass: mypass } </code> ==== Search for WiFi networks ==== The device searches for and returns for each network found a name, signal strength, security information (* means a password-protected network). http: <ipaddr> / get / networks Returns:

[
[
MyNet
"-89",
"*"
],
[
Home
"-66",
"*

Changing settings to the device

http: <ipaddr> / set / config POST request to the device in the JSON format setup. In the example The curl utility is used, the settings are located in the conifg.json file curl -H “Content-Type: application / json” -X POST -data @ config.json http: <ipaddr> / set / config Returns:

{
"success": "true"
}

if the JSON validated and the device had enough free space to store data.

Restart your device

restarts the device in normal mode. Rebooting is necessary for new ones to activate the settings. Returns before restarting:

{
"success": "true"
}

Normal mode

Normal mode is the mode in which a device executes a user program. A prerequisite for normal operation is the running of WiFi and MQTT server connection. If the connection can not be made, the device will be started in setup mode. In this case, you should check the device settings (usernames, passwords, …) and make sure that network connection and server are working.

Data exchange with the server

The data exchange with the server takes place through the MQTT protocol. The MQTT protocol uses publish- subscribe pattern (https://en.wikipedia.org/wiki/Publish-subscribe_pattern) where the messages to be transmitted (data) is organized by theme. The IoT framework has been tested on Mosquitto (http://mosquitto.org/) server, but you can use another server or service that follows the MQTT protocol (for example: Amazon AWS IoT, Azure IoT).

MQTT items

The IoT Framework defines some of the default themes used to track and track the device remote management. If necessary, the user can create a thread as needed. Subject name The name of the device is used for compilation. The device name is a unique name assigned by the user, which is prefix device themes. For example, if the device name is “dev1”, then the device's themes would be “Dev1 / log”, “dev1 / cfg”, … To achieve a better logical organization, devices should be distributed. sub themes, to add a device to a sub theme, the name of the device must be named as the device containing the name sub-topic For example, if you want to add “dev1” to the “itt / devices” subteme, the device should be to name it “itt / devices / dev1”

en/iot_homelab_kit/hardware/itt_iot.txt · Last modified: 2020/07/20 09:00 by 127.0.0.1
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