chirpstack / chirpstack-gateway-bridge

ChirpStack Gateway Bridge abstracts Packet Forwarder protocols into Protobuf or JSON over MQTT.
https://www.chirpstack.io
MIT License
422 stars 270 forks source link

lora-gateway-bridge disconnects right after publishing #116

Closed tankienleong closed 5 years ago

tankienleong commented 5 years ago

Is this a bug or a feature request?

a bug

What did you expect?

lora gateway bridge send mqtt data to Google Cloud IoT Core

What happened?

What version are your using?

lora gateway bridge v2.7.1

How can your issue be reproduced?

Could you share your log output?

59371043_417782939052257_6224495123393150976_n

brocaar commented 5 years ago

Without any details on how to re-produce this (like your LoRa Gateway Bridge configuration, how you have setup your device in the GCP IoT Core, ...) there is not much I can help you with.

tankienleong commented 5 years ago

Hi @brocaar , I follow the tutorial on https://www.loraserver.io/guides/google-cloud-platform/ The lora-gateway-bridge is running on a raspberry pi. Below is the configuration of lora-gateway-bridge.toml [general] log_level = 4

[packet_forwarder] udp_bind = "0.0.0.0:1700" skip_crc_check = false

[backend.mqtt] uplink_topic_template="gateway/{{ .MAC }}/rx" downlink_topic_template="gateway/{{ .MAC }}/tx" stats_topic_template="gateway/{{ .MAC }}/stats" ack_topic_template="gateway/{{ .MAC }}/ack" config_topic_template="gateway/{{ .MAC }}/config"

marshaler="protobuf"

[backend.mqtt.auth]
type="gcp_cloud_iot_core"

[backend.mqtt.auth.generic] server="" username="" password="" qos=0 clean_session=true client_id="" ca_cert="" tls_cert="" tls_key="" max_reconnect_interval="10m0s"

[backend.mqtt.auth.gcp_cloud_iot_core] server="ssl://mqtt.googleapis.com:8883" device_id="gw-utem-000001" project_id="utemloraserver" cloud_region="asia-east1" registry_id="utem-gateways" jwt_key_file="/home/risinghf/private-key.pem"

Below are the screenshots of configuration of Google Cloud IoT core: Capture Capture1 Capture2

Please let me know if you required more information. Thank you very much.

brocaar commented 5 years ago

It disconnects since the Device ID and gateway ID (with gw- prefix) don't match. The device ID in GCP Cloud IoT Core must be gw-GATEWAYID where GATEWAYID is the 64bit gateway ID (gw-b8......73).