This commit is contained in:
Jan-Ole Hübner 2024-05-07 19:08:52 +02:00
parent 1456c12608
commit 7546d1fdc7
3 changed files with 15 additions and 6 deletions

View file

@ -4,8 +4,8 @@ FROM python:3.10-slim
LABEL MAINTAINER="Jan-Ole Hübner <huebner@jan-ole.de>"
ADD requirenments.txt /
RUN pip3 install -r /requirenments.txt
ADD requirements.txt /
RUN pip3 install -r /requirements.txt
# Environment
ENV PYTHONIOENCODING=utf-8
ADD . /

View file

@ -31,7 +31,7 @@ logger.addHandler(ch)
logger.setLevel(logging.INFO)
__version__ = "v0.1.2"
__version__ = "v0.1.3"
logger.info(__version__)
client = InfluxDBClient(url=URL, token=TOKEN, org=ORG)
@ -51,11 +51,19 @@ def _incoming(pkg):
exit(1)
async def run():
async with aiohttp.ClientSession() as session:
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)
tibber_connection = tibber.Tibber(TIBBERTOKEN, websession=session, user_agent="python")
try:
tibber_connection = tibber.Tibber(TIBBERTOKEN, user_agent="python")
except Exception as e:
logger.info("error connecting to tibber...")
logger.info(e)
raise e
await tibber_connection.update_info()
home = tibber_connection.get_homes()[0]
await home.rt_subscribe(_incoming)

View file

@ -2,4 +2,5 @@ influxdb-client[ciso]
requests
pyTibber
tzdata
pytz
pytz
certifi