olinek2 / LGAC_SmartT

Domoticz plugin for LGAC SmartThing
MIT License
7 stars 8 forks source link

problems with installation in Raspbian Buster #3

Closed javier6d2 closed 4 years ago

javier6d2 commented 4 years ago

I had Raspbian Stretch with your plugin and everything works very well, now I have installed Buster to upgrade new Domoticz version and can´t run the plugin. I get problem with the handshake, but I can back to Stretch and works fine, may you upgrade?

pi@raspberrypi:~/LGAC_SmartT $ python3 example.py Log in here: https://pt.m.lgaccount.com/login/sign_in?country=PT&language=en-EN&svcCode=SVC202&authSvr=oauth2&client_id=LGAO221A02&division=ha&grant_type=password Then paste the URL where the browser is redirected: https://pt.m.lgaccount.com/login/iabClose?access_token=7f491aaa637c293ef8ac73adadad2000d8ba59444711fe87e63034a1d7f7f656d0473de1df428acafccb3dccca413&refresh_token=f42f2c03fe3d7d5acbe3987bf9eddaaaaad6cadf245e86ec4f88905d35c59b31e94e5089fc1545750df4e018a84a&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:

mlepannetier commented 4 years ago

Hi,

I have the same issue :

root@raspberrypi:/home/pi/LGAC_SmartT# python3 example.py Log in here: https://fr.m.lgaccount.com/login/sign_in?country=FR&language=en-EN&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=8eaa260581d9c1eeeaeada298574de00efacd26b02d085a432cbc9c144a8a689f3dd61c82b8ccda8e01084458fc25dd5&refresh_token=154c747b6626d9906040bdeb7786bd0ef62112ff70365cbcfa72d4dc081da8ebe07b0bf153a060633fce2a816ae8ee5b&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 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 214, in example(sys.argv[1:]) File "example.py", line 200, in example example_command(client, args) File "example.py", line 177, in example_command ls(client) File "example.py", line 25, in ls for device in client.devices: File "/home/pi/LGAC_SmartT/wideq.py", line 474, in devices self._devices = self.session.get_devices() File "/home/pi/LGAC_SmartT/wideq.py", line 465, in session self._session, self._devices = self.auth.start_session() File "/home/pi/LGAC_SmartT/wideq.py", line 255, in start_session session_info = login(self.gateway.api_root, self.access_token) File "/home/pi/LGAC_SmartT/wideq.py", line 177, in login return lgedm_post(url, data) File "/home/pi/LGAC_SmartT/wideq.py", line 111, in lgedm_post res = requests.post(url, json={DATA_ROOT: data}, headers=headers) File "/usr/local/lib/python3.7/dist-packages/requests/api.py", line 119, in post return request('post', url, data=data, json=json, kwargs) File "/usr/local/lib/python3.7/dist-packages/requests/api.py", line 61, in request return session.request(method=method, url=url, 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)')))

RomanSladecek commented 4 years ago

Solution: sudo sed -i "s|TLSv1.2|TLSv1.0|g" /etc/ssl/openssl.cnf

javier6d2 commented 4 years ago

Thank you Roman, with your advice I can now complete the plugin installation but I have an issue in Domoticz Log and the AC don´t start from Domoticz Devices:

2020-06-23 22:46:06.271 Status: Incoming connection from: 192.168.130.50 2020-06-23 22:46:13.458 (Ar Condicionado prueba) Pushing 'onHeartbeatCallback' on to queue 2020-06-23 22:46:13.470 (Ar Condicionado prueba) Processing 'onHeartbeatCallback' message 2020-06-23 22:46:13.470 (Ar Condicionado prueba) Calling message handler 'onHeartbeat'. 2020-06-23 22:46:13.473 (Ar Condicionado prueba) Pushing 'WriteDirective' on to queue 2020-06-23 22:46:13.473 (Ar Condicionado prueba) Processing 'WriteDirective' message 2020-06-23 22:46:13.473 (Ar Condicionado prueba) Sending 8 bytes of data 2020-06-23 22:46:13.473 (Ar Condicionado prueba) 91 a6 73 74 61 74 75 73 .. .. .. .. .. .. .. .. .. .. .. .. Ѧstatus 2020-06-23 22:46:13.915 (Ar Condicionado prueba) Pushing 'ReadEvent' on to queue 2020-06-23 22:46:13.925 (Ar Condicionado prueba) Processing 'ReadEvent' message 2020-06-23 22:46:13.925 (Ar Condicionado prueba) Received 65 bytes of data 2020-06-23 22:46:13.925 (Ar Condicionado prueba) 82 a9 65 78 63 65 70 74 69 6f 6e d9 29 70 79 74 68 6f 6e 2d ©exception٩python- 2020-06-23 22:46:13.925 (Ar Condicionado prueba) 4c 47 41 43 3a 20 5b 45 72 72 6e 6f 20 35 5d 20 49 6e 70 75 LGAC:.[Errno.5].Inpu 2020-06-23 22:46:13.925 (Ar Condicionado prueba) 74 2f 6f 75 74 70 75 74 20 65 72 72 6f 72 a3 63 6d 64 a6 73 t/output.errorãmdƳ 2020-06-23 22:46:13.925 (Ar Condicionado prueba) 74 61 74 75 73 .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. tatus 2020-06-23 22:46:13.925 (Ar Condicionado prueba) Pushing 'onMessageCallback' on to queue 2020-06-23 22:46:13.925 (Ar Condicionado prueba) Processing 'onMessageCallback' message 2020-06-23 22:46:13.925 (Ar Condicionado prueba) Calling message handler 'onMessage'. 2020-06-23 22:46:13.925 (Ar Condicionado prueba) onMessage called 2020-06-23 22:46:13.925 (Ar Condicionado prueba) Got: {'exception': 'python-LGAC: [Errno 5] Input/output error', 'cmd': 'status'} 2020-06-23 22:46:16.793 (rflink) Temp + Humidity (Quarto dormir) 2020-06-23 22:46:19.486 (Ar Condicionado prueba) Pushing 'onCommandCallback' on to queue 2020-06-23 22:46:19.537 (Ar Condicionado prueba) Processing 'onCommandCallback' message 2020-06-23 22:46:19.537 (Ar Condicionado prueba) Calling message handler 'onCommand'. 2020-06-23 22:46:19.537 (Ar Condicionado prueba) onCommand called for Unit 6: Parameter 'Set Level', Level: 23.0 2020-06-23 22:46:19.537 Error: (Ar Condicionado prueba) 'onCommand' failed 'AttributeError':''BasePlugin' object has no attribute 'powerOn''. 2020-06-23 22:46:19.537 Error: (Ar Condicionado prueba) ----> Line 332 in '/home/pi/domoticz/plugins/LG-SThinq-AC/plugin.py', function onCommand 2020-06-23 22:46:19.537 Error: (Ar Condicionado prueba) ----> Line 266 in '/home/pi/domoticz/plugins/LG-SThinq-AC/plugin.py', function onCommand

It´s looks like I get connection with the server but I have a python exception.

javier6d2 commented 4 years ago

I got the plugin working with Raspbian Buster, just use solution @RomanSladecek to install the plugin and don´t forget to run server automatically (my issue):

Make_ service file in systemd: sudo nano /lib/systemd/system/lgac_server.service. Paste this text with path modification:

[Unit] Description=LG AC Device Server After=multi-user.target

[Service] Type=simple ExecStart=/usr/bin/python3 /home/pi/LGAC_SmartT/LGACServerNew.py Restart=on-abort

[Install] WantedBy=multi-user.target

Press Ctrl+X, hit Y to save and enter.Then set privilidges: sudo chmod 644 /lib/systemd/system/lgac_server.service.

Kind regards