[HELP] how to send and test RPC Messages to a specific MODBUS device?
Describe the issue Thingsboard Server and IoT-Gatewayy runs on my local RPi5 device. I created a RPC request in the MODBUS Connector device to "Write Single Coil" with Type bits. How can I now test this RPC Call?
Configuration (Attach your configuration file)
Notate: Remove Access token from file if you want to attach a tb_gateway.yaml
Connector name (If you need help with some connector/converter): MODBUS Connector (TCP)
Versions (please complete the following information):
- OS: RaspiOS Bookworm Linux 6.6.62+rpt-rpi-2712
- Thingsboard IoT Gateway version [3.7.5] with Docker
Hi @jpiwek,
The simplest way to test RPC is to use Swimming pool SCADA system solution template with emulator, you can find it on thingsboard.cloud, it contains instructions on how to configure devices and some pre-configured RPC requests and shared attribute updates.
In general - to test RPC you need to create a dashboard with related control widget, for testing purposes we recommend to use RPC debug terminal, it provides more control over responses. How to create a dashboard and add a widget you can find information here - https://thingsboard.io/docs/iot-gateway/guides/how-to-use-gateway-rpc-methods/#step-1-create-a-dashboard-to-use-rpc-api-in-thingsboard-iot-gateway
You will need to set connected device through the gateway as a target for this widget.
@imbeacon: just tried the example you have shared. I create an example with a switch button which work + added a Modbus RPC Write Request to write to a coil.
Question: I created a RPC debug terminal for my TB IoT-Gateway (see picture below). Can I execute commands via the terminal on a Modbus devices which is connected to the Gateway? I see I can list devices with gateway_devices but I can't see any command to execute a prefined RPC request on the devices itself.
@jpiwek In the widget, you need to select the actual device. The RPC will be sent to the ThingsBoard Gateway, which includes the target device information, allowing the gateway to route it to the correct connector.
From the UI perspective, you should interact with the device created by the gateway just like any other regular device. ThingsBoard will automatically forward the requests to the gateway behind the scenes.
thanks @imbeacon. Where can I find the standard documentation about supported commands which can be executed in the RPC Debug Console? I found something here, is there a consolidated overview available: https://thingsboard.io/docs/iot-gateway/guides/how-to-use-gateway-rpc-methods/ https://thingsboard.io/docs/iot-gateway/guides/how-to-use-get-set-rpc-methods/?getSetConnectorRPC=modbus
Additionally I found this RPC option in the Modbus Connector. However I was not able to send any Modbus Command to my Modbus Server Device: I always get KeyError Message. How to use that
You can execute any RPC in RPC debug terminal, for example if you have configured RPC in connector configuration - you can choose related device as device for RPC debug terminal widget and send data to them.
You provided links to all service RPC methods that gateway has.
On provided screenshot - requests to connector, not to devices, to send GET/SET RPC to device - you need to create a new dashboard, with RPC debug terminal widget, set target device as entity for this widget and then you will be able to send RPC, like described in https://thingsboard.io/docs/iot-gateway/guides/how-to-use-get-set-rpc-methods/?getSetConnectorRPC=modbus
We will add more information to documentation, about dashboards creation, adding this widget in the future.
We will add more information to documentation, about dashboards creation, adding this widget in the future. that would be great!
but how to the "service RPC" form for Modbus Connector RPC parameters or what is it good for? As I always get an KeyError when I fill out and press "send"
We are working on this issue, it will be fixed in the nearest release.
We are working on this issue, it will be fixed in the nearest release.
good to know! I tought it was my mistake!