beele / HomebridgeLgSmartThinqAirco

Homebridge plugin for controlling a split unit LG SmartThinq Airco unit
GNU General Public License v3.0
30 stars 7 forks source link

Error while example.py #6

Closed Rubske70 closed 4 years ago

Rubske70 commented 4 years ago

Hi,

Sorry for reaching out but I have the following issue when running example.py on my Pi4 running latest Raspbian. When doing the same on my Windows 10 it works ok. I see similar errors when running homebridge on the Pi when addressing the Airco.

Thanks for your help!

Rob

python3 example.py -c "NL" -l "en-NL" -s "wideq_state.json" ls [Errno 2] No such file or directory: 'wideq_state.json' Log in here: https://nl.m.lgaccount.com/login/sign_in?country=NL&language=en-NL&svcCode=SVC202&authSvr=oauth2&client_id=LGAO221A02&division=ha&grant_type=password Then paste the URL where the browser is redirected: https://nl.m.lgaccount.com/login/iabClose?access_token=9c489401a1d7a2a60d1c89b3fef37ffd792e3714298e2805bf23ea1085a6655b6b161e74f20be69cc85082339aa0eda3&refresh_token=28e104680e7ef6ef086c0e7e1430ff9fe4c2130a2dd85aaebdaeb495ea5dfbafb0bebff74f091036b4c75054358326bc&oauth2_backend_url=https://gb.lgeapi.com/ Traceback (most recent call last): File "/usr/lib/python3/dist-packages/urllib3/contrib/pyopenssl.py", line 453, in wrap_socket cnx.do_handshake() File "/usr/lib/python3/dist-packages/OpenSSL/SSL.py", line 1915, in do_handshake self._raise_ssl_error(self._ssl, result) File "/usr/lib/python3/dist-packages/OpenSSL/SSL.py", line 1647, in _raise_ssl_error _raise_current_error() File "/usr/lib/python3/dist-packages/OpenSSL/_util.py", line 54, in exception_from_error_queue raise exception_type(errors) OpenSSL.SSL.Error: [('SSL routines', 'tls_process_ske_dhe', 'dh key too small')]

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 600, in urlopen chunked=chunked) File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 343, in _make_request self._validate_conn(conn) File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 841, in _validate_conn conn.connect() File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 344, in connect sslcontext=context) File "/usr/lib/python3/dist-packages/urllib3/util/ssl.py", line 344, in ssl_wrap_socket return context.wrap_socket(sock, server_hostname=server_hostname) File "/usr/lib/python3/dist-packages/urllib3/contrib/pyopenssl.py", line 459, in wrap_socket raise ssl.SSLError('bad handshake: %r' % e) ssl.SSLError: ("bad handshake: Error([('SSL routines', 'tls_process_ske_dhe', 'dh key too small')])",)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/lib/python3/dist-packages/requests/adapters.py", line 449, in send timeout=timeout File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 638, in urlopen _stacktrace=sys.exc_info()[2]) File "/usr/lib/python3/dist-packages/urllib3/util/retry.py", line 398, 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("bad handshake: Error([('SSL routines', 'tls_process_ske_dhe', 'dh key too small')])")))

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "example.py", line 245, in main() File "example.py", line 241, in main example(args.country, args.language, args.state_file, args.cmd, args.args) File "example.py", line 196, in example example_command(client, cmd, args) File "example.py", line 170, in example_command func(client, *args) File "example.py", line 24, in ls for device in client.devices: File "/usr/local/lib/node_modules/homebridge-lg-airco/resources/wideq/wideq/client.py", line 123, in devices self._devices = self.session.get_devices() File "/usr/local/lib/node_modules/homebridge-lg-airco/resources/wideq/wideq/client.py", line 114, in session self._session, self._devices = self.auth.start_session() File "/usr/local/lib/node_modules/homebridge-lg-airco/resources/wideq/wideq/core.py", line 273, in start_session self.gateway.country, self.gateway.language) File "/usr/local/lib/node_modules/homebridge-lg-airco/resources/wideq/wideq/core.py", line 191, in login return lgedm_post(url, data) File "/usr/local/lib/node_modules/homebridge-lg-airco/resources/wideq/wideq/core.py", line 120, in lgedm_post res = requests.post(url, json={DATA_ROOT: data}, headers=headers) File "/usr/lib/python3/dist-packages/requests/api.py", line 116, in post return request('post', url, data=data, json=json, kwargs) File "/usr/lib/python3/dist-packages/requests/api.py", line 60, in request return session.request(method=method, url=url, kwargs) File "/usr/lib/python3/dist-packages/requests/sessions.py", line 533, in request resp = self.send(prep, send_kwargs) File "/usr/lib/python3/dist-packages/requests/sessions.py", line 646, in send r = adapter.send(request, kwargs) File "/usr/lib/python3/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("bad handshake: Error([('SSL routines', 'tls_process_ske_dhe', 'dh key too small')])")))

LAKY911 commented 4 years ago

Hi! I have completely same problem on my RPi 3B... EDIT: Seems to be problem with OpenSSL & Python version

Rubske70 commented 4 years ago

I have openssl 1.1.1d and Python 3.7.3 do you have the same?

Grtz

Rob

LAKY911 commented 4 years ago

I have openssl 1.1.1d and Python 3.7.3 do you have the same?

Grtz

Rob

Hi Rob, exactly the same setup. OpenSSL1.1.1d and Python 3.7.3 on my Raspberry Pi 3B. I didn't find a solution yet. If you find any, please let me know. Lukas

Rubske70 commented 4 years ago

Please also check https://github.com/sampsyo/wideq/issues/53 as it's the same WideQ thats being used.

Rubske70 commented 4 years ago

A quick workaround is by adding this at the bottom of init.py in wideq folder. Thanks to @GameLauncher for the tip!

requests.packages.urllib3.disablewarnings() requests.packages.urllib3.util.ssl.DEFAULT_CIPHERS += 'HIGH:!DH:!aNULL' try: requests.packages.urllib3.contrib.pyopenssl.DEFAULT_SSL_CIPHER_LIST += 'HIGH:!DH:!aNULL' except AttributeError:

no pyopenssl support used / needed / available

pass
LAKY911 commented 4 years ago

Thank you! Works perfect.