sampsyo / hass-smartthinq

Home Assistant component for LG SmartThinQ HVAC devices
MIT License
281 stars 98 forks source link

example.py #65

Open mlepannetier opened 4 years ago

mlepannetier commented 4 years ago

Hi have this error :

root@raspberrypi:/home/pi/wideq# python3 example.py -c FR -l fr-FR Log in here: https://fr.m.lgaccount.com/login/sign_in?country=FR&language=fr-FR&svcCode=SVC202&authSvr=oauth2&client_id=LGAO221A02&division=ha&grant_type=password Then paste the URL where the browser is redirected: https://fr.m.lgaccount.com/login/iabClose?access_token=80a369ab6caee45ee412a1c755725c4921a2d4bb20034000b0cae85fa2b12b885cec83d05e81103edcfef5497b504bfe&refresh_token=24a14f95f6162447f032661ef857e5b6dc742588e7ec467ccb502eff2ab1b834a1d6a66c5f16327bacb388e59f7cea15&oauth2_backend_url=https://gb.lgeapi.com/ Traceback (most recent call last): File "/usr/local/lib/python3.7/dist-packages/urllib3/connectionpool.py", line 677, in urlopen chunked=chunked, File "/usr/local/lib/python3.7/dist-packages/urllib3/connectionpool.py", line 381, in _make_request self._validate_conn(conn) File "/usr/local/lib/python3.7/dist-packages/urllib3/connectionpool.py", line 976, in _validate_conn conn.connect() File "/usr/local/lib/python3.7/dist-packages/urllib3/connection.py", line 370, in connect sslcontext=context, File "/usr/local/lib/python3.7/dist-packages/urllib3/util/ssl.py", line 377, in ssl_wrap_socket return context.wrap_socket(sock, server_hostname=server_hostname) File "/usr/lib/python3.7/ssl.py", line 412, in wrap_socket session=session File "/usr/lib/python3.7/ssl.py", line 853, in _create self.do_handshake() File "/usr/lib/python3.7/ssl.py", line 1117, in do_handshake self._sslobj.do_handshake() ssl.SSLError: [SSL: DH_KEY_TOO_SMALL] dh key too small (_ssl.c:1056)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/lib/python3.7/dist-packages/requests/adapters.py", line 449, in send timeout=timeout File "/usr/local/lib/python3.7/dist-packages/urllib3/connectionpool.py", line 765, in urlopen response_kw File "/usr/local/lib/python3.7/dist-packages/urllib3/connectionpool.py", line 765, in urlopen response_kw File "/usr/local/lib/python3.7/dist-packages/urllib3/connectionpool.py", line 765, in urlopen **response_kw [Previous line repeated 2 more times] File "/usr/local/lib/python3.7/dist-packages/urllib3/connectionpool.py", line 725, in urlopen method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2] File "/usr/local/lib/python3.7/dist-packages/urllib3/util/retry.py", line 439, in increment raise MaxRetryError(_pool, url, error or ResponseError(cause)) urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='eic.lgthinq.com', port=46030): Max retries exceeded with url: /api/member/login (Caused by SSLError(SSLError(1, '[SSL: DH_KEY_TOO_SMALL] dh key too small (_ssl.c:1056)')))

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "example.py", line 271, in main() File "example.py", line 267, in main example(args.country, args.language, args.verbose, args.cmd, args.args) File "example.py", line 208, in example example_command(client, cmd, args) File "example.py", line 177, in example_command func(client, *args) File "example.py", line 33, in ls for device in client.devices: File "/home/pi/wideq/wideq/client.py", line 126, in devices self._devices = self.session.get_devices() File "/home/pi/wideq/wideq/client.py", line 117, in session self._session, self._devices = self.auth.start_session() File "/home/pi/wideq/wideq/core.py", line 362, in start_session self.gateway.country, self.gateway.language) File "/home/pi/wideq/wideq/core.py", line 258, in login return lgedm_post(url, data) File "/home/pi/wideq/wideq/core.py", line 202, in lgedm_post res = session.post(url, json={DATA_ROOT: data}, headers=headers) File "/usr/local/lib/python3.7/dist-packages/requests/sessions.py", line 578, in post return self.request('POST', url, data=data, json=json, kwargs) File "/usr/local/lib/python3.7/dist-packages/requests/sessions.py", line 530, in request resp = self.send(prep, send_kwargs) File "/usr/local/lib/python3.7/dist-packages/requests/sessions.py", line 643, in send r = adapter.send(request, **kwargs) File "/usr/local/lib/python3.7/dist-packages/requests/adapters.py", line 514, in send raise SSLError(e, request=request) requests.exceptions.SSLError: HTTPSConnectionPool(host='eic.lgthinq.com', port=46030): Max retries exceeded with url: /api/member/login (Caused by SSLError(SSLError(1, '[SSL: DH_KEY_TOO_SMALL] dh key too small (_ssl.c:1056)')))

Milzor commented 3 years ago

@armaesiea try this solution https://stackoverflow.com/a/61198852

change line in /etc/ssl/openssl.cnf from

CipherString = DEFAULT@SECLEVEL=2

to

#CipherString = DEFAULT@SECLEVEL=2