Copyright © https://mongoose-os.com

Mongoose OS Forum

frame

Google IoT MQTT topics

edited September 2017 in Mongoose OS

I'm little confused about MQTT topics in Google IoT.
When im creating topic in console its look like 'my-project/us-central1/my-registry/my-es256-device'. Then when my device is subscribing i see:
mgos_mqtt_ev Subscribing to 'my-es256-device/rpc'
mgos_mqtt_ev Subscribing to 'my-es256-device/rpc/#'

And when I push button it sends message to
Published: yes topic: /devices/my-es256-device/events message: {"free_ram":30080,"total_ram":51912}

So when i want to subscribe for this topic should it be
'my-project/us-central1/my-registry/my-es256-device/devices/my-es256-device/events'
or 'my-project/us-central1/my-registry/my-es256-device/events' ? or other?
and what for is 'my-es256-device/rpc' ? And how to subscribe to it? 'my-project/us-central1/my-registry/my-es256-device/rpc' ?

Comments

  • edited September 2017

    Ok its all here https://cloud.google.com/iot/docs/how-tos/mqtt-bridge#telemetry_events and here
    https://cloud.google.com/iot/docs/concepts/overview

    "A device can publish a telemetry event by issuing a PUBLISH message through the MQTT connection. Messages must be published to an MQTT topic in the following format:

    /devices/{device-id}/events
    You can also publish to a subfolder, for example, /devices/{device-id}/events/alerts. The{device-id} is case sensitive and must match the string ID of the device specified in the MQTT client ID.

    The messages published to this MQTT topic are forwarded to the Cloud Pub/Sub topic specified in the event_notification_config.pubsub_topic_name field in the device registry resource. The forwarded message data field contains a copy of the message published by the device, and the following message attributes are added to each message in the Cloud Pub/Sub topic:"

    Thanks anyway! :)

  • SergeySergey Dublin, Ireland

    Yes, correct.

    Also, you cannot subscribe to arbitrary MQTT topics with Google IoT (with one exception of a special config topic).
    I think this severe limitation will soon be removed by the Google team.

  • KhoaTranKhoaTran Sydney

    Also, it seems we cannot trigger an rpc call to the device but can only subscribe to /devices/{device-id}/config topic only. Is that true?

Sign In or Register to comment.