In development: LG SmartThinQ component

Can you post the whole exception, including the backtrace?

smartthinq: Error on device update!
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 319, in _async_add_entity
    await entity.async_device_update(warning=False)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 466, in async_device_update
    self.update  # type: ignore
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/smartthinq/climate.py", line 284, in update
    self.check_power()
  File "/config/custom_components/smartthinq/climate.py", line 253, in check_power
    power = self._ac.get_power()
  File "/usr/local/lib/python3.7/site-packages/wideq/ac.py", line 299, in get_power
    value = self._get_config('InOutInstantPower')
  File "/usr/local/lib/python3.7/site-packages/wideq/client.py", line 433, in _get_config
    key,
  File "/usr/local/lib/python3.7/site-packages/wideq/core.py", line 492, in get_device_config
    'data': '',
  File "/usr/local/lib/python3.7/site-packages/wideq/core.py", line 394, in post
    return lgedm_post(url, data, self.auth.access_token, self.session_id)
  File "/usr/local/lib/python3.7/site-packages/wideq/core.py", line 213, in lgedm_post
    raise APIError(code, message)
wideq.core.APIError: ('0111', '제품 응답 지연')

After my manual upgrade of refresh token it starts to work, but after some time I get the error again(

I installed the integration through HACS. Maybe the problem is connected with access permissions? (Lg component can not get a new refresh token) Or the component does not need it?

After recent Hassio installation I’m trying to set up smartthinq component for integrating AC. However, AC does not show up in the device list. Couldn’t see any errors in the HA debug log. In addition, when original wideq library is used, “python3 example.py ls” returns nothing. But wideq package by gladhorn successfully lists LG AC’s ID and device name.

And “python3 example.py mon ID” (with actual ID) says

NameError: name 'lgedm_post" is not defined

Any ideas how solve this problem?

2 Likes

Add the following import to the core_v2.py on line 13:

from .core import lgedm_post

Running example.py, can successfully get my device Id but then getting 404 on all subsequent requests.
For example:
Request to https://aic-service.lgthinq.com:46030/v1/rti/rtiControl
returns
{'timestamp': 1596054738389, 'status': 404, 'error': 'Not Found', 'message': 'No message available', 'path': '/v1/rti/rtiControl'}

I added the line, now I am receiving

KeyError: ‘lgedmRoot’

Suggestions?

1 Like

I found that most of API commands have to go to https://aic.lgthinq.com:46030/api, the authentication still happens at https://aic-service.lgthinq.com:46030/v1/.
Both URLs have been returned from the server but for some reason only second was used.
I made changes to use both and use session to authenticate to the first URL. Now everything is working. Trying to figure out where to post the patch.

Hello Craig.
Can you remember how you did this exactly?
I have had only one AC unit which was working fine with this component. Since yesterday I have three AC units and only the first one is showing up in HA.
Reinstalling the component did not change anything.

Thank you

Hi,
I have installed the HACS and added the integration.
Now when I am adding the integration in the HA, I am stuck at the page “SmartThinkQ LGE Sensors - Authentication” … what is the redirection URL I am supposed to use??
Please guide

I described how it worked for me previously but since then it occasionally drops one of the two units. I then try one of two things.

1.power down the unit (using the circuit breaker)
2 reboot everything, including the router

These 2 have always brought things back online

I have also disconnected lg smartthinq from Google Assistant and instead use climate in GA within HA

Did you got a solution for this?

No, I thought I’d give it a couple months and come back to it to see if it had been addressed yet.

Let me do a summary of what I got from all this LG AirCon (AC) component thing.

Some of our AC, i believe the newer ones, are connected by LG only through LG’s API v2, so, if you use anything that only connects to LG’s API v1, you AC wont show. (This is a crap implementation of new api versions, but we take what we can get.)

The implementations of integration solutions for LG AC with HASS I found are all based on the work of Sampsyo / wideq, which only implements LG’s API v1.

So, some of us will only see their AC on api v2, for now, using Samsyo / wideq version will work but will not show our AC.

Gladhorn evolved Samsyo / wideq to connect to LG’s API v2, but, although we can list our AC and it used to work up until some weeks ago, it now shows this lgedmRoot errors. Once you patch some part, it shows up in another point of the code.

Being a non-python programmer, and learning from my professional experience, I believe its a bad idea to try and fix code on my side if someone else is maintaining it. This is the case for Samsyo / wideq, up until a month ago.

Enters ollo69 and his own changes to wideq. Smasyo and Ollo69 started a change, still in the work, that would integrate Ollo69 work into the main brunch of the code with Samsyo.

But boys, do I get bad news for you: work stalled a few time ago and doesnt seem to move.

Also, if you look closely into https://github.com/ollo69/wideq/network, you will find a bunch more branches to this tree, like, for instante this patch that doesnt work (tested it myself) https://github.com/pneumaticdeath/wideq/commit/27d5ccf8820e55b9d07df585b38793f86f66f3b7

So, either this gets a top management to gather all this guys into one team, sorting out the ones that know how to program in python from the scripty-kids (Stackexchange copy and pasters like me) or we wont ever have a integration done.

2 Likes

This is how open source works unless people are getting paid. People scratch their own itches first. If the various developers aren’t motivated to reconcile their forks it won’t happen. As an end user you fix it yourself, offer to pay or live without.

1 Like

Hey, I’m in the process of finishing my apartment and need to decide what AC to use.
I definitely want an AC to integrate well with HA (at least setting and reading AC’s state).

Looking at this thread, LG does not sound like a good choice to buy?
Any recommendations?

Do you have a list of where you made these changes? - I can’t find reference to these URL’s anywhere in the existing code…

Trying to resolve the lgedmRoot errors for my AC.

1 Like

Anything by Gree Electric (or anything that uses the same Wi-Fi chips) should integrate nicely with this HACS integration.

1 Like

Do not buy LG. Their API support totally sucks. I am regretting that I bought LG. Would opt for Samsung next time, as they have an open API.

4 Likes

Has anyone been able to install this recently? I am able to add in HACS and restart but when I try to add it to HA it doesn’t show up in the list or by search. As a result I am never able to run the configuration to link my LG account and create the token. HA 0.117.1

Have all LG appliances and would love to get this working.

Make sure to do a force refresh while on the page. Typically this is holding the Shift key while pressing the reload button in the browser. It’s likely not showing up due to browser cache.