mqtt-bridge | Simple bridge to stream MQTT Broker data
kandi X-RAY | mqtt-bridge Summary
kandi X-RAY | mqtt-bridge Summary
Simple bridge to stream MQTT Broker data to dynamically defined back-ends
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of mqtt-bridge
mqtt-bridge Key Features
mqtt-bridge Examples and Code Snippets
Community Discussions
Trending Discussions on mqtt-bridge
QUESTION
I am trying to connect my ESP32 device to Google Cloud Platform (GCP) with Mongoose OS. I am new to Mongoose OS, but have got as far as to build and flash code as well as connection to wifi. But I get problems when I add info to the mos.yml file to connect to GCP. This is the error:
mgos.gcp.c:361 Invalid gcp.key (0xffffc200)
I have created my key pair with the following commands:
...ANSWER
Answered 2020-Mar-26 at 10:39So, it turned out I didn't need to set all that GCP info info in "mos.yml", but it was set for me when running
QUESTION
I'm writing a script to get some sensor-data using MQTT, transform the incoming value is a specific way and forward it to a cloud which uses an encrypted communication. The script runs on RaspberryPi 3 (Raspbian) where Mosquitto runs as MQTT-broker ( The sensors send the data to this broker)
So far I get the information from the the sensors and I can transform the content like desired.
The problem is when I try to connect to the remote broker, I got following error-message
...ANSWER
Answered 2019-Feb-20 at 15:06The entry for the cert
should not be the path to the certificate file, but the actual cert it's self. You need to read the file in and pass that.
Somethings like this:
QUESTION
I am following this tutorial and I already have my code publishing messages to /devices/sm1/events
topic, in which sm1
is my device id.
I would like to know how to subscribe to this topic since the tutorial says to use /devices/sm1/config
but I am getting empty messages. I already tried use the same "path" used in publishing (/devices/sm1/events
), but it also did not work.
It is strange that the name I gave to the topic was sm1
and the topic associated to my device is on GoogleIoT console is exhibited as projects/myprojectname/topics/sm1
. So, besides to discover how to subscribe to mentioned topic, I appreciate also any explanation related to the correct way of using pub/sub topics in GoogleIoT (the documentation is not so clear).
This is my subscribe.py
:
ANSWER
Answered 2018-Apr-04 at 18:23Edit: Clarifying based on comment below...
There's two GCP components in play here. There's the MQTT topic (which is the /events topic), which is used by the device to talk to IoT Core. Then there's the projects/myprojectname/topics/sm1
which isn't in IoT Core, it's in Pub/Sub. When you send messages to the /events MQTT topic, IoT Core brokers the payloads from your device that was sent to the /events MQTT topic through to the Pub/Sub topic that was created and attached to the IoT Core registry where your device was registered.
To see those messages, you have to create a subscription in Pub/Sub on the topic projects/myprojectname/topics/sm1
. If you go to the console, and Pub/Sub->topics. Click the three dots next to the topic and select "New subscription". Once you have the subscription, you can send some data from your device, then on commandline you can run (assuming you have the gcloud tools installed):
gcloud beta pubsub subscriptions pull --max-messages=3
To do anything with the messages, you can script subscribing to the Pub/Sub topic (check out the Pub/Sub APIs) to trigger on messages being added to the topic.
Original message:
Are you sending a config message to the device? The confusion might be that the MQTT topics are one-directional.
So: 1) the /events topic is for device->IoT Core. 2) the /config topic is for IoT Core Admin SDK->device
In another script somewhere, or from the IoT Core UI interface you need to send a configuration message to see the on_message fire properly.
In the IoT Core UI (on console.cloud.google.com) you can drill down to an individual device you have registered, and at the top of the screen, click on "Update Config". A popup window will come up that lets you send a text or a base64 encoded message to that device and it will come in on the /config topic.
QUESTION
I am using a Python client with paho-mqtt to publish in this specific topic of Google Cloud IoT: projects/my_project/topics/sm1
. My code is below, based on examples of the Google IoT documentation:
ANSWER
Answered 2018-Jun-05 at 04:55You have the incorrect topic name.
It's confusing (I just hit this too).
The client ID (as you have) must be:
QUESTION
I've been trying to use the javacscript version of the Eclipse Paho MQTT client to access the Google IOTCore MQTT Bridge, as suggested here:
https://cloud.google.com/iot/docs/how-tos/mqtt-bridge
However, whatever I do, any attempt to connect with known good credentials (working with other clients) results in this connection error:
...ANSWER
Answered 2018-Apr-20 at 21:03I'm a Googler (but I don't work in Cloud IoT).
Your code looks good to me and it should work. I will try it for myself this evening or tomorrow and report back to you.
I've spent the past day working on a Golang version of the samples published on Google's documentation. Like you, I was disappointed to not see all Google's regular languages covered by samples.
Are you running the code from a browser or is it running on Node.JS?
Do you have a package.json (if Node) that you would share too please?
Update
Here's a Node.JS (JavaScript but non-browser) that connects to Cloud IoT, subscribes to /devices/${DEVICE}/config
and publishes to /devices/${DEVICE}/events
.
https://gist.github.com/DazWilkin/65ad8890d5f58eae9612632d594af2de
- Place all the files in the same directory
- Replace values in
index.js
of the location of Google's CA and your key - Replaces [[YOUR-X]] values in
config.json
- Use "npm install" to pull the packages
- Use
node index.js
You should be able to pull messages from the Pub/Sub subscription and you should be able to send config messages to the device.
QUESTION
I am trying to connect to Google's MQTT server but I am getting errors I created all the certificates and registered my device (Adafruit huzzah32)
and the documentation says you connect to mqtt.googleapis.com:8883
So I do
...ANSWER
Answered 2018-Mar-05 at 20:00here the IAM roles are being explained ...the paragraph here sounds alike what you describe:
On the IAM page in Google Cloud Platform Console, verify that the role Cloud IoT Core Service Agent appears in the Members list for the relevant project service account. (Look for the project service account that ends in @gcp-sa-cloudiot.iam.gserviceaccount.com.)
If the Cloud IoT Core Service Agent role does not appear in the Members list, use gcloud to add the cloudiot.serviceAgent role to the relevant project service account. This role includes permission to publish to Pub/Sub topics.
if not yet having installed it, the Cloud SDK is required for all those gcloud
CLI commands, which can be used to list & edit the configurations (of which all can be done through the console, as well)... it's maybe easier, because all of the examples there use it, too.
update ...
concerning JWT refresh tokens, see this article or have some Q & A or the specification: JSON Web Token (JWT), JSON Web Token (JWT) Profile for OAuth 2.0 Client Authentication and Authorization Grants. here's another relevant article: https://medium.com/google-cloud/refreshing-json-web-tokens-jwts-for-google-cloud-iot-core-897318df3836
QUESTION
I currently have two MQTT brokers both working perfectly fine. One of them is a Raspberry Pi on my local network. The other one is a remote broker hosted on CloudMQTT.
The goal is to sync both brokers with each other. The easy solution for this, of course, is a bridge, but I'm having some trouble getting a proper bridge setup.
As you can see in the image below, when I try to setup a bridge on CloudMQTT, it asks for a 'Connection uri'. For a remote broker, this would be mqtt://username:password@m20.cloudmqtt.com:1883
, but I can't seem to figure out how to do this for a local broker.
As far as I know, you can only connect to your local network when you have a static IP and the ports forwarded to the Raspberry Pi, so how would I be able to get around this? The two brokers need to keep a permanent TCP connection open, but the remote broker can't open it himself. Wouldn't it be possible for the local broker to open this connection? If so, how would I get the two brokers to sync?
Any help is appreciated, thanks a lot for your help in advance!
Edit:
This is my full /etc/mosquitto/mosquitto.conf file:
...ANSWER
Answered 2017-Feb-06 at 20:31You can create bridges with mosquitto, the "Configuring Bridges" section of the man page covers all the options, but the basics you will need are:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install mqtt-bridge
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page