In development: LG SmartThinQ component

I’m not able to use pypi/custom deps in this way on hassio. Is there something wrong with the configuration.

@insajd Silly question but, is your washer on and connected to wifi?

Also make sure you have the proper country set in wideq.py for your region

@ukgrant that same config worked fine for me.

@knackrack615 I’m getting the following traceback, which seems (from reading through the wideq.py code) that it might have something to do with the washer model number.

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py", line 352, in _async_add_entity
    await entity.async_update_ha_state()
  File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 239, in async_update_ha_state
    attr = self.state_attributes or {}
  File "/config/custom_components/sensor/smartthinq_washer.py", line 180, in state_attributes
    data[ATTR_CURRENT_COURSE] = self.current_course
  File "/config/custom_components/sensor/smartthinq_washer.py", line 252, in current_course
    course = self._state.current_course
  File "/config/deps/lib/python3.6/site-packages/wideq.py", line 1075, in current_course
    course = self.lookup_reference('Course')
  File "/config/deps/lib/python3.6/site-packages/wideq.py", line 1025, in lookup_reference
    return self.washer.model.reference_name(key, self.data[key])
KeyError: 'Course' 

Did you make any modifications that are specific to your washer model anywhere?

When I ran example.py and did the login, the model number that came back for my washer was: F3L2CYV5W_WIFI.

It’s an LG WM3700HWA washer for whatever that’s worth.

No modifications other than removing APCourse, try running the example.py with the mon arg and look at the dump file, maybe your washer calls ‘Course’ something else

@ukgrant I had the same problem that you had, probably something with https connection occurring. I manually did a git clone of the repo into /usr/share/hassio/homeassistant/wideq and then I did the config as such and it worked.

{
  "pypi": [
    "/config/wideq"
  ],
  "apk": []
}

You can verfiy it worked by doing the following command and you should see wideq.py there.
ls -l /usr/share/hassio/homeassistant/deps/lib/python3.6/site-packages

@knackrack615 yes I am using your branch, at least for the test above that I was doing. I don’t see “APCourse” listed anywhere in wideq in your branch, so I’m guessing the washer is providing that code somewhere and the wideq.py doesn’t know how to handle it. I am in the US so the US country code should work for what I am trying to do.

My Washer is an LG WT7200CV
Example.py says it is WASHER (WASHER T1772HDFV_F)

Interesting, maybe try using the original branch by @wkd8176 and replace the states for your washer (You can dump them with example.py mon washerid)

I’m not sure what’s the issue with my machine, I put all the code and have this in log:

2018-12-11 15:50:58 DEBUG (SyncWorker_3) [custom_components.sensor.smartthinq_washer] Creating new LGE Washer
2018-12-11 15:51:00 INFO (SyncWorker_3) [custom_components.sensor.smartthinq_washer] Connection Lost. Retrying.
2018-12-11 15:51:00 WARNING (MainThread) [homeassistant.components.sensor] Platform smartthinq_washer not ready yet. Retrying in 30 seconds.

Washer doesn’t connect wifi except when it works.
If you run washer, it goes right .

@knackrack615 @wkd8176 you’re right guys, got home, turned on the washer and it started to work :slight_smile: My washer model is F2J7HG2W.

Side note. It’s so incredibly dumb that you can’t keep a “smart” LG washer/dryer on all the time. If anyone has found a way to override this and keep them on constantly, please share here. Otherwise it appears they turn off on their own within an hour of no activity, or at the end of a cycle.

Nope, no way. Infact mine turns off after 10 minutes of inactivity (was extremely annoying when i was debugging my code)

Not to mention the remote start functionality which you need to be there to enable

Using WideQ.py and example.py I was able to get wideq_state.json for my washer with a “WW” model type

Also downloaded the json provided by the LG API link in the json.

What should be my next steps?
It seems like the development has really branched out quite a bit.
Only plan to use for Washer/Dryer. Which repo should I use?
seems like @simlaf and @wkd8176 are working on two different ways of implementing this into HA.

Thanks in anticipation!

Try my repo, it /should/ support your washer

Awesome. Trying as we speak. Will update soon. Thanks a lot!

The Token can be from a different machine right?
I ran the python example.py script on my Mac.
Do I need to run example.py on Hassio. If yes how? :slight_smile:

AttributeError: module 'wideq' has no attribute 'STATE_WASHER_REFRESHWITHSTEAM'

Getting this error

Edit: Solved. But Connection error still not solved.

replaced contents of wideq.py in deps/lib/… folder as well.

Still getting same error. :frowning:

Okay worked through this. However getting Connected Error. Max retries.

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 xxxxxx;: Failed to establish a new connection: [Errno -3] Try again',))

Never seen that max retries error, maybe try restarting HA

Also, whenever you’re getting a “has no attribute” error it means that your washer doesn’t support this specific feature, just remove all non-supported features and it should work :slight_smile:

The no attribute thing seems to be fixed.
However I am not able to setup component.
Can I generate token from any pc or I need to do it from Hassio?

Could it be due to the fact that my json file has “api_root” : “https://aic.lgthinq.com:46030/api” but wideq.py has https://kic.lgthinq.com:46030/api

Do I need to put token: “value from refresh_token” in quotes?

Edit: Checked your json, my json is pretty much the same. same TITAN2 all over the file. Also your json also is aic not kic so that’s also not a problem.

Did you generate token from Hassio or pc?

I have wideq in my deps.
I generated a token from my pc and trying to use it with Hassio however I am getting max retry errors. Connection Error.

Could you elaborate how you got it to work with Hassio?
Do I need to run example.py from Hassio?

Thanks!