pytibber bugfixes

This commit is contained in:
Jan-Ole Hübner 2024-05-08 13:12:24 +02:00
parent 7546d1fdc7
commit d683970918
3 changed files with 6 additions and 5 deletions

View file

@ -31,7 +31,7 @@ logger.addHandler(ch)
logger.setLevel(logging.INFO)
__version__ = "v0.1.3"
__version__ = "v0.1.4"
logger.info(__version__)
client = InfluxDBClient(url=URL, token=TOKEN, org=ORG)
@ -53,12 +53,14 @@ def _incoming(pkg):
async def run():
conn = aiohttp.TCPConnector(limit_per_host=3)
async with aiohttp.ClientSession(trust_env=True, connector=conn) as session:
logger.info("connecting to tibber...")
if session.closed:
logger.error("session closed")
exit(1)
try:
tibber_connection = tibber.Tibber(TIBBERTOKEN, user_agent="python")
tibber_connection = tibber.Tibber(TIBBERTOKEN, user_agent="python",websession=session)
except Exception as e:
logger.info("error connecting to tibber...")