temphum_mqtt_node: scheduler pause/resume
This commit is contained in:
parent
9be0c3125d
commit
d43ca74063
@ -40,12 +40,17 @@ def on_mqtt_connect():
|
|||||||
_scheduler.add_job(on_sched_task, 'interval', seconds=60, next_run_time=datetime.now())
|
_scheduler.add_job(on_sched_task, 'interval', seconds=60, next_run_time=datetime.now())
|
||||||
_scheduler.start()
|
_scheduler.start()
|
||||||
_sched_task_added = True
|
_sched_task_added = True
|
||||||
|
elif _scheduler:
|
||||||
|
_scheduler.resume()
|
||||||
|
|
||||||
|
|
||||||
def on_mqtt_disconnect():
|
def on_mqtt_disconnect():
|
||||||
global _stopped
|
global _stopped
|
||||||
_stopped = True
|
_stopped = True
|
||||||
|
|
||||||
|
if _scheduler:
|
||||||
|
_scheduler.pause()
|
||||||
|
|
||||||
|
|
||||||
async def on_sched_task():
|
async def on_sched_task():
|
||||||
if _stopped:
|
if _stopped:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user