thingsboard / thingsboard-gateway

Open-source IoT Gateway - integrates devices connected to legacy and third-party systems with ThingsBoard IoT Platform using Modbus, CAN bus, BACnet, BLE, OPC-UA, MQTT, ODBC and REST protocols
https://thingsboard.io/docs/iot-gateway/what-is-iot-gateway/
Apache License 2.0
1.75k stars 844 forks source link

[HELP] Request Connector RPC Error #469

Closed yeduy closed 3 years ago

yeduy commented 3 years ago

Hello,

When we try to execute RPC with the Request Connector, we encounter the following errors.

We want to send a GET query to a specific URL, we don't need to send any values. But it says there is a field that should be string. We didn't understand where it should be a string. We would appreciate it if someone who encountered a similar error before could assist us.

Thank you.

config:

"serverSideRpc": [
        {
      "deviceNameFilter": ".*",
      "methodFilter": "no-reply",
      "requestUrlExpression": "SetDyNet.cgi?a=2&p=${params}",
      "httpMethod": "GET",
      "valueExpression": "",
      "httpHeaders": {
        "Content-Type": "application/json"
                }
        }
  ]

Request Connector

service.log:

""2021-01-25 20:36:42" - ERROR - [tb_gateway_service.py] - tb_gateway_service - 585 - must be str, not NoneType"
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/thingsboard_gateway/gateway/tb_gateway_service.py", line 580, in send_rpc_reply
    self.tb_client.client.send_rpc_reply(req_id, dumps(rpc_response), quality_of_service=quality_of_service, wait_for_publish=wait_for_publish)
  File "/usr/lib/python3/dist-packages/thingsboard_gateway/tb_client/tb_device_mqtt.py", line 245, in send_rpc_reply
    info = self._client.publish(RPC_RESPONSE_TOPIC + req_id, resp, qos=quality_of_service)
TypeError: must be str, not NoneType

connector.log:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/thingsboard_gateway/connectors/request/request_connector.py", line 203, in __send_request
    data_to_storage = [url, request["converter"]]
KeyError: 'converter'
""2021-01-25 20:36:42" - DEBUG - [request_connector.py] - request_connector - 183 - /SetDyNet.cgi?a=2&p=3"
""2021-01-25 20:36:42" - DEBUG - [request_connector.py] - request_connector - 185 - http://192.168.70.116/SetDyNet.cgi?a=2&p=3"
""2021-01-25 20:36:42" - DEBUG - [request_connector.py] - request_connector - 196 - http://192.168.70.116/SetDyNet.cgi?a=2&p=3"
""2021-01-25 20:36:42" - DEBUG - [request_connector.py] - request_connector - 199 - Request to http://192.168.70.116/SetDyNet.cgi?a=2&p=3 will be sent"
""2021-01-25 20:36:42" - ERROR - [request_connector.py] - request_connector - 229 - 'converter'"

Versions (please complete the following information):

peterandthejetsons commented 1 year ago

Hello!

Did you solved the problem above?

Thanks in advance.

Regards, Peter