Modify task in config

This commit is contained in:
Jan-Henrik 2023-02-07 21:35:16 +01:00
parent 64a9db6bd9
commit aedab09f2a
2 changed files with 3 additions and 3 deletions

View file

@ -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

View file

@ -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)