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.74k stars 844 forks source link

[HELP] Connectors Message Formats #679

Closed l33tkrew closed 2 years ago

l33tkrew commented 2 years ago

Describe the issue I want to test MODBUS, BLE, CAN Connectors. However, I do not know how to send messages? I read all documentation about tb-gateway. I think testing the connectors is missing in the documentation.

For example, I use the following format to text MQTT and REST(POST) to test. As you can see the message formats are different. For example, I could not a way to test MODBUS connector because I do not know the command/message format.

mosquitto_pub -h "192.168.1.X" -p "1883" -t "/sensor/data" -m '{"serialNumber": "SN-001", "sensorType": "Thermometer", "sensorModel": "T1000", "temp": 42, "hum": 58}'
curl -v -X POST -d "{\"name\":\"DEV-01\",\"sensorModel\":\"snn-01\",\"temp\":33,\"hum\":23}" http://192.168.1.X:5000/device1 -H "Content-Type:application/json"

Configuration (Attach your configuration file) I use the config files; https://github.com/thingsboard/thingsboard-gateway/tree/master/thingsboard_gateway/config

Connector name (If you need help with some connector/converter): [e.g. MODBUS, BLE, CAN Connectors]

Versions (please complete the following information):

samson0v commented 2 years ago

Hi @l33tkrew, mosquitto_pub is used only if you are using an MQTT connector. If you want to use Modbus Connector, you have to use a compatible Modbus device or create a slave using, for example, pymodbus.

So, for example, if you want to use BLE Connector, there are two options:

  1. Use real BLE Device
  2. Use a simulator on a smartphone (BLE Peripheral Simulator), so you can use the MAC address of your smartphone and GATT objects of your simulator and voila, Gateway will read your configured data options.