Service RPC
Allow users to send RPC requests to specific devices through the gateway.
Who it’s for
Engineers operating devices behind a ThingsBoard IoT Gateway who need to send a command through to the device itself — writing a Modbus register, calling an OPC-UA method, prompting a poll. The command has to reach a device the platform cannot address directly, and the gateway is the route.
What it does
The Service RPC widget sends RPC requests through the gateway to the devices connected behind it, or to the gateway’s own connectors. Pointed at a gateway, it lets a service-level command be composed and dispatched, with the gateway translating it into the connector’s own protocol.
- Commands reach devices the platform cannot address — the gateway performs the protocol translation.
- The widget can target either a connected device or a connector, which is the difference between commanding equipment and reconfiguring the route to it.
- The response comes back through the same path, so a two-way call’s result is visible.
- Access follows the dashboard, so the ability to command behind the gateway is granted by dashboard permissions.
- The Service RPC widget requires the gateway to support the command for the connector in question; an unsupported request fails at the gateway rather than at the device.
How to set up
Data keys
The Service RPC widget takes no data keys — the request is composed in the widget.
| Method | Direction | Parameters | Sent when |
|---|---|---|---|
| Gateway service method | Two-way (request-response) | The composed request, translated by the gateway’s connector | On each send |
Target
| Setting | Default | Effect |
|---|---|---|
| Connector mode | Off | Targets a connected device; turn on to address a gateway connector instead |
Point the datasource at the gateway device, not at the device behind it. The gateway is the entity the platform can reach, and it is the gateway that resolves which connected device the command is for.
How to customize
- To address a connector rather than a device — turn on connector mode, which changes what the request is aimed at.
Tips
- Check the connector’s documentation for which service commands it implements before building a dashboard around them. Support varies by protocol, and a request the gateway does not recognize fails in a way that looks like a device problem.
- Keep this widget on an engineering dashboard rather than an operational one. Commands sent through a gateway can reconfigure the route as well as the equipment, and that is not a distinction an operator should have to make under pressure.
Share Your Widget with the Community
Built a custom widget? Export it as a JSON from ThingsBoard and publish it to the IoT Hub through a simple 4-step wizard (Upload, Listing, Readme, Review & Submit). Share it with thousands of ThingsBoard developers worldwide and get featured in the catalog.