Somthing like this so the values are updated, cant test it, don't have
schedule
installedimport schedule # import threading import time from datetime import datetime # currenttime = datetime.now() # hr = int(currenttime.strftime("%-H")) # dt = currenttime.strftime("%c") tempss = 1 # sensor status tempsh = 1 # sensor history currenttemp = 43 # random set value, actual value called from device file. def job(): currenttime = datetime.now() dt = currenttime.strftime("%c") message = """ Alarm is still activated Current temperature is {}F {}""".format( currenttemp, dt ) print(message) # actual job script contains smtp protocals with execute send while True: if tempss == 1 and tempsh == 1: schedule.every(1).minutes.do(job) schedule.run_pending() else: schedule.cancel_job()Edit: looking at the module example the job schedule should be outside of the while loop
schedule.every(1).minutes.do(job) while True: if tempss == 1 and tempsh == 1: schedule.run_pending() else: schedule.cancel_job() time.sleep(1)