ThingsBoard IoT Gateway Features
This guide explains how to use RPC API on ThingsBoard IoT Gateway.
For the purpose of this tutorial, you need:
- Locally installed instance of ThingsBoard platform (In case you are new with ThingsBoard use this ‘how to install’ documentation).
- 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:
The response is:gateway_ping
{
"code": 200,
"resp": "pong"
}
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:
Returns object like:gateway_devices
{
"code": 200,
"resp": {
"Device Number One": "OPC-UA Connector"
}
}
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:
The response is:gateway_restart 60
{"success": true}
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:
The response is:gateway_reboot 60
Notate: The response will be returned after adding the task to the gateway scheduler.{"success": true}