In development: LG SmartThinQ component

Gotcha. My best guess is that your wideq library is not being installed and it’s using the one from pypi and not your custom version. I’m not sure how you have home assistant installed but you may want to check to verify the correct version of wideq.py is installed in your python site-packages directory.

Since home assistant moved away from installing dependencies into /config/deps they are now installed in the system python which makes it a bit trickier to override. For docker I mount my version of wideq.py into the system python site-packages using a volume: - ${USERDIR}/docker/homeassistant/deps/wideq.py:/usr/local/lib/python3.7/site-packages/wideq.py

@ptrsnja, did you see my message above about the fact that the main wideq library now has a customizable country option? Of course, it doesn’t have washer support yet, because nobody has tried to contribute that back…

@fahr I’m using HassIO, so I don’t even get access to a proper CLI. I’m also mostly helpless with python and the terminal in general aside from some basic navigation commands, so I don’t know how I would go about verifying the correct version is installed.

@samps since I’m using HassIO, I don’t know how to get the library to use Canada English as the configuration. If I were more capable or had the time to learn Python, I’d do the lift-and-shift to get washer and dryer support into the main project.

I’d love to get the washer/dryer support merged into the main branch, but most of the code I added is very specific to my washer/dryer and wouldn’t work for everyone. It also needs some refactoring. If I have time I’ll see what sort of effort it might take.

Ok, new here… I am going to place LG airco’s, is this component also used for air-conditioning ? Because I read in first reply, only heat pump ?

Thnx

Yes, it can be used for air-conditioning.

I would love to see the code for the fake light and see if I could fix it

I have the LG DLEX3700v if you want some help refactoring the hass-smartthinq component let me know where I can help.

Thanks for the dev. of this component !!!

I managed to install on Hass.io. Here are the steps for people having issues installing and configuring:

Follow step 1 and first half of step 2 from https://github.com/sampsyo/hass-smartthinq

Then ssh as root to your hass.io installation, then install Python3 with the following commands:

apk add --no-cache python3
pip3 install requests

Then proceed with (use propoer Locale and Country):

python3 example.py -c US -l en-US

And follow the rest of the instructions.

I am having an issue with what seems to be the convertion from F to C (or opposite). If I use “unit_system: metric” in my configuration I can not set the temperature. When using “imperial” it works properly. The conversion made is not “rounded” to the nearest degree…

Here is an example:

Please let me know if someone knows how to fix this !

Thanks

1 Like

Has anyone upgraded to 0.96? Changelog says climate was re-done. I am guessing a breaking change here not sure.

I don’t have an LG climate device, but from looking at the climate 1.0 PR and the hass-smartthinq code, it does look like the custom component will need some changes.

I’ve pushed an updated version for the new climate API.

1 Like

Just upgraded looks fine but i was using @wkd8176 component before so:

A question, the fan mode not appearing in the frontend is that an error fetching the available modes or they just not show up but we can use service calls to change them?

edit: doing a service call doesn’t work to set the fan mode, triggers this trace in the log


2019-07-21 12:56:13 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.139813287375592] 
Traceback (most recent call last):
  File "/srv/hass_storage/apps/virtualenvs/homeassistant/lib/python3.6/site-packages/homeassistant/components/websocket_api/commands.py", line 121, in handle_call_service
    connection.context(msg))
  File "/srv/hass_storage/apps/virtualenvs/homeassistant/lib/python3.6/site-packages/homeassistant/core.py", line 1150, in async_call
    self._execute_service(handler, service_call))
  File "/srv/hass_storage/apps/virtualenvs/homeassistant/lib/python3.6/site-packages/homeassistant/core.py", line 1172, in _execute_service
    await handler.func(service_call)
  File "/srv/hass_storage/apps/virtualenvs/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/entity_component.py", line 194, in handle_service
    required_features
  File "/srv/hass_storage/apps/virtualenvs/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/service.py", line 316, in entity_service_call
    future.result()  # pop exception if have
  File "/srv/hass_storage/apps/virtualenvs/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/service.py", line 337, in _handle_service_platform_call
    await getattr(entity, func)(**data)
  File "/srv/hass_storage/apps/virtualenvs/homeassistant/lib/python3.6/site-packages/homeassistant/components/climate/__init__.py", line 374, in async_set_fan_mode
    await self.hass.async_add_executor_job(self.set_fan_mode, fan_mode)
  File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/srv/hass_storage/apps/virtualenvs/homeassistant/lib/python3.6/site-packages/homeassistant/components/climate/__init__.py", line 370, in set_fan_mode
    raise NotImplementedError()
NotImplementedError

I don’t know what went wrong when i cloned the repo, but looking at the code in cc i realised there weren’t any fan modes in there, but the github repo show them there, i must accidentally deleted or i really don’t know. So i did it again this it worked fine. If the fan is an intermediate state between LOW and MID or MID and HIGH, like this ‘AC_MAIN_WIND_STRENGTH_LOW_MID_W’ then it won’t setup.

So I added this to FAN_MODES

FAN_MODES = {
    'LOW'		: c_const.FAN_LOW,
    'LOW_MID'	: 'low-mid',
    'MID'		: c_const.FAN_MEDIUM,  # Custom modes are supported but these 
    'MID_HIGH'	: 'mid-high',
    'HIGH'		: c_const.FAN_HIGH,   # are fine for now.
}

Is there are better way to this? for future maintenance i mean

We just added fan speeds in this PR:

I don’t know if it’s possible to support those intermediate speeds. Here are the speed settings supported by HA:

Could be worth experimenting to see if any workaround exists that other devices are using.

Is anyone having problems with AC units getting constantly unregistered from the smarthinq platform?

1 Like

yep same thing here subzero79 wtf

Where can I get a list of Country/ Language codes?

I’m using an LG Aircon in Thailand, app is in English.

I’ve tried;

$ python3 example.py -c TH -l en-US
$ python3 example.py -c US -l en-US

Both give me a page not found error and when I paste that redirected URL back into the cmd line I get nothing usable and the json file doesn’t seem to be created.

Thanks

Managed to get it to work, deleted the devices and account, set it up with a new one NOT using Google account to sign in but instead setting a password, this way retrieved the code without issue.

The component isn’t working though, I’m getting the following error…

Log Details (ERROR) Thu Jul 25 2019 07:35:07 GMT+0700 (Indochina Time) Error while setting up platform smartthinq Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 126, in _async_setup_platform SLOW_SETUP_MAX_WAIT) File "/usr/local/lib/python3.7/asyncio/tasks.py", line 442, in wait_for return fut.result() 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 48, in setup_platform client = wideq.Client.from_token(refresh_token, country, language) File "/usr/local/lib/python3.7/site-packages/wideq/client.py", line 220, in from_token client.refresh() File "/usr/local/lib/python3.7/site-packages/wideq/client.py", line 203, in refresh self._auth = self.auth.refresh() File "/usr/local/lib/python3.7/site-packages/wideq/core.py", line 282, in refresh self.refresh_token) File "/usr/local/lib/python3.7/site-packages/wideq/core.py", line 231, in refresh_auth raise TokenError() wideq.core.TokenError

I don’t know if there is one! I haven’t seen any place where the LG API publishes a complete list of options.

what Country are you and do you have an ac?

Edit: guessing by your nick are you in nz right? I am in Australia. Talked yesterday to lg support(which is shared with nz and au), they have no idea about smarthinq, don’t have any info on what goes on the platform.

Yesterday i created a nodered flow to mimic the wideq library. Left it overnight querying the lg api servers every 90 minutes I started at 9:00 pm and by 4am I got a notification the device wasn’t there any more. That means it took 3-4 access tokens to get the device removed.

When using the platform in ha, within 30-60 minutes the device gets unregistered. Lg must be identifying non-phone users. Registered the ac again this morning we’ll see if it goes away without using anything third party

I know the app got updated recently. Also I noticed the ac firmware also got updated because the pairing ssid is now different from the time of purchase.

@samps have you seen anything like this before ?

No, I haven’t seen that! In fact, it does not seem to have happened to my account—despite having HA running and polling as usual, the devices are still there.

I wonder what’s in common between the accounts where this has happened…