This API is intended to transmit load control commands from the project website (and applications using the REST API), as well as to remotely configure monitoring devices.
Commands are transmitted immediately after receiving the next packet of sensor readings from the monitoring device into an already open socket, which allows you to control devices with gray IP behind routers (i.e. NAT).
For TCP, GET, POST protocols instead of the typical "OK" and in the absence of errors, the project server transmits commands in response to the readings, starting with the "#" character and separating the commands with ";" without gaps in chronological order in order to avoid reception buffer overflow on weak devices up to 5 in 1 session.
Examples TCP, GET, POST: gpio12=0 or two commands: gpio12=0;gpio14=1
Example for JSON: {"devices":[{"mac":"DEVICE_MAC","commands":["gpio12=0","gpio14=1"]}]}
The ability to manage devices using the MQTT protocol is available only for Project partners and commercial customers!
For the MQTT protocol, sending a command occurs momentarily due to the fact that the device always maintains an active connection to the server (broker MQTT) using PUBLISH with QoS=1, i.e. waiting for confirmation of receipt of the command - PUBACK.
When sending commands, the prefix Username / Device / (owner's name and device name) is added.
Example for MQTT: output12=1 or system/restart=1 (for wifi-iot.com firmware)
Commands for execution can be queued by its owner in Sensors \ Sensor Setup \ send a command to the device or by clicking on the graphic switch for the on/off sensors and the active "Control Mode" device.
If the device has not communicated with the server within an hour after sending the command, this command is removed from the queue for execution.
At the time of publication of the article, the device management API is supported on the Project website and in mobile apps for Android 2019 and WinPhone/WinMobile.
A complete list of supported commands should be found in the instructions for the device or contact its developer.