Merge pull request #6 from janolehuebner/dev
addd timer to force restart
This commit is contained in:
commit
2a1839fe04
1 changed files with 6 additions and 13 deletions
17
pulse.py
17
pulse.py
|
@ -33,7 +33,7 @@ logger.addHandler(ch)
|
||||||
|
|
||||||
logger.setLevel(logging.INFO)
|
logger.setLevel(logging.INFO)
|
||||||
|
|
||||||
__version__ = "v0.0.4"
|
__version__ = "v0.0.5"
|
||||||
logger.info(__version__)
|
logger.info(__version__)
|
||||||
client = InfluxDBClient(url=URL, token=TOKEN, org=ORG)
|
client = InfluxDBClient(url=URL, token=TOKEN, org=ORG)
|
||||||
|
|
||||||
|
@ -60,22 +60,15 @@ async def run():
|
||||||
tibber_connection = tibber.Tibber(TIBBERTOKEN, websession=session, user_agent="python")
|
tibber_connection = tibber.Tibber(TIBBERTOKEN, websession=session, user_agent="python")
|
||||||
await tibber_connection.update_info()
|
await tibber_connection.update_info()
|
||||||
home = tibber_connection.get_homes()[0]
|
home = tibber_connection.get_homes()[0]
|
||||||
try:
|
|
||||||
await home.rt_subscribe(_incoming)
|
await home.rt_subscribe(_incoming)
|
||||||
except RuntimeError as e:
|
|
||||||
logger.error(f"Caught a RuntimeError: {e}")
|
|
||||||
exit(1)
|
|
||||||
except Exception as e:
|
|
||||||
exit(1)
|
|
||||||
|
|
||||||
while 1:
|
|
||||||
|
while time.time() - start_time < duration_seconds:
|
||||||
await asyncio.sleep(5)
|
await asyncio.sleep(5)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
loop = asyncio.get_event_loop()
|
loop = asyncio.get_event_loop()
|
||||||
|
|
||||||
try:
|
|
||||||
loop.run_until_complete(run())
|
loop.run_until_complete(run())
|
||||||
except:
|
exit(0)
|
||||||
exit(1)
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue