You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
i am working on an interface to a smart meter device for an integration in Home Assistant. The device has an API that can be requested via https.
I was working with the python lib requests and that works. But the integration uses the lib httpx. But with this lib I cannot get the connection. To the same device, within the same network, same user, password, certificate.
Where can be the difference?
I wrote a script, that tries to make the connection with both libs, but only the one made with request works.
I have to say, that between me and the device, there is small NAT Router; but could this affect the httpx-connection and it works with requests?
This is the log from the first connection with requests; works like a charm:
INFO:main:Theben Connexa HTTP Client
INFO:main:This is a connection test for the Theben Connexa Smart-Meter Gateway
DEBUG:main:Debug logging is enabled
INFO:main:Connecting to 10.11.120.2:443...
INFO:main:I have downloaded the public certificate from the IP address 10.11.120.2 and analyzed it.
INFO:main:The certificate is saved in 10.11.120.2_public_cert.pem.
INFO:main:The certificate is valid for this name (SAN): ethe0300186023.sm
INFO:main:The certificate is only validated successfully if the call can be made using this name.
INFO:main:Therefore, please access the device directly via ethe0300186023.sm or set up an alias in the DNS server: ethe0300186023.sm=10.11.120.2
INFO:main:Calling: POST https://ethe0300186023.sm/smgw/m2m/
INFO:main:Using username: 30320426231LGZ0067558611
INFO:main:Using body: {'method': 'smgw-info'}
Connect with the REQUESTS library
REQUESTS Version: 2.32.3
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): ethe0300186023.sm:443
DEBUG:urllib3.connectionpool:https://ethe0300186023.sm:443 "POST /smgw/m2m/ HTTP/11" 401 16
DEBUG:urllib3.connectionpool:https://ethe0300186023.sm:443 "POST /smgw/m2m/ HTTP/11" 307 8
DEBUG:urllib3.connectionpool:https://ethe0300186023.sm:443 "POST /smgw/m2m/30320426231lgz0067558611.sm/json HTTP/11" 401 0
DEBUG:urllib3.connectionpool:https://ethe0300186023.sm:443 "POST /smgw/m2m/30320426231lgz0067558611.sm/json HTTP/11" 200 9905
Status Code: 200
Firmware Version: v3.80.0-cc
This is the log from the second connection with https; has errors:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
i am working on an interface to a smart meter device for an integration in Home Assistant. The device has an API that can be requested via https.
I was working with the python lib
requestsand that works. But the integration uses the libhttpx. But with this lib I cannot get the connection. To the same device, within the same network, same user, password, certificate.Where can be the difference?
I wrote a script, that tries to make the connection with both libs, but only the one made with
requestworks.I have to say, that between me and the device, there is small NAT Router; but could this affect the
httpx-connection and it works withrequests?This is the script
https://gist.github.com/klacol/d8b30cf0b08267c2366bed86b42302ee
This is the log from the first connection with
requests; works like a charm:This is the log from the second connection with
https; has errors:I know, it is complicated to help, without being able to replay this.
Any help appreciated
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions