commit
c09826c4f9
1 changed files with 6 additions and 4 deletions
10
pulse.py
10
pulse.py
|
@ -1,6 +1,7 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
import time
|
||||||
|
|
||||||
import tibber.const
|
import tibber.const
|
||||||
import asyncio
|
import asyncio
|
||||||
|
@ -30,7 +31,7 @@ logger.addHandler(ch)
|
||||||
|
|
||||||
logger.setLevel(logging.INFO)
|
logger.setLevel(logging.INFO)
|
||||||
|
|
||||||
__version__ = "v0.1.1"
|
__version__ = "v0.1.2"
|
||||||
logger.info(__version__)
|
logger.info(__version__)
|
||||||
client = InfluxDBClient(url=URL, token=TOKEN, org=ORG)
|
client = InfluxDBClient(url=URL, token=TOKEN, org=ORG)
|
||||||
|
|
||||||
|
@ -59,12 +60,13 @@ async def run():
|
||||||
home = tibber_connection.get_homes()[0]
|
home = tibber_connection.get_homes()[0]
|
||||||
await home.rt_subscribe(_incoming)
|
await home.rt_subscribe(_incoming)
|
||||||
|
|
||||||
|
timeout = time.time() + 3600 # Set a timeout for 3600 seconds (1 hour)
|
||||||
while 1:
|
while time.time() < timeout:
|
||||||
await asyncio.sleep(5)
|
await asyncio.sleep(2)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
loop = asyncio.get_event_loop()
|
loop = asyncio.get_event_loop()
|
||||||
|
|
||||||
loop.run_until_complete(run())
|
loop.run_until_complete(run())
|
||||||
|
exit(42)
|
Loading…
Add table
Add a link
Reference in a new issue