Skip to content

Commit 78d37b5

Browse files
committed
Status update: fix unsent online status
To avoid too much publish on status topic (that may trigger more traffic from client), there is a cache an the new status is not sent if same as last one (it is retained on broker anyway) But the cache was not handling the disconnect properly. In case of disconnect, the "last will" update the status but the gateway do not see it and still think that the retained status is the one from its cache. So the fix is just to clean the cache in the onConnect callback
1 parent 5edffec commit 78d37b5

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

python_transport/wirepas_gateway/transport_service.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,10 @@ def _on_connect(self):
371371
topic, self._on_otap_set_target_scratchpad_request_received
372372
)
373373

374+
# Reset our cached value to be sure the status is published again
375+
# If we are here, it means that we were disconnected and our last_will
376+
# status was sent
377+
self._last_status_config = None
374378
self._set_status()
375379

376380
logging.info("MQTT connected!")

0 commit comments

Comments
 (0)