桥地方蚊子到云经纪人 [英] bridge local mosquitto to cloud broker

查看:524
本文介绍了桥地方蚊子到云经纪人的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图将本地mosquitto(在树莓派)桥接到一些云代理,所以我可以发送数据和控制一些设备使用该数据。我试着与Cloudmqtt和dioty,但没有成功。在cloudmqtt的情况下,我被告知,一切都是确定与mosquitto.conf文件和dioty我被告知,它使用Mosca代理不支持桥接(我被告知我提到cloudmqtt和dioty支持服务)。有人知道一些远程代理可以桥接到本地蚊子,并有人已经尝试过吗?



我考虑使用一些IOT平台这样做,但我已经阅读平台使用定价,我这样做是为了学习和爱好的目的,所以在我学习如何使用它,我想留在免费的帐户。




我使用mosquitto 1.4.5,mosquitto.conf文件像这样:

 #放置本地配置在/etc/mosquitto/conf.d/ 

#配置文件的完整描述位于
#/ usr / share / doc / mosquitto / examples / mosquitto.conf.example

连接cloudmqtt
地址mnumber.cloudmqtt.com:port
主题zaESP8266在0
主题ESP8266 out 0
try_private true
通知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
我选择Cloudmqtt的在线蚊子经纪人的原因是因为我选择Cloudmqtt在线蚊子经纪人的原因是因为我应该当地蚊子 - 远程蚊子桥应该工作。我可以使用客户端,如笔记本电脑或手机,并使用它们发布和订阅消息与本地代理。这种方式,即使我失去互联网访问,我可以有本地代理与本地客户端交互。



EDITED:
我配置mosquitto.conf文件,使用test.mosquitto.org,我添加了以下行:

 连接测试
地址test.mosquitto.org
topic in_topic in 0
主题out_topic out 0
try_private false
通知false
bridge_attempt_unsubscribe true

现在,在一个终端中,我可以使用 mosquitto_sub -t in_topic ,在其他终端使用 mosquitto_pub - h test.mosquitto.org -t in_topic -m message 。我得到那个消息在第一个终端,我使用mosquitto_sub命令。所以在这之后,我可以假设这座桥梁工作得很好。



Cloudmqtt使用mosquitto mqtt代理,dioty从mosquitto交叉到Mosca mqtt代理,这不是' t支持桥接,但显然有更好的可扩展性(这个信息已经由dioty客户服务提供给我)



EDITED:
我解决了这个bridgig问题使用Node-红。只需添加一个mqqt输入并为本地mosquitto代理(PORT 1883)和两个mqtt输出配置cloudmqtt和DIoTY。



在cloudmqtt上创建帐户后可爱的猫是免费的),去控制面板,并添加cloudmqtt实例和用户名和密码将由cloudmqtt提供给你。在Node-RED中,通过添加服务器,用户名,密码和端口为cloudmqtt实例配置一个mqtt输出。



在DIoTY上,您还需要进行帐户登录google或其他帐户。当您登录时,将提供用户名,这将是您的邮件帐户和其他信息,如主机和端口,将发送到电子邮件帐户的密码。因此,要在Node-RED中使用它,您需要向mqtt输出添加主机(服务器),用户名,密码和端口。当您订阅或发布讯息时,请记住您有根主题,例如:


/ your_mail_account / topic


无论是订阅某个主题还是发布一些消息,您都需要将根主题添加为某种类型的前缀。



完成此配置后,您需要部署更改,即。所以对于这种我使用的Node-RED。

解决方案

你可以尝试test.mosquitto.org作为远程代理。 / p>

要改善您的问题,请提供您使用的蚊子的版本的详细信息,并发布您使用的确切mosquitto.conf设置 - 当然删除凭据。


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.

解决方案

You could try test.mosquitto.org as the remote broker.

To improve your question, please give details of which version of mosquitto you are using and post the exact mosquitto.conf settings you use - with credentials removed of course.

这篇关于桥地方蚊子到云经纪人的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆