I'm trying to bridge local mosquitto (on raspberry pi) to some cloud broker so I can send data and control some devices using that data. I tried with Cloudmqtt and dioty, but with no success. In case of cloudmqtt I've been told that everything is ok with mosquitto.conf file and for dioty I've been told that it uses Mosca broker which doesn't support bridging (with I've been told I refer to cloudmqtt and dioty support service). Does anybody knows some remote broker that can be bridged to local mosquitto and did somebody already tried that?
I considered using some IOT platform to do this, but I have read that platform like that use pricing, I'm doing this for learning and hobbie purposes, so before I learn how to use it I would like to stay on free account.
EDITED: I'm using mosquitto 1.4.5, mosquitto.conf file like this:
#Place your local configuration in /etc/mosquitto/conf.d/
#
#A full description of the configuration file is at
#/usr/share/doc/mosquitto/examples/mosquitto.conf.example
connection cloudmqtt
address mnumber.cloudmqtt.com:port
topic zaESP8266 in 0
topic ESP8266 out 0
try_private true
notifications false
start_type automatic
remote_usename username_of_the_user_on_cloudmqtt
remote_password password_of the_user_on_cloudmqtt
pid_file /var/run/mosquitto.pid
persistance true
persistance_location /var/lib/mosquitto/
The reason I have choose Cloudmqtt for online mosquitto broker is because I tought that local mosquitto <--> remote mosquitto bridge should work. And that I could use clients like laptop or phone, and use them to publish and subsccribe messages with local broker. This way even when I lose internet access I can have local broker to interact with local clients.
EDITED: I configured mosquitto.conf file so I can bridge with test.mosquitto.org, I added these lines:
connection test
address test.mosquitto.org
topic in_topic in 0
topic out_topic out 0
try_private false
notifications false
bridge_attempt_unsubscribe true
Now, in one terminal I can use mosquitto_sub -t in_topic
and in other terminal I use mosquitto_pub -h test.mosquitto.org -t in_topic -m message
. I get that message in first terminal where I used mosquitto_sub command. So after this I am right to assume that bridge works well. But I can't figure out what seems to be the problem with bridging to cloudmqtt.
Cloudmqtt uses mosquitto mqtt brokers, dioty crossed from mosquitto to Mosca mqtt broker which doesn't support bridging but apparently have better scalability (this information has been provided to me by dioty customer service)
EDITED: I solved this bridgig problem using Node-RED. Just added one mqqt input and configure it for local mosquitto broker (PORT 1883) and two mqtt outputs, for cloudmqtt and DIoTY.
On cloudmqtt, after you made an account (cute cat is free), go to control panel and add cloudmqtt instance and username and password will be provided to you by cloudmqtt. In Node-RED configure one of the mqtt outputs for cloudmqtt instance by adding server, username, password and port.
On DIoTY you also need to make account or sign in with google, or some other account. When you log in you will be provided by username which will be your mail account and other informations like host and port, password which will be sent to the e-mail account. So to use this in Node-RED you need to add host(server), username, password and port to the mqtt output. And when you subscribe or publish message keep in mind that you have root topic, in example:
/your_mail_account/topic
and no matter are subscribing to some topic or publishing some messages you need to add root topic as some kind prefix.
After you have done this configuration you need to deploy changes, and that is. So for this kind of I used Node-RED.