Skip to content

Commit

Permalink
MQTT client keeps reconnecting when using QoS level 0 #1383
Browse files Browse the repository at this point in the history
  • Loading branch information
dennissiemensma committed May 11, 2021
1 parent b451916 commit c8b0d70
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 3 deletions.
3 changes: 2 additions & 1 deletion docs/reference/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ Current version
:doc:`How to update</how-to/upgrading/upgrade>` *(minor updates only)*


v4.17.0 - 2021-xx-xx
v4.16.1 - 2021-05-11
--------------------

- ``Fixed`` MQTT client keeps reconnecting when using QoS level 0 [`#1383 <https://github.com/dsmrreader/dsmr-reader/issues/1383>`_]


v4.16.0 - 2021-05-10
Expand Down
6 changes: 5 additions & 1 deletion dsmr_mqtt/services/broker.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,15 @@ def run(mqtt_client):
retain=True
)

# Do NOT remove this. It is both required for networking when having QoS > 1 and mqtt_client.is_connected()
# below. Omitting this loop will have the client think it's disconnected.
mqtt_client.loop(0.5)

# Does nothing when using QoS 0 (as designed). For QoS 1 and 2 however, this blocks further processing and
# message deletion below, until the broker acknowledges the message received.
logger.debug('MQTT: Waiting for message (#%s) to be marked published', current.pk)
while not result.is_published():
mqtt_client.loop(0.5)
mqtt_client.loop(0.1)

logger.debug('MQTT: Deleting published message (#%s) from queue', current.pk)
current.delete()
Expand Down
2 changes: 1 addition & 1 deletion dsmrreader/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from django.utils.version import get_version

VERSION = (4, 17, 0, 'final', 0)
VERSION = (4, 16, 1, 'final', 0)

__version__ = get_version(VERSION)
17 changes: 17 additions & 0 deletions dsmrreader/provisioning/downgrade/v4.16.1.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env bash

# Dump for DSMR-reader v4.16.1
./manage.py migrate dsmr_api 0003_create_api_user
./manage.py migrate dsmr_backend 0015_backend_restart_required
./manage.py migrate dsmr_backup 0013_dropbox_setting_refactoring
./manage.py migrate dsmr_consumption 0019_energy_supplier_price_decimals
./manage.py migrate dsmr_datalogger 0030_override_telegram_timestamp
./manage.py migrate dsmr_dropbox 0001_schedule_dropbox
./manage.py migrate dsmr_frontend 0043_default_color_update_tariff_2
./manage.py migrate dsmr_influxdb 0004_client_settings_update
./manage.py migrate dsmr_mindergas 0005_schedule_mindergas_export
./manage.py migrate dsmr_mqtt 0019_mqtt_current_period_totals
./manage.py migrate dsmr_notification 0008_dummy_notification_provider
./manage.py migrate dsmr_pvoutput 0004_pvoutput_setting_refactoring
./manage.py migrate dsmr_stats 0017_day_statistics_reading_history_retroactive
./manage.py migrate dsmr_weather 0006_schedule_weather_update

0 comments on commit c8b0d70

Please sign in to comment.