diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 17a195f..9548bc3 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -4,7 +4,6 @@
-
@@ -49,13 +48,6 @@
1574193087583
-
- 1574607577396
-
-
-
- 1574607577396
-
1574607723126
@@ -392,7 +384,14 @@
1593350619006
-
+
+ 1593352569980
+
+
+
+ 1593352569980
+
+
diff --git a/octoprint_mystromswitch/__init__.py b/octoprint_mystromswitch/__init__.py
index 0d27a54..3ffe092 100644
--- a/octoprint_mystromswitch/__init__.py
+++ b/octoprint_mystromswitch/__init__.py
@@ -94,6 +94,21 @@ class MyStromSwitchPlugin(octoprint.plugin.SettingsPlugin,
self._abort_timer = RepeatedTimer(1, self._shutdown_timer_task)
self._abort_timer.start()
+ def _wait_for_timelapse_start(self):
+ if self._wait_for_timelapse_timer is not None:
+ return
+
+ self._wait_for_timelapse_timer = RepeatedTimer(5, self._wait_for_timelapse)
+ self._wait_for_timelapse_timer.start()
+
+ def _wait_for_timelapse(self):
+ c = len(octoprint.timelapse.get_unrendered_timelapses())
+
+ if c > 0:
+ self._logger.info("Waiting for %s timelapse(s) to finish rendering before starting shutdown timer..." % c)
+ else:
+ self._shutdown_timer_start()
+
def _shutdown_timer_task(self):
if self._timeout_value is None:
return