Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HELP] - RPC mqtt_connector - RPC not handled #1525

Open
rosiste opened this issue Sep 15, 2024 · 1 comment
Open

[HELP] - RPC mqtt_connector - RPC not handled #1525

rosiste opened this issue Sep 15, 2024 · 1 comment
Assignees

Comments

@rosiste
Copy link

rosiste commented Sep 15, 2024

Hello,
I have the Thingsboard Gateway v3.5.1 last snapshot build installed in a docker environment on a Ubuntu 24.04.1 LTS server. I have some devices connected to Thingsboard Gateway throught central MQTT broker. I'd like to control these devices throught MQTT with RPC requests, but I'm always get the following error message:

2024-09-15 23:09:29 - |INFO| - [mqtt_connector.py] - mqtt_connector - server_side_rpc_handler - 971 - Incoming server-side RPC: {'device': 'shelly-test-b1355c', 'data': {'id': 102, 'method': 'Switch.Set', 'params': 'true'}, 'id': <tb_gateway_mqtt.TBGatewayMqttClient object at 0x70bba8e46f60>}
2024-09-15 23:09:29 - |ERROR| - [mqtt_connector.py] - mqtt_connector - server_side_rpc_handler - 1008 - RPC not handled: {'device': 'shelly-test-b1355c', 'data': {'id': 102, 'method': 'Switch.Set', 'params': 'true'}, 'id': <tb_gateway_mqtt.TBGatewayMqttClient object at 0x70bba8e46f60>}

Configuration

{
  "broker": {
    "name": "Lokalni TBMQTT broker",
    "host": "10.66.50.20",
    "port": 1883,
    "clientId": "tb-gateway",
    "version": 5,
    "maxMessageNumberPerWorker": 10,
    "maxNumberOfWorkers": 100,
    "sendDataOnlyOnChange": false,
    "security": {
      "type": "basic",
      "username": "user",
      "password": "pwd"
    }
  },
  "mapping": [
    {
      "topicFilter": "shelly/+/status/switch:0",
      "converter": {
        "type": "json",
        "deviceNameTopicExpression": "(?<=shelly/)(.*?)(?=/status/switch:0)",
        "deviceTypeTopicExpression": "Shelly Plus1PM",
        "sendDataOnlyOnChange": false,
        "timeout": 60000,
        "timeseries": [
          {
            "type": "bool",
            "key": "Output",
            "value": "${output}"
          },
          {
            "type": "double",
            "key": "Current",
            "value": "${current}"
          },
          {
            "type": "double",
            "key": "Voltage",
            "value": "${voltage}"
          },
          {
            "type": "double",
            "key": "Apparent_Energy",
            "value": "${aenergy.total}"
          },
          {
            "type": "double",
            "key": "Apparent_Power",
            "value": "${apower}"
          }
        ],
        "attributes": [
          {
            "type": "bool",
            "key": "Output",
            "value": "${output}"
          }
        ]
      }
    }
  ],
  "serverSideRpc": [
    {
      "deviceNameFilter": ".*",
      "methodFilter": "Switch.Set",
      "requestTopicExpression": "shelly/${deviceName}/rpc",
      "valueExpression": "{'method':'Switch.Set',params:{'id':0,'on':${params}}"
    }
  ],
  "logLevel": "DEBUG",
  "name": "MQTT Broker - lokalni server",
  "enableRemoteLogging": false,
  "id": "0298387e-3703-4974-920a-1634cf24a6aa"
}

But I can control the device with simple mosquitto client with the following command:

mosquitto_pub -h 10.66.50.20 -p 1883 -t 'shelly/shelly-test-b1355c/rpc' -m '{"method":"Switch.Set","params":{"id":0,"on":false}}' -u 'user' -P 'pwd' -i 'tb-gateway'

Versions (please complete the following information):

  • OS: 24.04.1
  • Thingsboard IoT Gateway version 3.5.1 last snapshot (16/09/2024) docker image build master branch
@rosiste rosiste changed the title [HELP] [HELP] - RPC mqtt_connector - RPC not handled Sep 16, 2024
@rosiste
Copy link
Author

rosiste commented Sep 16, 2024

Found following line in debug log even if serveSideRpc section is present in config file. Config file checked with public online JSON validator without errors.

2024-09-16 20:08:52 - |DEBUG| - [mqtt_connector.py] - mqtt_connector - load_handlers - 323 - 'serverSideRpc' section missing from configuration

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants