ssl err
This commit is contained in:
parent
1456c12608
commit
7546d1fdc7
3 changed files with 15 additions and 6 deletions
|
@ -4,8 +4,8 @@ FROM python:3.10-slim
|
||||||
LABEL MAINTAINER="Jan-Ole Hübner <huebner@jan-ole.de>"
|
LABEL MAINTAINER="Jan-Ole Hübner <huebner@jan-ole.de>"
|
||||||
|
|
||||||
|
|
||||||
ADD requirenments.txt /
|
ADD requirements.txt /
|
||||||
RUN pip3 install -r /requirenments.txt
|
RUN pip3 install -r /requirements.txt
|
||||||
# Environment
|
# Environment
|
||||||
ENV PYTHONIOENCODING=utf-8
|
ENV PYTHONIOENCODING=utf-8
|
||||||
ADD . /
|
ADD . /
|
||||||
|
|
14
pulse.py
14
pulse.py
|
@ -31,7 +31,7 @@ logger.addHandler(ch)
|
||||||
|
|
||||||
logger.setLevel(logging.INFO)
|
logger.setLevel(logging.INFO)
|
||||||
|
|
||||||
__version__ = "v0.1.2"
|
__version__ = "v0.1.3"
|
||||||
logger.info(__version__)
|
logger.info(__version__)
|
||||||
client = InfluxDBClient(url=URL, token=TOKEN, org=ORG)
|
client = InfluxDBClient(url=URL, token=TOKEN, org=ORG)
|
||||||
|
|
||||||
|
@ -51,11 +51,19 @@ def _incoming(pkg):
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
async def run():
|
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:
|
if session.closed:
|
||||||
logger.error("session closed")
|
logger.error("session closed")
|
||||||
exit(1)
|
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()
|
await tibber_connection.update_info()
|
||||||
home = tibber_connection.get_homes()[0]
|
home = tibber_connection.get_homes()[0]
|
||||||
await home.rt_subscribe(_incoming)
|
await home.rt_subscribe(_incoming)
|
||||||
|
|
|
@ -2,4 +2,5 @@ influxdb-client[ciso]
|
||||||
requests
|
requests
|
||||||
pyTibber
|
pyTibber
|
||||||
tzdata
|
tzdata
|
||||||
pytz
|
pytz
|
||||||
|
certifi
|
Loading…
Add table
Add a link
Reference in a new issue