setting max runtime to 1h
This commit is contained in:
parent
0b995a9dae
commit
e6204279d7
1 changed files with 5 additions and 3 deletions
8
pulse.py
8
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)
|
Loading…
Add table
Add a link
Reference in a new issue