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

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

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.

Today I got same issues. Seems you cannot get data by subscribe with MQTT. You need to create a pub/sub topic in Goolge iot pub.sub

Related

How to send a message from a Microsoft Teams bot using Microsoft Graph?

I a building a bot that should engage a 1 on 1 conversation with every user in a company using teams.
I would like to use the post chat message method:
https://learn.microsoft.com/en-us/graph/api/chatmessage-post?view=graph-rest-1.0&tabs=http
However, it is written that it is "Not supported" for Applications.
I am missing something?
PS: I am trying to use Teams as directly as possible without middle stuff like Bot Service.
You'll definitely need a bot for this, and to use something called "Proactive Messaging". Please see some similar questions from earlier just this week that will give you some good reading and background, especially:
Proactive Messaging in MS Teams
Sending proactive messages from an outside process to organizational users via Teams chat bot
In the 2nd question especially I give links to further reading, samples, and a video with some more background.

how i can subscribe to topics in azure iot hub device to device communication

I set up an architect for my solution think that iot hub does the work of an mqtt broker, but when I started the implementation , I found that you cannot subscribe to a specific subject to retrieve messages published by another mqtt client, the notion of topic does not exist on iot hub.
I have read several articles about this subject but I have not found an appropriate alternative.
Iot hub has only two topics, and event hub endpoints are limited to 10 endpoints
Can you guide me or suggest a solution with a broker?
How can I subscribe to a specific topic?
I want a device to device communication with pub / sub
Example: a device publishes on a topic / home / room
another device subscribes to / home / room
using iot hub
I am open to all proposals
Thank you
Cloud development
IoT Hub has a limited MQTT broker implementation, because of that, you can't subscribe to device topics from other devices. You could use an Azure Function to catch all your messages and decide if it needs to send a Cloud to Device message. You could also leverage Stream Analytics to decide if a message needs to be sent before talking to that Function. This is probably your best bet if you want to play by Azure IoT Stack's rules.
No cloud development
If you really want your devices to listen to each other, there is an old blog post that describes a scenario where a device uses the service SDK to listen to messages sent to IoT Hub by a different device. It lists the pros and cons in the post.
Custom edge module
If your devices are on the same network, you could build an Edge Module that implements an MQTT broker. The devices would then connect to the edge device as they would in a normal gateway scenario, but also to your custom broker. In your routing, you would then send all the messages to your custom broker to be transmitted to any devices listening to that topic, while still sending the data to the cloud. I imagine their are a few security risks you want to look into if you go in this direction.
So in short: it's possible, probably in many other ways, but in the end you are leveraging a cloud platform that doesn't support this natively.

Would solace topic be created only if it has an active subscriber?

I am not an expert on Solace, so apologies if my question is a primitive.
I have inherited a code base that I am looking to get to know more. It uses solace for messaging purposes. I see that the application publishes messages to a topic.
When I look up for this topic in solace UI I dont see the topic under the VPN.
Would topics in solace be created only if there are active subscribers?
I checked the logs of my application and they don't error out for the absence of the topic? What happens in case point 1 is true, and my application tries to send a message to solace when the topic hasnt been created.
I am using SolAdmin 7.1.1.158, is there way I can see my topic even if it does not have an active subscriber? Should that matter?
Thanks
I believe that you are confused about what is a topic.
Think of a topic as a concept of the publish-subscribe (pub/sub)
architectural pattern. They are used to route data or events (in the
form of messages) between distributed applications, often using a
message broker or an event broker.
Solace has a very detailed description of how topics work at https://solace.com/blog/solace-topics-vs-kafka-topics/.
Do note that topics are not the same as topic-endpoints.
Would topics in solace be created only if there are active subscribers?
Topics are only concepts and can't really be "created".
It is part of a message and used for routing messages. A application can also subscribe to a topic to receive messages that are published on a matching topic.
I checked the logs of my application and they don't error out for the absence of the topic? What happens in case point 1 is true, and my application tries to send a message to solace when the topic hasnt been created.
Publishers and consumers are decoupled when using the message broker.
When there are no subscribers to a topic, messages will be discarded and the "no subscription match" statistics and logs will increment.
If the publisher is sending guaranteed messages, you can enable the "Reject Msg To Sender On No Subscription Match" flag on it's client-profile to receive an negative acknowledgement when this occurs.
I am using SolAdmin 7.1.1.158, is there way I can see my topic even if it does not have an active subscriber? Should that matter?
Go to "Logging & Diagnostics" tab and select the "No Subscription Match Logs" view to take a look at the most recent messages that were dropped because there are no subscribers.

Google IOT device on webhooks & post

Is there any way to create your own google IOT device based on webhooks and POST-request? Without using firebase, IFTT, node.js
Samples that Google are very poor, they don`t show all steps of creating your own app, they just showing how to deploy "their sample"
I tried to make action with dialogflow & webhook, it was pretty simple. Just processed JSON in POST request to Azure function.
But when I try to create IOT device, its ask me for fulfilment url and it does not even tries to reach that address. I read about action.device.sync, action.device.execute, it just does not communicate with the specified address, giving simulator some voice command doesn`t affect at all. Are there any ways to create IOT device to work with POST-requests & web-hooks?
The answer is it depends.
There are many different ways to do server-device communication: web sockets, local servers, hub/local control, polling, MQTT, and likely many others. All of these solutions have trade-offs, and work in particular circumstances. Depending on exactly what IoT device you want to build, its requirements and technical specs, and what cloud providers you are using, you may identify what works best.
If you run the sample, you'll see it is sending JSON requests to a server and expect JSON responses back. This is must like Dialogflow & a webhook. In this case, the smart home platform communicates solely with the server.
Your server can then communicate with the device in any way that you want. I'm not too familiar with Azure offerings. It might have an MQTT service as well, or some other sort of push notification service you might be able to use.
If you're seeing simulator issues, you may need to make sure your authentication is set up correctly, and you'll need to first complete account linking on your phone before you can use the simulator.

Alexa sending SMS text Messages

I am looking for any sort of iPhone function for sending messages that can be accessed by an Alexa skill that is able to send SMS text messages, as well as read SMS text messages of a user. I know that these skills are already present, however, I am looking to do this in combination with numerous other features which I have already finished.
Any help would be much appreciated. Thanks!
Alex Skills normally run as Amazon Lambda functions. Lambda functions can call other AWS services (from the cloud, not from the phone).
Amazon SNS can send an SMS message. Here is an example using the AWS Command-Line Interface (CLI):
aws sns publish --phone-number +XXXX --message "Hello!"
However, if you are looking to send messages from the phone itself, or read messages that are already on the phone, then you will need to write an iPhone app than can use the iOS APIs to send/receive messages. This would not, however, be an 'Alex Skill' since it is running on the phone.

Resources