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

@ -1,4 +1,4 @@
FROM python:3.10-slim FROM python:3.12-bookworm
# Labels # Labels
LABEL MAINTAINER="Jan-Ole Hübner <huebner@jan-ole.de>" LABEL MAINTAINER="Jan-Ole Hübner <huebner@jan-ole.de>"
@ -12,5 +12,4 @@ ADD . /
# Chmod # Chmod
RUN chmod 755 /pulse.py RUN chmod 755 /pulse.py
CMD ["python3","/get_price.py"]
CMD ["python3","/pulse.py"] CMD ["python3","/pulse.py"]

View file

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

View file

@ -1,6 +1,6 @@
influxdb-client[ciso] influxdb-client[ciso]
requests requests
pyTibber pyTibber @ git+https://github.com/Danielhiversen/pyTibber@f64cb36
tzdata tzdata
pytz pytz
certifi certifi