diff options
author | Evgeny Zinoviev <me@ch1p.io> | 2024-02-24 02:04:41 +0300 |
---|---|---|
committer | Evgeny Zinoviev <me@ch1p.io> | 2024-02-24 02:04:41 +0300 |
commit | d43ca74063d8d931325c4498b02f40bb03e9e104 (patch) | |
tree | e6be2383d8ea3c206749f954f35cc87527be9be2 /bin/temphum_mqtt_node.py | |
parent | 9be0c3125dd5302c409b6a0fe37b8224b163209f (diff) |
temphum_mqtt_node: scheduler pause/resume
Diffstat (limited to 'bin/temphum_mqtt_node.py')
-rwxr-xr-x | bin/temphum_mqtt_node.py | 5 |
1 files changed, 5 insertions, 0 deletions
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: |