In development: LG SmartThinQ component


#83

Got a bit further:
Tue Oct 30 2018 22:42:05 GMT+0100 (Central European Standard Time)

Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/aiohttp/web_protocol.py", line 390, in start
    resp = await self._request_handler(request)
  File "/usr/local/lib/python3.6/site-packages/aiohttp/web_app.py", line 366, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.6/site-packages/aiohttp/web_middlewares.py", line 106, in impl
    return await handler(request)
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/http/static.py", line 66, in staticresource_middleware
    return await handler(request)
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/http/real_ip.py", line 34, in real_ip_middleware
    return await handler(request)
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/http/ban.py", line 66, in ban_middleware
    return await handler(request)
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/http/auth.py", line 97, in auth_middleware
    return await handler(request)
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/http/real_ip.py", line 34, in real_ip_middleware
    return await handler(request)
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/http/ban.py", line 66, in ban_middleware
    return await handler(request)
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/http/auth.py", line 97, in auth_middleware
    return await handler(request)
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/http/view.py", line 113, in handle
    result = await result
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/config/core.py", line 21, in post
    errors = await async_check_ha_config_file(request.app['hass'])
  File "/usr/local/lib/python3.6/site-packages/homeassistant/config.py", line 796, in async_check_ha_config_file
    check_ha_config_file, hass)
  File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.6/site-packages/homeassistant/scripts/check_config.py", line 372, in check_ha_config_file
    platform = loader.get_platform(hass, domain, p_name)
  File "/usr/local/lib/python3.6/site-packages/homeassistant/loader.py", line 60, in get_platform
    return get_component(hass, PLATFORM_FORMAT.format(domain, platform))
  File "/usr/local/lib/python3.6/site-packages/homeassistant/loader.py", line 92, in get_component
    module = importlib.import_module(path)
  File "/usr/local/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/config/custom_components/sensor/smartthinq_washer.py", line 42, in <module>
    'INITIAL': wideq.STATE_WASHER_INITIAL,
AttributeError: module 'wideq' has no attribute 'STATE_WASHER_INITIAL'

I think it might have something to do with my wideq. How do I install it properly?


#84

Have you set up wideq i uploaded?
Or just use what you have?
You need to install wideq that i uploaded.
Or i think you may set up wideq wrong way

pip3 install -e .

Please follow readme.


#85

Thats probably it. I’m on Hass.io, so I have to ssh and run it inside the docker image. But that will be gone after a new release of hassio. Sad, but that’s the way it goes. Isn’t there any other way of getting this to run?


#86

Hallo,

I’m using hassio…and I can’t run pip3 install -e .
How can I do it please?

Thank you.


#87

Sorry I don’t know how to use hassio
I’m using home assistant with synology docker.
So i use docker teminal and set up wideq


#88

I’ve forked it, and I will try to make a PyPI package out of it. Translation is underway.
Been years since I’ve touched Python, so it make take some time.


#89

Instead of just publishing your fork to PyPI, can you please just submit pull requests back to my repository? (Unless you have a specific reason for starting a fork.)


#90

If you see the fork I have forked from, it’s a complete revamp. It does not even look like a fork. wkd8176 has rewritten it almost completely.


#91

Yes! And I would love to help reconverge to avoid duplicating work.


#92

PM’ed you.


#93

EDIT:Below problem worked out: I’m in Australia and the second wideq was trying to log into US server. Sorted. Now however it seems HA can read from the unit (temp & function updates in line with the wall controller) but I can not issue commands. I will keep digging…

Excellent work in here guys. I’m a complete noob so sorry for any eye roll inducing errors here. I’m getting a token error reported as per the log below, however wideq example.py can successfully see my device (AirCon). Any thoughts as to what is happening?

raceback (most recent call last):
File “c:\users\study\homeassistant\lib\site-packages\homeassistant\helpers\entity_platform.py”, line 128, in _async_setup_platform
SLOW_SETUP_MAX_WAIT, loop=hass.loop)
File “C:\Users\Study\AppData\Local\Programs\Python\Python36-32\lib\asyncio\tasks.py”, line 358, in wait_for
return fut.result()
File “C:\Users\Study\AppData\Local\Programs\Python\Python36-32\lib\concurrent\futures\thread.py”, line 56, in run
result = self.fn(*self.args, **self.kwargs)
File “C:\Users\Study\AppData\Roaming.homeassistant\custom_components\climate\smartthinq.py”, line 34, in setup_platform
client = wideq.Client.from_token(refresh_token)
File “c:\users\study\homeassistant\lib\site-packages\wideq.py”, line 561, in from_token
client.refresh()
File “c:\users\study\homeassistant\lib\site-packages\wideq.py”, line 547, in refresh
self._auth = self.auth.refresh()
File “c:\users\study\homeassistant\lib\site-packages\wideq.py”, line 270, in refresh
self.refresh_token)
File “c:\users\study\homeassistant\lib\site-packages\wideq.py”, line 223, in refresh_auth
raise TokenError()
wideq.TokenError

My Token looks like this 3dd9f1f710071833b81af9629a9d2a8333fb54dxxxxxxxxxxxxxxxxxxxxxxxxx2776f09d71f5bedd1e03c623377638df obviously redacted
Im using a Python venv, which complicated the wideq install. I installed it on my machine (Win10) and ran example.py but then had to also download it through HA in the venv by editing the smartthinq.py to point to the git .zip . Does it need to have the generated JSON file available to it as well as the token in the config?


#94

Sorry samps.
I want to pull request on your repository,
but there is many differences between korean model and world model, so i can’t just pull this your repository. It may doesn’t work other contries.(I translate many names in korean)
But if you want, i will pull request wideq file


#95

1000 Tak !!! Thanks alot. that worked perfectly! :grinning:


#96

Trying to get this to work with hassio, any tips or pointers would be great. Using a standalone Ubuntu I was able to use wkd8176 to get my fridge in the json file, but now trying to play with the hassio is not fun. lookin like making my own addon


#97

Also wondering the same thing. I too am using Hassio and I am not sure where to install this.

It looks like in my case, components are installed here:
/var/lib/docker/overlay2/5e53eeb6502d596ec2ce43edbdaddfa56565cb4a48a299017c1d478fa76bd42d/diff/usr/local/lib/python3.6/site-package

So i went ahead and installed wideq there. Then, I installed the HA component in /usr/share/hassio/homeassistant/custom_components/climate

When I add the climate component, I get these error messages in home-assistant.log:

2018-11-25 13:11:10 INFO (SyncWorker_2) [homeassistant.util.package] Attempting install of wideq
2018-11-25 13:11:12 ERROR (SyncWorker_2) [homeassistant.util.package] Unable to install package wideq: Could not find a version that satisfies the requirement wideq (from versions: )
No matching distribution found for wideq
You are using pip version 18.0, however version 18.1 is available.
You should consider upgrading via the ‘pip install --upgrade pip’ command.
2018-11-25 13:11:12 ERROR (MainThread) [homeassistant.requirements] Not initializing climate.smartthinq because could not install requirement wideq
2018-11-25 13:11:12 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform climate.smartthinq: Could not install all requirements.


#98

Hi Phellarv,

would it be possible to use your wideq in hassio with something like this in the smartthinq.py component?

REQUIREMENTS =['https://github.com/phellarv/wideq/archive/master.zip#wideq']

That way testing would be much easier… (the token of course has to be generated somewhere else)

Thanks!


#99

Hi

I changed to hassbian and herre the integration seems to be able to connect to my LG AC.

I get the current setup, temperature etc. but it seems that the control are not working 100%, i can change between the different modes (heat, cold etc) but the temperature selection are not sent or accepted by the AC.


#100

ive shifted to hassbian, and still struggling following the instructions at the wkd8176 fork.


#101

Looks like the instructions need some work, the one by @wkd8176 gives me config error, changed refresh_token for token to pass the check

smartthinq:
  token: 9ea82138XXXXXX

climate:
 - platform: smartthinq_hvac

From the logs looks like a timeout, but the AC polled nickname is correct, if I change it, then the new name appears in the log.

2018-12-03 09:11:59 INFO (MainThread) [homeassistant.components.notify] Setting up notify.ios
2018-12-03 09:12:01 INFO (MainThread) [homeassistant.setup] Setup of domain media_player took 3.1 seconds.
2018-12-03 09:12:03 INFO (MainThread) [homeassistant.setup] Setup of domain smartthinq took 6.1 seconds.
2018-12-03 09:12:03 INFO (MainThread) [homeassistant.components.climate] Setting up climate.smartthinq_hvac
2018-12-03 09:12:13 WARNING (MainThread) [homeassistant.components.climate] Setup of platform smartthinq_hvac is taking over 10 seconds.
2018-12-03 09:12:17 INFO (SyncWorker_0) [custom_components.climate.smartthinq_hvac] Updating AIR CONDITIONER.
2018-12-03 09:12:17 INFO (SyncWorker_0) [custom_components.climate.smartthinq_hvac] Polling...
2018-12-03 09:12:20 INFO (SyncWorker_0) [custom_components.climate.smartthinq_hvac] No status available yet.
2018-12-03 09:12:21 INFO (SyncWorker_0) [custom_components.climate.smartthinq_hvac] Polling...
2018-12-03 09:12:24 INFO (SyncWorker_0) [custom_components.climate.smartthinq_hvac] No status available yet.
2018-12-03 09:12:26 INFO (SyncWorker_0) [custom_components.climate.smartthinq_hvac] Polling...
2018-12-03 09:12:30 INFO (SyncWorker_0) [custom_components.climate.smartthinq_hvac] No status available yet.
2018-12-03 09:12:34 INFO (SyncWorker_0) [custom_components.climate.smartthinq_hvac] Polling...
2018-12-03 09:12:37 ERROR (MainThread) [homeassistant.components.climate] Error while setting up platform smartthinq_hvac
Traceback (most recent call last):
  File "/opt/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py", line 128, in _async_setup_platform
    SLOW_SETUP_MAX_WAIT, loop=hass.loop)
  File "/usr/local/lib/python3.6/asyncio/tasks.py", line 358, in wait_for
    return fut.result()
  File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/homeassistant/.homeassistant/custom_components/climate/smartthinq_hvac.py", line 205, in setup_platform
    hvac_entity = LGEHVACDEVICE(client, device)
  File "/home/homeassistant/.homeassistant/custom_components/climate/smartthinq_hvac.py", line 282, in __init__
    self.update()
  File "/home/homeassistant/.homeassistant/custom_components/climate/smartthinq_hvac.py", line 602, in update
    state = self._ac.poll()
  File "/home/homeassistant/tmp/wideq/wideq.py", line 1340, in poll
    return ACStatus(self, res)
NameError: name 'res' is not defined
2018-12-03 09:12:37 INFO (MainThread) [homeassistant.setup] Setup of domain climate took 39.6 seconds.
2018-12-03 09:12:37 INFO (MainThread) [homeassistant.bootstrap] Home Assistant initialized in 41.83s

the wideq.py file was adapted to en-AU


#102

I managed at the end to use the original component by @samps, i have also the same problem so I changed line 44 to:

def __init__(self, client, device, fahrenheit=False):\

Looks like is trying to send the temp in F, instead of C