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.71k stars 824 forks source link

[HELP] Unable to send telemetry and attributes to device #450

Closed deepthi30192 closed 3 years ago

deepthi30192 commented 3 years ago

I have created a Thingsboard Gateway and a device thru it. When I try to send telemetry and attributes, I get the following error:

ERROR - [tb_utility.py] - tb_utility - 63 - No telemetry and attributes in data: {"deviceName": "SN-001", "deviceType": "Thermometer", "attributes": [], "telemetry": []}" ERROR - [tb_gateway_service.py] - tb_gateway_service - 322 - Data from MQTT Broker Connector connector is invalid."

The command I am giving is :

mosquitto_pub -h localhost -p 1883 -t "/sensor/SN-001/data" -u "user" -P "password" -f "b.json"

The json is:

{ "deviceName": "SN-001", "deviceType" : "Thermometer",

"attributes": [ { "type": "string", "key": "model", "value": "T1000" } ], "telemetry": [ { "type": "double", "key": "temperature", "value": 42 } ] }

Where am I going wrong with the message format?

imbeacon commented 3 years ago

Hi @deepthi30192 ,

It looks like you tries to send configuration to the gateway and parse it. Unfortunately you didn't provide us with your configuration file, so we are unable to help you in this case. But if you read our official guide for MQTT connector (It is here), the gateway configuration will be more clear for you. Please read it, try to configure like it described there and if you have questions, you will be able to the issue.