From e6204279d70d34aae957c0c00ed9d244d13d99e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Ole=20Hu=CC=88bner?= Date: Wed, 13 Sep 2023 22:53:03 +0200 Subject: [PATCH] setting max runtime to 1h --- pulse.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pulse.py b/pulse.py index 7369158..4019157 100644 --- a/pulse.py +++ b/pulse.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- import os import sys +import time import tibber.const import asyncio @@ -59,12 +60,13 @@ async def run(): home = tibber_connection.get_homes()[0] await home.rt_subscribe(_incoming) - - while 1: - await asyncio.sleep(5) + timeout = time.time() + 3600 # Set a timeout for 3600 seconds (1 hour) + while time.time() < timeout: + await asyncio.sleep(2) loop = asyncio.get_event_loop() loop.run_until_complete(run()) +exit(42) \ No newline at end of file