Hi,
I am running pytibber version o. on docker with python:3.9-slim-buster (Python 3.9.13).
My requirements.txt file has:
aiohttp==3.8.1
aiosignal==1.2.0
async-timeout==4.0.2
attrs==22.1.0
charset-normalizer==2.1.0
frozenlist==1.3.0
graphql-subscription-manager==0.4.3
idna==3.3
multidict==6.0.2
numpy==1.23.1
pandas==1.4.3
psycopg2==2.9.3
python-dateutil==2.8.2
pyTibber
boto3 >= 1.20.13
argparse
AWSIoTPythonSDK==1.5.2
The code is the same you propose as example:
_async def main():
access_token = ACCESS_TOKEN
tibber_connection = tibber.Tibber(access_token)
await tibber_connection.update_info()
home = tibber_connection.get_homes()[0]
await home.update_info()
await home.update_price_info()
tibberPrice = home.current_price_info
# covert dict to json and send to AWSIoTCore
tibberPrice['address'] = TIBBERADDRESS
tibberPrice['timestamp'] = strftime("%Y-%m-%d %H:%M:%S", gmtime())
messageJson = json.dumps(tibberPrice, indent = 4)
#Send to AWSIoT
myawsclient.publish(topic, messageJson)
print('Published topic %s: %s\n' % (topic, messageJson))
await tibber_connection.close_connection()__
if name == 'main':
loop = asyncio.get_event_loop()
while True:
loop.run_until_complete(main())
time.sleep(60)
The following error occurs:
Published topic tibber/price: {
"energy": 3.8703,
"tax": 0.9775,
"total": 4.8478,
"startsAt": "2022-09-05T11:00:00.000+02:00",
"level": "NORMAL",
"address": "XX",
"timestamp": "2022-09-05 09:57:54"
}
hosts = await asyncio.shield(host_resolved)
File "/usr/local/lib/python3.9/site-packages/aiohttp/connector.py", line 880, in _resolve_host
Hi, I am running pytibber version o. on docker with python:3.9-slim-buster (Python 3.9.13). My requirements.txt file has: aiohttp==3.8.1 aiosignal==1.2.0 async-timeout==4.0.2 attrs==22.1.0 charset-normalizer==2.1.0 frozenlist==1.3.0 graphql-subscription-manager==0.4.3 idna==3.3 multidict==6.0.2 numpy==1.23.1 pandas==1.4.3 psycopg2==2.9.3 python-dateutil==2.8.2 pyTibber boto3 >= 1.20.13 argparse AWSIoTPythonSDK==1.5.2
The code is the same you propose as example: _async def main(): access_token = ACCESS_TOKEN tibber_connection = tibber.Tibber(access_token) await tibber_connection.update_info()
if name == 'main': loop = asyncio.get_event_loop() while True: loop.run_until_complete(main()) time.sleep(60)
The following error occurs: Published topic tibber/price: { "energy": 3.8703, "tax": 0.9775, "total": 4.8478, "startsAt": "2022-09-05T11:00:00.000+02:00", "level": "NORMAL", "address": "XX", "timestamp": "2022-09-05 09:57:54" }
File "/usr/local/lib/python3.9/site-packages/aiohttp/connector.py", line 880, in _resolve_host
File "/usr/local/lib/python3.9/site-packages/aiohttp/resolver.py", line 33, in resolve
File "/usr/local/lib/python3.9/asyncio/base_events.py", line 861, in getaddrinfo
File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 58, in run
File "/usr/local/lib/python3.9/socket.py", line 954, in getaddrinfo
socket.gaierror: [Errno -2] Name or service not known
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/src/app/./PubSub_Tibber_Price.py", line 80, in
File "/usr/local/lib/python3.9/asyncio/base_events.py", line 647, in run_until_complete
File "/usr/src/app/./PubSub_Tibber_Price.py", line 49, in main
File "/usr/local/lib/python3.9/site-packages/tibber/init.py", line 132, in update_info
File "/usr/local/lib/python3.9/site-packages/tibber/init.py", line 105, in _execute
File "/usr/local/lib/python3.9/site-packages/tibber/init.py", line 105, in _execute
File "/usr/local/lib/python3.9/site-packages/tibber/init.py", line 98, in _execute
File "/usr/local/lib/python3.9/site-packages/aiohttp/client.py", line 535, in _request
File "/usr/local/lib/python3.9/site-packages/aiohttp/connector.py", line 542, in connect
File "/usr/local/lib/python3.9/site-packages/aiohttp/connector.py", line 907, in _create_connection
File "/usr/local/lib/python3.9/site-packages/aiohttp/connector.py", line 1166, in _create_direct_connection
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host api.tibber.com:443 ssl:default [Name or service not known]
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0xffff9a7bc340>
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0xffff9a733070>
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0xffff9a733d00>
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0xffff98657910>appening:
Any tips about why this is happening? The error appears everytime I run the code.