sampsyo / wideq

reverse-engineered client for the LG SmartThinQ API
https://pypi.org/project/wideq/
MIT License
332 stars 158 forks source link

Device list doesn't return Washer #46

Open alexanv1 opened 5 years ago

alexanv1 commented 5 years ago

I have 3 SmartThinQ devices (Dishwasher, Washer and Dryer). Dishwasher and Dryer are returned in the device list but Washier is, for whatever reason, is missing.

I've debugged it as far as I could and it looks like the data returned from POST to device\deviceList just doesn't contain the Washer for some reason. The washer is on the same account and works fine in SmartThinQ app.

I've seen recent mention on HA forum of LG changing their API endpoints. So, perhaps, there is another API endpoint that could possibly be used instead of device\deviceList to get the list of devices?

honestbleeps commented 4 years ago

thanks so much for the hard work on this -- curious if there's any active work continuing, and/or guidance on how we could help?

I just got it up and running, got authenticated, got it to see my washer and dryer, but then it errors with an API exception...

first, the washer/dryer output (with uuids edited for safety):

some-uuid-here-that-seems-valid: Dryer (DRYER RV13U7JS9W_D_US_WIFI)
some-uuid-here-that-seems-valid: Washer (WASHER T1872EFHU_F)

the next line, though, the traceback/error starts. Here's the last bit of the traceback:

  File "/Users/honestbleeps/Code/wideq/wideq/core_v2.py", line 302, in post
    return thinq2_post(url, data, self.auth.access_token, self.auth.user_number, country=self.auth.gateway.country, language=self.auth.gateway.language)
  File "/Users/honestbleeps/Code/wideq/wideq/core_v2.py", line 139, in thinq2_post
    raise APIError(code, "error")
wideq.core_exceptions.APIError: ('0101', 'error')

any idea what code 0101 might mean? the login seemed successful, I saw my washer/dryer, so I wonder if it's something nonfatal that just needs to be added as an acceptable condition?

tinkerborg commented 4 years ago

@honestbleeps I'm still working on it, yes. I've got the reverse engineering part basically figured out for the new API. I haven't had time lately to finish polishing this into a viable PR, but I expect to have time again next week. If anyone wants to help, please let me know.

Are you just trying example.py when you see this error?

honestbleeps commented 4 years ago

@tinkerborg yeah, just example.py unedited, it does successfully find my washer/dryer, but then poops out. starting on line 225 of example.py, but I figure the main relevant thing is the API response code of 0101 which seems unexpected/odd.

James712346 commented 4 years ago

Yeah, example.py lists my devices but then tries to post to the API and gets a 0101 error:

UUID : Refrigerator (REFRIGERATOR 2REF12EIIFW__)
Traceback (most recent call last):
  File "example.py", line 225, in <module>
    main()
  File "example.py", line 221, in main
    example(args.country, args.language, args.cmd, args.args)
  File "example.py", line 193, in example
    state = client.dump()
  File "/home/user/Documents/wideq-api2/wideq/client.py", line 191, in dump
    out['session'] = self._session.dump()
  File "/home/user/Documents/wideq-api2/wideq/core_v2.py", line 437, in dump
    'monitor': self.monitor.dump()
  File "/home/user/Documents/wideq-api2/wideq/core_v2.py", line 318, in monitor
    self._monitor = AWSMQTTMonitor.from_session(self)
  File "/home/user/Documents/wideq-api2/wideq/core_v2.py", line 563, in from_session
    auth = AWSMQTTAuth.from_session(session)
  File "/home/user/Documents/wideq-api2/wideq/core_v2.py", line 493, in from_session
    cert_data = session.post('service/users/client/certificate', {
  File "/home/user/Documents/wideq-api2/wideq/core_v2.py", line 302, in post
    return thinq2_post(url, data, self.auth.access_token, self.auth.user_number, country=self.auth.gateway.country, language=self.auth.gateway.language)
  File "/home/user/Documents/wideq-api2/wideq/core_v2.py", line 139, in thinq2_post
    raise APIError(code, "error")
wideq.core_exceptions.APIError: ('0101', 'error')

just to note that I changed my fridges UUID to "UUID"

canadaohcanada commented 4 years ago

Given the success in https://github.com/ollo69/ha-smartthinq-washer/issues/3 with resolving this for washer/dryer pairs, is there any update to this problem?

stefxx commented 4 years ago

Ignore my last post, I deleted it. I was working with the wrong branch.

Now, with the correct version installed, I am getting the 0101 error as posted above. Any progress on this, or did anyone find a workaround?

Thanks!

One-P commented 4 years ago

I installed an AC-unit and when following the instructions, the ls command does not return anything.

Are there any logs or other actions, I can take to help with this issue; my end goal is to get my AC unit to work with homebridge.

canadaohcanada commented 4 years ago

@One-P you're probably in the same boat as me. New devices added to the ThinQ system go under the new API rather than the old one which WideQ was designed to support. There are people who have worked out the new API, but it hasn't all been put into one place for us "end users" to enjoy.

stefxx commented 4 years ago

Make sure to use the api2 version here: https://github.com/tinkerborg/wideq/tree/api2/wideq

After showing devices, you probably receive an 0101 error. But at least it shows all my devices!

stefxx commented 4 years ago

It seems the 0101 error is related to the VeriSign certificate. The URL is giving a 301 (Moved Permamently) error.

`GET https://www.symantec.com/content/en/us/enterprise/verisign/roots/VeriSign-Class%203-Public-Primary-Certification-Authority-G5.pem HTTP/1.1 Host: www.symantec.com User-Agent: python-requests/2.23.0 Accept-Encoding: gzip, deflate Accept: / Connection: keep-alive

HTTP/1.1 301 Moved Permanently Date: Wed, 22 Apr 2020 17:17:21 GMT Content-Type: text/html; charset=iso-8859-1 Content-Length: 245 Connection: keep-alive Server: Apache Strict-Transport-Security: max-age=15768000 Location: https://www.broadcom.com/404-symantec

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">

301 Moved Permanently

Moved Permanently

The document has moved here.


GET https://www.broadcom.com/404-symantec HTTP/1.1 Host: www.broadcom.com User-Agent: python-requests/2.23.0 Accept-Encoding: gzip, deflate Accept: / Connection: keep-alive

HTTP/1.1 404 Not Found Date: Wed, 22 Apr 2020 17:17:22 GMT Content-Type: text/html; charset=utf-8 Transfer-Encoding: chunked Connection: keep-alive Server: nginx Last-Modified: Invalid date GMT Content-Encoding: gzip `

tinkerborg commented 4 years ago

It seems the 0101 error is related to the VeriSign certificate. The URL is giving a 301 (Moved Permamently) error.

That's correct, but fixing that will throw another error since I was not correctly generating/registering a client ID. I've got that part sorted now too and am continuing to work on this again (finally) this week. Stay tuned...

stefxx commented 4 years ago

Great!

heardv commented 4 years ago

Thanks for taking the time for this. I have recently added my LG washer and dryer to the their app. I had previously set it up some couple years ago. How do I know which API/code I need to use? I'm running HOOBS Version 3.1.27 with the plugin:

Lg Airco 0.0.999 published 10/26/2019 Homebridge plugin to control a Smart Thinq enabled LG airco unit. Makes use of WideQ =>

stefxx commented 4 years ago

Any update already? Can't wait to test my new AC units 😉

ghost commented 4 years ago

What is the status of this? I am missing new devices as well. How can I try this new code?

tinkerborg commented 4 years ago

I've still been working on the new API, and made significant progress. Unfortunately, I don't have an update to report on my fork linked above. The new ThinQ architecture is different enough that I've spun up a new project here to support these devices. It's still rough around the edges, but the example script should get you through the oauth flow, list your devices, and listen for device events (currently dumped as raw mqtt events). Collaborators welcome!

stefxx commented 4 years ago

Thanks, highly appreciated! Let's continue on the new project page!

trarizakaria commented 4 years ago

@tinkerborg in case you continue working on this, I took your code and merged it into the original code (I gave up trying to maintain both in parallel). Feel free to continue on top of https://github.com/gladhorn/wideq/tree/api2_merged

this is the only repo that display my refrigator, waiting the possibility to monitore it. thank you guys for this work, sadly i don't know anything in coding. but i'm here to test.

thank you again and good luck with api v2