eclipse-paho / eclipse-paho/paho.mqtt.python

Messages droped without error message

Open
#730 2 comments 0 reactions 1 assignee Claimed by @MattBrittan View on GitHub
Status: Accepted Status: More info needed
Dominant language
Python
Stars
2.4k
Forks
742
Avg merge
12d 48m
Merged PRs (30d)
1

Description

I'm using this python module to send messages to a MQTT broker in Home Assistant. The code regarding the MQTT client is the following:
```
topic = '/homeassistant/zone_clusters'
client = mqtt_client.Client(client_id)
client.username_pw_set(username, password)
client.connect(broker, port)

time.sleep(row_time)
client.publish_qos = 2
for _, row in zone_clusters_df.iterrows():
json_row = row.to_json()
(rc, mid) = client.publish(topic=topic, payload=json_row, qos=2)
if rc != 0:
print(rc + ' - ' + mid)
client.loop()
time.sleep(row_time)
client.disconnect()
print('zone_clusters - done')`
```

But some of the messages are dropped without warning. I can see that by counting the number of messages received by listening to the MQTT topic (using node red).

Am I doing anything wrong in the code? If I'm using qos 2, shouldn't I receive at least a warning about a dropped message?
Thank you.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.