0

Bridge keeps disconnecting
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Bridge keeps disconnecting

by FlomoN on Wed Mar 07, 2018 6:54 pm

Hey,
I'm using mosquitto as a broker locally on my raspberry pi and now want to connect it to my adafruit.io to enable remote control from outside my network.
Unfortunately, my broker automatically gets disconnected immediately after connecting to adafruit.io.
This is my part of the mosquitto config file:
Code: Select all | TOGGLE FULL SIZE
#
# Adadfruit Bridge
#

connection adafruit-bridge
address io.adafruit.com:1883
bridge_attempt_unsubscribe false
cleansession false
notifications false
remote_username <my Username>
remote_password <my AIO Key>
remote_clientid <some creative name>
start_type automatic
bridge_protocol_version mqttv311
try_private false


topic "" in 0 led/monitor/ flomon/feeds/desk


Is there anything else I need to consider?
Thanks in advance,
FlomoN

FlomoN
 
Posts: 2
Joined: Tue Feb 13, 2018 6:52 pm

Re: Bridge keeps disconnecting

by bigt on Sun Mar 11, 2018 5:59 pm

I had a similar problem. See my thread here: https://forums.adafruit.com/viewtopic.php?f=56&t=125561

I don't think adafruit.io likes the way you're mapping your feeds. In my bridge.conf:
topic temp1 out 0 sensor/ bigt/feeds/
topic # out 0 sensor/garage/ bigt/feeds/garage_

The first mapping works, the second broke the bridge. When I commented that second one out and replaced it with explicit mappings, the bridge worked again.

Good luck!

bigt
 
Posts: 11
Joined: Sun Feb 26, 2012 2:50 am

Re: Bridge keeps disconnecting

by FlomoN on Mon Mar 12, 2018 3:45 pm

I tried your suggestion but it didn't change anything at first, only if I change the direction from "in" to out it keeps connected.
But only until I try sending a message over that channel, then it disconnects again and the message doesn't get published to the Adafruit server.
Is there anything in your conf that I'm maybe missing?

Thanks for the answer.

FlomoN
 
Posts: 2
Joined: Tue Feb 13, 2018 6:52 pm

Re: Bridge keeps disconnecting

by Deneys on Tue Mar 13, 2018 3:15 am

I had a similar problem. If I used a MQTT client like MQTT.fx it would connect but as soon as I subscribed or Published it would disconnect. It turned out to be my password. It had some !? in it. Not to sure why but after removing them. it worked.

Deneys
 
Posts: 1
Joined: Thu Mar 08, 2018 9:41 am

Re: Bridge keeps disconnecting

by bigt on Tue Mar 13, 2018 7:51 pm

The conf file looks good to me.
Of course, so did mine when it was broken.

You can try looking in your mosquitto.log file as it connects, but that may not be helpful.

Good luck.

bigt
 
Posts: 11
Joined: Sun Feb 26, 2012 2:50 am

Re: Bridge keeps disconnecting

by pthacker on Fri Mar 16, 2018 1:34 pm

I use secure access to io.adafruit.com from my Raspberry Pi Mosquitto bridge. Use port 8883 and you will need certificates. I used openssl to create certs. (Replace <your name> and <your key> with your information with the brackets.)

Code: Select all | TOGGLE FULL SIZE
# Connection name
connection adafruit

# Secure SSL/TLS
address io.adafruit.com:8883
# adjust path as approriate to point to directory with PEM encoded .crt CA files
bridge_capath /etc/ssl/certs/

# Credentials
remote_username <your name>
remote_password <your key>

# Config options for bridge
start_type automatic
bridge_protocol_version mqttv311

# This is important, if set to True connection will fail,
# probably because users don't have permissions to $SYS/#
notifications false

# Also important. if set to True the connection will fail,
# it seems io.adafruit.com doesn't support this
try_private false

I use the following to send data from my home network to io.adafruit.com. In the example I'm sending air quality and ambient light from my garage. It creates two feeds called garageairQuality and garageambientLight.

Code: Select all | TOGGLE FULL SIZE
# Topics to bridge
# topic <local topic> <in|out|both> <QoS> <local topic prefix> <remote topic prefix>
topic airQuality out 0 main/garage/ <your name>/feeds/garage
topic ambientLight out 0 main/garage/ <your name>/feeds/garage

This is what I use to send by directional data from my home network to io.adafruit.com. These topics turn security and lighting on or off with io.adafruit.com switches. The feeds are called systemsecurityMode and systemlighting.

Code: Select all | TOGGLE FULL SIZE
# eg: bi-directional topic
# <username>/feeds/welcome-feed to/from adafruit.io/welcome-feed
# topic welcome-feed both 0 adafruit.io/ <username>/feeds/
topic securityMode both 0 system/ <your name>/feeds/system
topic lighting both 0 system/ <your name>/feeds/system

I hope this works for you.

pthacker
 
Posts: 32
Joined: Sun Jan 06, 2013 2:34 pm

Please be positive and constructive with your questions and comments.