MQTT clients keeps disconnecting from bridge

I have configured an MQTT bridge to AWS IoT from Mosquitto on Home Assistant. Mosquitto installed via add-on (standard from Supervisor | Add-ons) and bridge file created as per instructions.

Running this I get the following messages in the Mosquitto log file

2020-10-23T06:29:56.855055000Z 1603434596: New client connected from 192.168.1.240 as MqttDashboard-8679153 (p2, c1, k30, u'mqttuser').
2020-10-23T06:29:56.857363000Z 1603434596: No will message specified.
2020-10-23T06:29:56.857605000Z 1603434596: Sending CONNACK to MqttDashboard-8679153 (0, 0)
2020-10-23T06:29:57.158545000Z 1603434597: Bridge local.bridgeawsiot doing local SUBSCRIBE on topic homeassistant/sun/sun/azimuth
2020-10-23T06:29:57.158937000Z 1603434597: Connecting bridge awsiot (a1mpax8uhmvady-ats.iot.us-east-1.amazonaws.com:8883)
2020-10-23T06:29:57.167846000Z 1603434597: Bridge bridgeawsiot sending CONNECT
2020-10-23T06:29:58.131523000Z 1603434598: Received CONNACK on connection local.bridgeawsiot.
2020-10-23T06:29:58.132811000Z 1603434598: Bridge local.bridgeawsiot sending UNSUBSCRIBE (Mid: 2, Topic: homeassistant/sun/sun/azimuth)
2020-10-23T06:29:58.133049000Z 1603434598: Sending PUBLISH to local.bridgeawsiot (d0, q0, r1, m0, 'homeassistant/sun/sun/azimuth', ... (6 bytes))
2020-10-23T06:29:58.386787000Z 1603434598: Received UNSUBACK from local.bridgeawsiot
2020-10-23T06:29:58.587056000Z 1603434598: Socket error on client local.bridgeawsiot, disconnecting.
2020-10-23T06:30:04.295149000Z 1603434604: Bridge local.bridgeawsiot doing local SUBSCRIBE on topic homeassistant/sun/sun/azimuth
2020-10-23T06:30:04.296839000Z 1603434604: Connecting bridge awsiot (xxxxxxxxxxxxxx-ats.iot.us-east-1.amazonaws.com:8883)
2020-10-23T06:30:04.306487000Z 1603434604: Bridge bridgeawsiot sending CONNECT
2020-10-23T06:30:05.280315000Z 1603434605: Received CONNACK on connection local.bridgeawsiot.
2020-10-23T06:30:05.280853000Z 1603434605: Bridge local.bridgeawsiot sending UNSUBSCRIBE (Mid: 3, Topic: homeassistant/sun/sun/azimuth)
2020-10-23T06:30:05.281324000Z 1603434605: Sending PUBLISH to local.bridgeawsiot (d0, q0, r1, m0, 'homeassistant/sun/sun/azimuth', ... (6 bytes))
2020-10-23T06:30:05.533389000Z 1603434605: Received UNSUBACK from local.bridgeawsiot
2020-10-23T06:30:05.733945000Z 1603434605: Socket error on client local.bridgeawsiot, disconnecting.

Any idea why this keeps disconneting?

Sending PUBLISH to local.bridgeawsiot (d0, q0, r1, m0, 'homeassistant/sun/sun/azimuth', ... (6 bytes))
                                               ^^
                                              Retained flag

AWS IoT does not support retained messages.

Oh ok so their MQTT implementation is not “complete”?

So to use this bridge to AWS IoT I’d have to turn off the retain flag in Home Assistant. Is there a global place to do so or would this have to done at the entity? level or elsewhere?

Everywhere you publish mqtt messages (automations, sensors, switches, etc…). There is no global switch unless stripping the retain flag is an option you can set in the Mosquitto bridge file.

You will also have to delete all the retained messages currently in your broker.

1 Like