From 322615c3b68441244388ed2f62f7d4ad8cd5bae9 Mon Sep 17 00:00:00 2001 From: gluap Date: Thu, 4 Jan 2024 00:34:55 +0100 Subject: [PATCH] validate acknowledge messages. --- README.rst | 4 ++++ pyduofern/__init__.py | 2 +- pyduofern/duofern_stick.py | 3 +-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/README.rst b/README.rst index 2862616..56f0e77 100644 --- a/README.rst +++ b/README.rst @@ -170,6 +170,10 @@ commands instead of buying a weather station. Changelog ========= +**0.36** + +- add rudimentary tracking of successfully sent messages and resending of unacknowledged ones. + **0.35.1** - fix issue with crashes when "sets" was not defined because a bogous device type was present in duofern config. diff --git a/pyduofern/__init__.py b/pyduofern/__init__.py index 2f4a843..5117437 100644 --- a/pyduofern/__init__.py +++ b/pyduofern/__init__.py @@ -21,7 +21,7 @@ # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -__version__ = "0.35.2" +__version__ = "0.36.0" __all__ = ['DuofernException', 'DuofernStick', 'DuofernStickAsync', 'duoACK'] diff --git a/pyduofern/duofern_stick.py b/pyduofern/duofern_stick.py index cfd9c8c..5528526 100644 --- a/pyduofern/duofern_stick.py +++ b/pyduofern/duofern_stick.py @@ -635,7 +635,7 @@ def run(self): self.serial_connection.timeout = 1 if not self.write_queue.empty() or not self.rewrite_queue.empty() and ( (datetime.datetime.now() - self.last_send) >= datetime.timedelta(milliseconds=MIN_MESSAGE_INTERVAL_MILLIS)): - if toggle: + if toggle or self.rewrite_queue: self.handle_write_queue() else: self.handle_rewrite_queue() @@ -645,7 +645,6 @@ def run(self): last_resend_check = datetime.datetime.now() def handle_resends(self): - logger.debug(self.unacknowledged) done = set() t = datetime.datetime.now() for k in self.unacknowledged.keys():