Open mflammia opened 4 years ago
Fixed the PATH warning issue with the command:
export PATH="$PATH:/volume1/@appstore/py3k/usr/local/bin"
Re-run the command and installed successully this time:
root@Home-NAS:~/LGAC_SmartT# python3 -m pip install -e .
Obtaining file:///root/LGAC_SmartT
Requirement already satisfied: requests in /volume1/@appstore/py3k/usr/local/lib/python3.5/site-packages (from wideq==0.0.0) (2.23.0)
Requirement already satisfied: certifi>=2017.4.17 in /volume1/@appstore/py3k/usr/local/lib/python3.5/site-packages (from requests->wideq==0.0.0) (2020.4.5.1)
Requirement already satisfied: idna<3,>=2.5 in /volume1/@appstore/py3k/usr/local/lib/python3.5/site-packages (from requests->wideq==0.0.0) (2.9)
Requirement already satisfied: chardet<4,>=3.0.2 in /volume1/@appstore/py3k/usr/local/lib/python3.5/site-packages (from requests->wideq==0.0.0) (3.0.4)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /volume1/@appstore/py3k/usr/local/lib/python3.5/site-packages (from requests->wideq==0.0.0) (1.25.8)
Installing collected packages: wideq
Attempting uninstall: wideq
Found existing installation: wideq 0.0.0
Uninstalling wideq-0.0.0:
Successfully uninstalled wideq-0.0.0
Running setup.py develop for wideq
Successfully installed wideq
Still have same issue though:
root@Home-NAS:~/LGAC_SmartT# python3 example.py
Log in here:
https://pl.m.lgaccount.com/login/sign_in?grant_type=password&division=ha&authSvr=oauth2&client_id=LGAO221A02&svcCode=SVC202&language=en-EN&country=PL
Then paste the URL where the browser is redirected:
https://gb.m.lgaccount.com/login/iabClose?access_token=1209577b23b9140ff4c1be6ee29a65ed4526828fdc67e8f7adb301b4b05c6d2443ca2a1248ae3f2532355cc8fa149aea&refresh_token=6b4f45c3abdf4c5596ca70703a2211cb76f40699e1c6ec69468cd6f80da4321c49613c5b8fb7c1d32990cecc5cfa6a5d&oauth2_backend_url=https://gb.lgeapi.com/
Traceback (most recent call last):
File "example.py", line 214, in <module>
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 "/root/LGAC_SmartT/wideq.py", line 474, in devices
self._devices = self.session.get_devices()
File "/root/LGAC_SmartT/wideq.py", line 465, in session
self._session, self._devices = self.auth.start_session()
File "/root/LGAC_SmartT/wideq.py", line 257, in start_session
return Session(self, session_id), as_list(session_info['item'])
KeyError: 'item'
Solution:
sudo sed -i "s|TLSv1.2|TLSv1.0|g" /etc/ssl/openssl.cnf
Also cannot get token from example, output below:
sudo python3 example.py
Log in here:
https://pl.m.lgaccount.com/login/sign_in?country=PL&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://pl.m.lgaccount.com/login/iabClose?access_token=4**************&refresh_token=d***************&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
ssl_context=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 214, in <module>
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/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')])")))
Quick thank you for creating the code, look forward to getting it working :)
Just at this step of the process:
"The script will ask you to open a browser, log in, and then paste the URL you're redirected to. It will then write a JSON file called wideqstate.json."
I copy the URL into the browser, enter my LG account details and it just keeps coming back with the message:
us.m.lgaccount.com says: Please check your network and try again
I can login with the same account to the following:
https://sso.lg.com/oauth/page/login?authorizeKey=9c837df5-72db-4991-82e6-451be0636657
There is an option to login with facebook, which then returned the following URL:
https://us.m.lgaccount.com/login/sign_in?country=UK&language=en-EN&svcCode=SVC202&authSvr=oauth2&client_id=LGAO221A02&onyx_feature=N&division=ha&show_select_country=N&show_add_services=N&oauthTokenExpiredFlag=N&os_type=PC&thirdParty=facebook#_=_
Then read somewhere else the details in the wideq.py file needs to be precise, so although I'm in the country UK I set it back to 'PL'. The URL then seemed to work and took my through a menu asking for date of birth and some terms and conditions.
After that I got a page could not be found message.
Followed the link again and got what seemed the correct URL, but when entering got the following:
So at this point I'm stuck.
One additoinal bit of information I'm not sure is relevant I got a warning about a PATH when running the command below:
Be useful for some pointers.
Many thanks in advance