From aedab09f2a79fe0d70cd60c874b115d39d1b7950 Mon Sep 17 00:00:00 2001 From: Jan-Henrik Bruhn Date: Tue, 7 Feb 2023 21:35:16 +0100 Subject: [PATCH] Modify task in config --- screenshotter/config.yaml | 2 +- screenshotter/rootfs/app/app.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/screenshotter/config.yaml b/screenshotter/config.yaml index 7c2a049..3f18845 100644 --- a/screenshotter/config.yaml +++ b/screenshotter/config.yaml @@ -1,6 +1,6 @@ --- name: Screenshotter -version: 1.0.1.3 +version: 1.0.1.4 #image: ghcr.io/maxwinterstein/homeassistant-addon-toogoodtogo-ha-mqtt-bridge-{arch} slug: screenshotter description: Screenshot images for E-Paper pricetags diff --git a/screenshotter/rootfs/app/app.py b/screenshotter/rootfs/app/app.py index e7fe888..ca43230 100644 --- a/screenshotter/rootfs/app/app.py +++ b/screenshotter/rootfs/app/app.py @@ -38,7 +38,7 @@ for image in config["images"]: while True: now = datetime.datetime.now() - for task in tasks: + for i, task in enumerate(tasks): if task["next_execution"] > now: continue print(f"Running {task['name']}") @@ -57,5 +57,5 @@ while True: image = image.rotate(int(rotate), expand=True) file_name = f'{image_path}/{task["name"]}.png' image.save(file_name) - task["next_execution"] = now + datetime.timedelta(minutes=task["period_minutes"]) + tasks[i]["next_execution"] = now + datetime.timedelta(minutes=task["period_minutes"]) time.sleep(1)