In development: LG SmartThinQ component

Hey, I’ve been trying to get this component to work on my hass as well. However, I cannot get example.py of wideQ to give me a working output.

Anyone has an idea what I is going wrong here?

This is the error output example.py returns:

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.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: UNSUPPORTED_PROTOCOL] unsupported protocol (_ssl.c:1056)

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='aic.lgthinq.com', port=46030): Max retries exceeded with url: /api/member/login (Caused by SSLError(SSLError(1, '[SSL: UNSUPPORTED_PROTOCOL] unsupported protocol (_ssl.c:1056)')))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "example.py", line 225, in <module>
    main()
  File "example.py", line 221, in main
    example(args.country, args.language, args.cmd, args.args)
  File "example.py", line 181, in example
    example_command(client, cmd, args)
  File "example.py", line 157, in example_command
    func(client, *args)
  File "example.py", line 26, in ls
    for device in client.devices:
  File "/home/homeassistant/.homeassistant/custom_components/smartthinq/wideq/wideq/client.py", line 123, in devices
    self._devices = self.session.get_devices()
  File "/home/homeassistant/.homeassistant/custom_components/smartthinq/wideq/wideq/client.py", line 114, in session
    self._session, self._devices = self.auth.start_session()
  File "/home/homeassistant/.homeassistant/custom_components/smartthinq/wideq/wideq/core.py", line 273, in start_session
    self.gateway.country, self.gateway.language)
  File "/home/homeassistant/.homeassistant/custom_components/smartthinq/wideq/wideq/core.py", line 191, in login
    return lgedm_post(url, data)
  File "/home/homeassistant/.homeassistant/custom_components/smartthinq/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='aic.lgthinq.com', port=46030): Max retries exceeded with url: /api/member/login (Caused by SSLError(SSLError(1, '[SSL: UNSUPPORTED_PROTOCOL] unsupported protocol (_ssl.c:1056)')))

This sort of thing usually indicates that there’s a problem with your system, its SSL certificates, or your Python installation (but it doesn’t reveal much about exactly what). You might try reinstalling Python.

So is your add on still working for you @samps?

Yes, it is.

OK, strange, I’ll try to set it up again, for me, it works for a few hours then I loose the devices in the SmartThinq app and I have to set them up again, I tried it several times with the same issue

Would it be possible for someone to build a HACS compatible repo of this component?

2 Likes

Thanks that you working on that integration.

But i’ve run in some trouble. Actually i use Homeassistant v0.99.1
Genereting a refresh token works:

bash-5.0# python3 example.py -c DE -l de-DE                                                                                                                                                                                                                                                 
Log in here:                                                                                                                                                                                                                                                                                
https://de.m.lgaccount.com/login/sign_in?country=DE&language=de-DE&svcCode=SVC202&authSvr=oauth2&client_id=LGAO221A02&division=ha&grant_type=password                                                                                                                                       
Then paste the URL where the browser is redirected:                                                                                                                                                                                                                                         
https://de.m.lgaccount.com/login/iabClose?access_token=bba840d3700344413585ff4ea14af0d44f33d38d4ad2bf828d5c62a0b35f756a9a3a4b703715bbadd8f1134b7456e940&refresh_token=dedadac3209ce9335c50ca8d4badbfa361271784a19686404d928f34a0e5d5ad65c413cdd97e94a17dab9cb1dfda0869&oauth2_backend_url=ht
tps://gb.lgeapi.com/                                                                                                                                                                                                                                                                        
9d633750-3310-11e9-97bd-0051edded027: WASCHMASCHINE (WASHER WTWN3) 
#
#
 cat custom_components/wideq/wideq_state.json
{"model_info": {}, "gateway": {"auth_base": "https://de.m.lgaccount.com", "api_root": "https://eic.lgthinq.com:46030/api", "oauth_root": "https://de.lgeapi.com", "country": "DE", "language": "de-DE"}, "auth": {"access_token": "bba840d3700344413585ff4ea14af0d44f33d38d4ad2bf828d5c62a0b35f756a9a3a4b703715bbadd8f1134b7456e940", "refresh_token": "dedadac3209ce9335c50ca8d4badbfa361271784a19686404d928f34a0e5d5ad65c413cdd97e94a17dab9cb1dfda0869"}, "session": "B77AD6801C1D384C9F2662532E0E2BB3.nodes_sadap_10", "country": "DE", "language": "de-DE"}

My configuration include this:

smartthinq:
  token: dedadac3209ce9335c50ca8d4badbfa361271784a19686404d928f34a0e5d5ad65c413cdd97e94a17dab9cb1dfda0869
  region: DE
  language: de-DE

But home assistant throw some errors:

2019-09-21 10:05:35 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform smartthinq.sensor: Platform not found (cannot import name 'dishwasher' from 'wideq' (/usr/local/lib/python3.7/site-packages/wideq/__init__.py)).

Have someone an idea? Whats wrong?

Looks like you have an old version of wideq; you’ll want to get the latest version.

I’m having the same problem. I’m using Hassio. How do I update my wideq version?
I tried downloading from git and copying it to that directory but it didn’t work.

Same for me.
Is there an other way to get the latest version?

I was looking in the docker container and I notice the wideq versions up on PyPI don’t have dishwasher.py but the ones on github do:

No dishwasher.py in the package:

Has it in the directory:

I have now published version 1.2.0 from the latest master.

1 Like

Any chance of monitoring an LG refrigerator with this component? I would be willing to share my credentials if you promise not to make my ice cream melt. :stuck_out_tongue:

Installed the new version but it is only picking up one of two devices, anything I need to add for secondary device?

Thank you

Is there any special setup that needs to happen to control the wind vanes for heat pump? I have this component working and setup with the climate card, but only have the ability to change temp, mode, and fan level. I see WideQ ac.py has additional functionality like swing modes.

Anyone have any advice?

I’ve been trying to follow along with the progress as I have an LG refrigerator… Does the HVAC or dishwasher have an energy monitoring component like the fridges? If so, is anyone working on it for HA?

@samps great work on WideQ and this component! It seems WideQ supports dryers (which i have) would i need to extend “sensors.py” to add support for it?

p.s. a pull request is opened by me to align the device init between climate.py and sensor.py :slight_smile:

Yeah! And I hope that shouldn’t be too hard. Please feel free to give it a shot.

I am having a devil of a time trying to get this to work. I have tried several versions of wideq and the example.py never returns any device information. I even tried a new account but it never finds my washer nor dryer. I don’t even get an error, just a file with no model numbers.

Is there anything else I can try to troubleshoot what may be going on? Would love to get this to work. Hassio.

Edit: I am now seeing other people on GitHub saying that newer washers and dryers in the last month are missing as well.