pvi
pvi

Reputation: 11

Why can't receive messages using gateway in MQTT Google IoT Core?

I am using the Cloud IoT Core module to send messages from a device to the cloud using MQTT. The device uses a gateway to send these messages and the gateway is configured with the Association only method. For this, the MQTT Client is configured with the gatewayID so the gateway is the only one authenticated.

The problem is that, if the gateway publishes telemetry data using the device's MQTT topic like this "/devices/{device-id}/events", the telemetry data is not received in the cloud (I have checked this with a Cloud pub/sub subscription). It doesn't show any error on the gateway, and even the Message Delivered callback is called.

However, if the gateway publishes data to its topic, which is "/devices/{gateway-id}/events", the telemetry data is received correctly in the cloud.

I have checked Google's GitHub documentation (I am using JAVA for this with mqtt paho) and the topic it uses to publish telemetry data on behalf the device (also with the association only method) is the "/devices/{device-id}/events".

Is this because the Authorization only method only allows publishing the telemetry data through the gateway's MQTT topic??

Upvotes: 1

Views: 446

Answers (1)

Gal Zahavi
Gal Zahavi

Reputation: 66

For gateways to work properly you need to have the devices set up correctly and that the gateway is binded to the device then you can attach the device topic,commands,and configuration.

Association only refers to when you're attaching the device to the gateway and you should be able to send telemetry data from the devices event topic.

I think that either your devices aren't setup properly or you didn't bind the devices to the gateway.

Upvotes: 1

Related Questions