From d43ca74063d8d931325c4498b02f40bb03e9e104 Mon Sep 17 00:00:00 2001 From: Evgeny Zinoviev Date: Sat, 24 Feb 2024 02:04:41 +0300 Subject: temphum_mqtt_node: scheduler pause/resume --- bin/temphum_mqtt_node.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bin/temphum_mqtt_node.py b/bin/temphum_mqtt_node.py index 3f1c911..68ac579 100755 --- a/bin/temphum_mqtt_node.py +++ b/bin/temphum_mqtt_node.py @@ -40,12 +40,17 @@ def on_mqtt_connect(): _scheduler.add_job(on_sched_task, 'interval', seconds=60, next_run_time=datetime.now()) _scheduler.start() _sched_task_added = True + elif _scheduler: + _scheduler.resume() def on_mqtt_disconnect(): global _stopped _stopped = True + if _scheduler: + _scheduler.pause() + async def on_sched_task(): if _stopped: -- cgit v1.2.3