Modify task in config
This commit is contained in:
parent
64a9db6bd9
commit
aedab09f2a
2 changed files with 3 additions and 3 deletions
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
name: Screenshotter
|
name: Screenshotter
|
||||||
version: 1.0.1.3
|
version: 1.0.1.4
|
||||||
#image: ghcr.io/maxwinterstein/homeassistant-addon-toogoodtogo-ha-mqtt-bridge-{arch}
|
#image: ghcr.io/maxwinterstein/homeassistant-addon-toogoodtogo-ha-mqtt-bridge-{arch}
|
||||||
slug: screenshotter
|
slug: screenshotter
|
||||||
description: Screenshot images for E-Paper pricetags
|
description: Screenshot images for E-Paper pricetags
|
||||||
|
|
|
@ -38,7 +38,7 @@ for image in config["images"]:
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
now = datetime.datetime.now()
|
now = datetime.datetime.now()
|
||||||
for task in tasks:
|
for i, task in enumerate(tasks):
|
||||||
if task["next_execution"] > now:
|
if task["next_execution"] > now:
|
||||||
continue
|
continue
|
||||||
print(f"Running {task['name']}")
|
print(f"Running {task['name']}")
|
||||||
|
@ -57,5 +57,5 @@ while True:
|
||||||
image = image.rotate(int(rotate), expand=True)
|
image = image.rotate(int(rotate), expand=True)
|
||||||
file_name = f'{image_path}/{task["name"]}.png'
|
file_name = f'{image_path}/{task["name"]}.png'
|
||||||
image.save(file_name)
|
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)
|
time.sleep(1)
|
||||||
|
|
Loading…
Reference in a new issue