Open mgruenberger21 opened 2 months ago
Hi @mgruenberger21, thanks for your interest in ThingsBoard IoT Gateway! Unfortunately, the gateway can only be used with ThingsBoard.
Hi, thank you for your message. As far as I understood, publishing IoT-gateway-messages is just possible to the thingsboard-ce aund pe? Not the thingsboard-mqtt-broker (tbmq)?
@mgruenberger21 yes
OK thank you. Do you see any other solution to send this data to another broker? Maybe installing thingsboard CE on the same machine, collecting the data there and publish them via mqtt to mosquitto or tbmq-broker? Or subscribing the data of thingsboard-ce on the broker?
@mgruenberger21
I had a similar problem in a project. I think the best solution is, like you said, installing Thingsboard CE alongside tb-iot gateway and then use MQTT API to publish collected messages.
You can check thingsboard's api here: swagger
here's the script we used at the time with some device id's changed.
#!/bin/bash
# MQTT Configuration
MQTT_HOST="127.0.0.1"
MQTT_PORT="1883"
# Define MQTT Topics
MQTT_TOPICS=(
"topic1/status"
"topic2/status"
"topic3/status"
"topic4/status"
"topic5/status"
)
# Define ThingsBoard URLs
THINGSBOARD_URLS=(
"http://192.168.1.44:8080/api/v1/1413414/telemetry"
"http://192.168.1.44:8080/api/v1/1234123412/telemetry"
"http://192.168.1.44:8080/api/v1/123412341234/telemetry"
"http://192.168.1.44:8080/api/v1/13412341234/telemetry"
"http://192.168.1.44:8080/api/v1/13412341234/telemetry"
)
# Subscribe to MQTT topics
for ((i=0; i<${#MQTT_TOPICS[@]}; i++)); do
mosquitto_sub -h $MQTT_HOST -p $MQTT_PORT -t ${MQTT_TOPICS[$i]} | while read -r message; do
# Execute curl command with the received message and corresponding ThingsBoard URL
curl -v -X POST ${THINGSBOARD_URLS[$i]} --header "Content-Type: application/json" --data "{\"message\": \"$message\"}"
done &
done
# Wait for all background processes to finish
wait
Similarly, you need to set up a script as a service for publishing readied telemetry from your devices. or make a rulechain that does that.
we were also in need of a dashboard for monitoring, and that's why we go with Thingsboard tho. if you are only going to use the communication console, i would recommend Node-Red instead.
你好@mgruenberger21,感谢您对 ThingsBoard IoT 网关的关注! 遗憾的是,该网关只能与 ThingsBoard 一起使用。
Can I get gateway data from Thingsboard through the API?
Hello,
is it possible to use thingsboard-gateway for publishing the collected data (modbus, bacnet, etc.) to an external mqtt-broker (e.g. mosquitto) without connecting it to a thingsboard server? In the tb_gateway.json I usually define a thingsboard-server for mqtt-pub. Something like:
{ "thingsboard": { "host": "X.X.X.X", "port": 1883, "remoteShell": false, "remoteConfiguration": true, "statistics": { "enable": true, "statsSendPeriodInSeconds": 60 }, "deviceFiltering": { "enable": false, "filterFile": "list.json" }, "maxPayloadSizeBytes": 1024, "minPackSendDelayMS": 60, "minPackSizeToSend": 500, "checkConnectorsConfigurationInSeconds": 10, "handleDeviceRenaming": true, "security": { "clientId": "", "username": "", "password": ""
Is it possible to publish this to another (non-thingsboard) broker using mqtt? And how can I configure this in tb_gateway.json file?
Versions