Star

ThingsBoard Documentation

Documentation for using ThingsBoard IoT Platform.

ThingsBoard IoT Gateway Features

This guide explains how to use RPC API on ThingsBoard IoT Gateway.

For the purpose of this tutorial, you need:

  1. Locally installed instance of ThingsBoard platform (In case you are new with ThingsBoard use this ‘how to install’ documentation).
  2. Installed and configured ThingsBoard IoT Gateway.

Gateway RPC methods

To send RPC requests to the gateway the one should use RPC Debug Terminal from Control widgets bundle.
ThingsBoard IoT gateway has several RPC methods, which called from WEB UI, available by default.
The list of OOTB methods will be extended within upcoming releases.

gateway_ping RPC method

gateway_ping RPC method is used to check connection to the gateway and RPC processing status. Every command with prefix “gateway_” will be interpreted as a command to general gateway service and not as an RPC request to the connector or device. Command:

gateway_ping

The response is:

{
  "code": 200,
  "resp": "pong"
}

Gateway RPC ping method

gateway_devices RPC method

gateway_devices RPC method is used to list devices connected through the gateway with info about the type of connector used. This method returns object in “resp” with key-value parameters, where: key — is a device name value — identifies the connector

Command:

gateway_devices

Returns object like:

{
  "code": 200,
  "resp": {
    "Device Number One": "OPC-UA Connector"
  }
}

Gateway RPC devices method

gateway_restart RPC method

gateway_restart RPC method is used to schedule restart action, e.g. bash gateway_restart 60 set up the restart of the gateway service in 60 seconds. This method uses seconds as measuring unit.

Note: The response will be returned after adding the task to the gateway scheduler.

Command:

gateway_restart 60

The response is:

{"success": true}

Gateway RPC restart method

gateway_reboot RPC method

gateway_reboot RPC method is used to schedule rebooting of the gateway device (hardware?), e. g. bash gateway_reboot 60 set up the reboot of the gateway device in one minute. Take into account: this method available if you start the gateway service as a python module instead of daemon approach and the user that is running the gateway has reboot permissions. Command:

gateway_reboot 60

The response is:

{"success": true}

Notate: The response will be returned after adding the task to the gateway scheduler.

Gateway RPC reboot method