import arrow, time, logging import RPi.GPIO as GPIO # VARIABLES log_file = "logfile" dates_file = "./dates.txt" logging.basicConfig(level=logging.INFO, filename=log_file, filemode="a+",format="%(asctime)-15s %(levelname)-8s %(message)s") try: file1 = open(dates_file, 'r') Lines = file1.readlines() except IOError: logging.error("Erreur de lecture") exit() for x in Lines: if arrow.get(x).to('Europe/Paris').format('hh:mm') == arrow.utcnow().to('Europe/Paris').format('hh:mm'): logging.info("Sonnerie déclenchée à {}".format(arrow.utcnow().to('Europe/Paris').format('HH:mm'))) GPIO.setwarnings(False) GPIO.setmode(GPIO.BOARD) GPIO.setup(7, GPIO.OUT) GPIO.output(7,GPIO.LOW) time.sleep(1) GPIO.output(7,GPIO.HIGH)