Home Assistant Community

In development: LG SmartThinQ component

#184

@wkd8176 do you think it would be possible to add to the op mode “off” so it displays off when using HomeKit.
ATM if the ac is on HomeKit displays the current mode that makes the unit show as on. I know the api returns the running op mode even if the unit is off.
Some ha platforms don’t have on/off switch just the mode for state.

0 Likes

#186

It would be…
Mine is work on/off and temp change on HA native bridged homekit and nothing changed my repo

0 Likes

#187

I corrected that. If ac is off, hk displays the state as on, as it takes from the op mode

0 Likes

#188

You’re right I was using the old ha homebridge plug-in. Using ha directly works as expected.

0 Likes

#189

Can this be used with HassOS? Is there an addon for it?

0 Likes

#190

I don’t know. I don’t use hassos

0 Likes

#191

It’s working for me with Hass.io and HassOS, the main problem was to create the custom component and add the wineq dependency but I was able to do it with the “Custom deps deployment” add-on

0 Likes

#192

I think I’ve got everything setup properly but how do I get the token? That’s the only thing I can’t figure out.

0 Likes

#193

Follow the instructions in https://github.com/sampsyo/hass-smartthinq
You need to run the python script to get the token. However, if you are not in the US, like it was my case, before running the script change the country in wideq.py

0 Likes

#194

How do I run the python script with just HassOS installed though? I didn’t use docker or anything I just installed HassOS directly to my nuc.

0 Likes

#195

That’s locally, on your computer. It’s just to get the token, you don’t need to run it in your HA installation. You need the token for the configuration.yaml

0 Likes

#196

how i can use it in hass.io ?

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 19.0.2, however version 19.0.3 is available.
You should consider upgrading via the ‘pip install --upgrade pip’ command.

0 Likes

#197

finally got my token but now im having an issue with an error

Component not found: smartthinq

in my config i have

smartthinq:
  token: MY_TOKEN

then i have the files

pycache
smartthinq_dryer.py
smartthinq_washer.py

inside of

homeassistant/custom_components/sensors/

i added this to my sensors

  - platform: smartthinq_dryer
    name: Dryer
    mac: MY_MAC
    
  - platform: smartthinq_washer
    name: Washer
    mac: MY_MAC

then i click check config and i get component not found.

0 Likes

#198

this dont help me … lokks like find nothing to install
[Info] Remove old deps
[Info] Install pypi modules into deps
[Info] done

0 Likes

#199

Hi. I have an LG Smartthinq washer and dryer that don’t seem to match any of the models currently working with the various forks of this project.

Would it be helpful to provide the API information for these devices? I can export them with @wkd8176’s wideq version but I don’t want to pile useless data onto an already very long thread.

Please let me know if this data would be of use. Thanks for all your efforts!

0 Likes

#200

look in your \deps\lib\python3.6\site-packages folder and see if it created a wideq.py file there. If so then im pretty sure it did its job.

1 Like

#201

Hey guys, lots of usefull tips in here already!

I have a LG AC with smartthinq and I run hassio and I managed to get the token by modifying wideq.py to my country. Next step was to include wideq.py in my hassio install which also worked out with the Custom deps deployment addon. I verified this by checking \deps\lib\python3.6\site-packages

I created a folder .homeassistant/custom_component, gave it 777 rights and cloned into climate by:

git clone https://github.com/sampsyo/hass-smartthinq.git climate

I gave everything in the folder climate 777 rights as well.

In my config I have:

smartthinq:
  token: xxxx
climate:
 - platform: smartthinq

I keep seeing the following error in the log:

2019-02-24 17:51:32 ERROR (MainThread) [homeassistant.components.hassio] INFO:homeassistant.util.package:Attempting install of colorlog==4.0.2
Testing configuration at /config
Failed config
General Errors:
- Component not found: smartthinq
- Platform not found: climate.smartthinq

Successful config (partial)

My folder structure looks like:

├── custom_components
│ └── climate
│ ├── LICENSE
│ ├── README.md
│ └── smartthinq.py

So seems like home assistant can’t find my smartthinq component. I don’t understand why? Do any of you have an idea?

Maybe we could update the readme with a hassio section as there seems to be some confusion among users. I’d be willing to do that!

0 Likes

#202

Hi, I have a washer and dryer also but I haven’t started to integrate the device into my HA yet. Your API information (and others) would be very useful for me. Could you share your setup with me please?Thank you in advance! :slight_smile:

0 Likes

#203

did you ever get this figured out? Im stuck in the same spot

0 Likes

#204

I did get further yes! I’m also active here where I’m trying to figure it out now: https://www.reddit.com/r/homeassistant/comments/auwptn/smartthinq_wideq_dependency/

Summary:

First of all, in hassio the custom_components needs to be in the same folder as config. Not in .homeassistant but in homeassistant without the dot!

Next thing in the wideq package which cannot be installed on hassio because it is not available on pypi.
Workaround: edit smartthinq.py:
REQUIREMENTS = [“https://github.com/sampsyo/wideq/archive/master.zip#wide1==0.0.1”]

Then I ran into a problem that I have to change my country-code in wideq and when using this workaround the wideq file is downloaded every restart. Therefore I made a fork of this repo with my own countrycode and used this link.

Now wideq is being loaded but I get the following errors which I’m still trying to figure out:

Error while setting up platform smartthinqTraceback (most recent call last):
File “/usr/local/lib/python3.7/site-packages/urllib3/connection.py”, line 159, in _new_conn (self._dns_host, self.port), self.timeout, **extra_kw)
File “/usr/local/lib/python3.7/site-packages/urllib3/util/connection.py”, line 57, in create_connection for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
File “/usr/local/lib/python3.7/socket.py”, line 748, in getaddrinfo for res in _socket.getaddrinfo(host, port, family, type, proto, flags): socket.gaierror:
[Errno -3]
Try again During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py”, line 600, in urlopen chunked=chunked)
File “/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py”, line 343, in _make_request self._validate_conn(conn)
File “/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py”, line 839, in _validate_conn conn.connect() File “/usr/local/lib/python3.7/site-packages/urllib3/connection.py”, line 301, in connect conn = self._new_conn() File “/usr/local/lib/python3.7/site-packages/urllib3/connection.py”, line 168, in _new_conn self, “Failed to establish a new connection: %s” % e) urllib3.exceptions.NewConnectionError: <urllib3.connection.VerifiedHTTPSConnection object at 0x7fdd28829588>:
Failed to establish a new connection: [Errno -3]

Try again During handling of the above exception, another exception occurred: Traceback (most recent call last):
File “/usr/local/lib/python3.7/site-packages/requests/adapters.py”, line 449, in send timeout=timeout
File “/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py”, line 638, in urlopen _stacktrace=sys.exc_info()[2]) File “/usr/local/lib/python3.7/site-packages/urllib3/util/retry.py”, line 398, in increment raise MaxRetryError(_pool, url, error or ResponseError(cause)) urllib3.exceptions.MaxRetryError:
HTTPSConnectionPool(host=‘kic.lgthinq.com’, port=46030): Max retries exceeded with url: /api/common/gatewayUriList (Caused by NewConnectionError(’<urllib3.connection.VerifiedHTTPSConnection object at 0x7fdd28829588>:
Failed to establish a new connection:
[Errno -3] Try again’)) During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “/usr/local/lib/python3.7/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.7/asyncio/tasks.py”, line 416, 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/climate/smartthinq.py”, line 34, in setup_platform client = wideq.Client.from_token(refresh_token)
File “/config/deps/lib/python3.7/site-packages/wideq.py”, line 569, in from_token client._auth = Auth(client.gateway, None, refresh_token)
File “/config/deps/lib/python3.7/site-packages/wideq.py”, line 468, in gateway self._gateway = Gateway.discover()
File “/config/deps/lib/python3.7/site-packages/wideq.py”, line 244, in discover gw = gateway_info()
File “/config/deps/lib/python3.7/site-packages/wideq.py”, line 148, in gateway_info {‘countryCode’: COUNTRY, ‘langCode’: LANGUAGE},
File “/config/deps/lib/python3.7/site-packages/wideq.py”, line 124, in lgedm_post res = requests.post(url, json={DATA_ROOT: data}, headers=headers)
File “/usr/local/lib/python3.7/site-packages/requests/api.py”, line 116, in post return request(‘post’, url, data=data, json=json, **kwargs)
File “/usr/local/lib/python3.7/site-packages/requests/api.py”, line 60, in request return session.request(method=method, url=url, **kwargs)
File “/usr/local/lib/python3.7/site-packages/requests/sessions.py”, line 533, in request resp = self.send(prep, **send_kwargs)
File “/usr/local/lib/python3.7/site-packages/requests/sessions.py”, line 646, in send r = adapter.send(request, **kwargs)
File “/usr/local/lib/python3.7/site-packages/requests/adapters.py”, line 516, in send raise ConnectionError(e, request=request) requests.exceptions.ConnectionError: HTTPSConnectionPool(host=‘kic.lgthinq.com’, port=46030):
Max retries exceeded with url: /api/common/gatewayUriList (Caused by NewConnectionError(’<urllib3.connection.VerifiedHTTPSConnection object at 0x7fdd28829588>:
Failed to establish a new connection: [Errno -3] Try again’))

0 Likes