Google IOT - device subscribe to something else than /devices/XXXX/config

Internet of Things IoT Frameworks 2 years ago

0 1 0 0 0 tuteeHUB earn credit +10 pts

5 Star Rating 1 Rating
_x000D_ _x000D_ I am trying Google IOT and Google PubSub. I am sending MQTT messages from device to a pubsub queue on which I have subribed (with something I will call "the server"). From the google cloud console, I update device setting and I get the setting message in device. Everything in google tutorial work fine but I wonder if it is possible to set up a messaging it the other way : i.e. "the server" sending message to a pubsub queue subscribed by the device using MQTT. The schema at the end of this page make me think that only the "config" mqtt queue (/devices/XXXX/config) can be used that way. What I need is a 1to1 communication from "the server" to "the device" and I'm afraid that the only way is using the config

Posted on 16 Aug 2022, this text provides information on IoT Frameworks related to Internet of Things. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.

Take Quiz To Earn Credits!

Turn Your Knowledge into Earnings.

tuteehub_quiz

Answers (1)

Post Answer
profilepic.png
manpreet Tuteehub forum best answer Best Answer 2 years ago
_x000D_ I am not an expert on Google IoT, but few days ago I got the same doubts about it. Apparently, although we can publish to /events, /config and /state topics, using MQTT protocol, only topic /config and, maybe, /state can work through subscriptions with the same protocol. The conclusion I got, after reading many times the documentation, that is not so clear, and asking some questions here at stackoverflow is: you can not use MQTT to subscribe to any topic in order to receive those data sent to /events topic. To accomplish this, you have to create a Pub/Sub topic associating it to your device: On Google Cloud IoT Core Console, click on your registry ID; Create a standard telemetry topic; After topic created, click on the topic to see its details; Its details will open on Google Cloud Pub/Sub panel; In this panel, you can create a subscription to the created topic, by clicking on the "create subscription button". Now that you have a "google cloud pub/sub topic" linked to "google cloud iot core /events telemetry MQTT topic" and a respective subscription, you can use the google pub/sub library to receive notifications through created subscription when data are sent to /events topic. Maybe the following link can also help: https://cloud.google.com/iot/docs/how-tos/devices#creating_a_device_registry_with_multiple_pubsub_topics I hope this can help you. If I made any mistake in my answer, may someone edit it with some improvement or correction.

No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.

Important Internet of Things Links