[NO LONGER MAINTAINED] LG ThinQ integration attempt?

Got pretty far tonight:
1.) Now connects to MQTT and subscribes to your topics
2.) MQTT reconnect support if the connection is lost
3.) Right now it just logs the commands that appear on MQTT. It'd be awesome if someone who owns the devices could show the logs of messages. Like for a fridge - open/close door, for an oven - on/off, dishwasher - on/off, etc.
4.) Added refresh token support to OAuth
5.) Added the first steps of some error handling
6.) Code cleanups and removal of some duplicate code

Note: Right now I'm building this for v2 devices, older devices might not get detected. We can do v1 as well, but might be hard if we don't have devices to test with. wideq supports v1 nicely though so there is a really good example.

1 Like

The idiots at Home Depot (last time I shop there!) just told me my appliances are delayed a month so this project is at a standstill unless someone can get me some mqtt messages to dissect.

Thanks for working this up. I am trying it out now. I got a LG fridge i have been wanting to play with, and rig a smart speaker like alexa to automatically yell at my kids when they leave the door open.

If I can see what the data looks like I’m sure that’s doable!

Have any of you made this work, the the LG account is linked with a google account?
I think this is only working with native LG account

I haven’t tried but I’ll setup an account later tonight and try it out.

I will send it as soon as I can get the stupid WiFi to connect. There app is awful on iOS trying to get an old android rigged to see if that works.

1 Like

I've got an LG Washer & Dryer and I'd love to help provide more data; unfortunately, I can't get past the RSA and CSR key generation. Can you provide any more specifics on what should be selected on that cert site? Thanks.

Select the PKCS#1 option, leave everything else blank and hit submit.

image

Copy the Private key and CSR and paste them into the corresponding fields.

2 Likes

Thanks - I've tried this multiple times, and keep getting this error:

Unexpected Error
An unexpected error has occurred trying to load the app. Check Logs for more information.
Error: Cannot get property 'certificatePem' on null object

I didn’t have much free time today. I’ll dig in tomorrow. Any chance you can PM me the logs?

1 Like

Google login worked fine for me. I created a brand new account linked to my Gmail and I was able to login and get my device list. Are you getting an error?

Ok, thanks for all the help I've received so far testing!

I just made a few enhancements:

  1. The way I had this written before, it would only detect v1 devices. I enhanced it to detect v2 as well. I'd appreciate if, after running through the setup, people could show me the foundDevices variable from the app properties (you can hide the device_id if you like), you'll see entries like:
    The version is what I'm really interested in, it will help us identify v1 vs v2 devices. Also, I don't currently have a real v2 device, I'm assuming the version string will be thinq2 but it'd be great to see
  2. For anyone with a v1 device, I'm curious what you see in the logs. I currently get this after the devices are added {returnCd=0106, returnMsg=장치가 접속중이 아닙니다., stateCode=F, deviceState=D, timestamp=0} that's Korean for "Device is not connected." That makes sense because I tricked the app into creating a fake device. I'm curious if others get an error or if you see returnCd=0000 which would mean success. I plan to do more work later today so if someone has that much working it'd be great so I can do a little R&D and get it pulling device statuses
  3. @syepes like I said, Google works fine for me. If you could please paste whatever error you're getting that'd be helpful.
  4. @jonathan.lorber as I said in PM, more logs would be great. You're getting an INVALID_HEADER error which makes me think there's something else going on.

The DW times out and has to be made ready for even the ThinQ App to see it. Should we have the DW online/running when setting up, or is it just looking to devices already present in the app?

Most everything is delayed.. the common excuse .. Covid. We ordered new furniture was supposed to be here the week of Christmas. now its out to the 3rd week of January, I can assure you its not transportation slowing things down. we are moving product and material as fast as we can, with volumes growing daily.

What do you mean times out? Are you getting an error? If so please paste. Unfortunately I have no idea if it needs to be running. As I said, I don’t even own any of the devices yet. My advice would be this is going to be a group effort of trial and error. Try stuff and report back. Unfortunately, we don’t have answers yet so we need to try it out and come up with answers together.

That last update did the trick for the initial app install.

What devices should I have after?

What state (if any) should be shown?

foundDevices [{name=DISHWASHER, id=bcdd9eb0-96b0-11e8-b083-203dbd988fd9, type=204, version=thinq1}, {name=OVEN, id=87e75e70-7117-11d3-98a6-203dbddf84d4, type=301, version=thinq2}]

By times out, I mean the power on the DW goes into standby if it's not running and it stops communicating.

I'm getting continuous MQTT lost connection:

dev:11612020-10-11 01:24:39.054 pm warnLost connection to MQTT, retrying in 15 seconds

dev:11612020-10-11 01:24:23.102 pm warnLost connection to MQTT, retrying in 15 seconds

dev:11612020-10-11 01:24:07.362 pm warnLost connection to MQTT, retrying in 15 seconds

dev:11612020-10-11 01:23:51.430 pm warnLost connection to MQTT, retrying in 15 seconds

dev:11612020-10-11 01:23:35.682 pm warnLost connection to MQTT, retrying in 15 seconds

dev:11612020-10-11 01:23:19.726 pm warnLost connection to MQTT, retrying in 15 seconds

Great news that it found the devices! You should see a device created that represents both your dishwasher and oven. However, they don't do anythign yet.

So that's the timeout you're referring to? That wouldn't have anything to do with the DW, it's not talking to the Dishwasher, it talks to the LG cloud. Can you click the Initialize button on that device and tell me what you see in it's logs? In fact, since the Dishwasher is a V1 device, the MQTT doesn't even really apply. I need to make some modifications so that, in your case, the MQTT is handled through your oven.

As far as what state will you see? Nothing. This is a far from complete integration at this point. Here's what would help:

  1. In the logs for the app, with the latest version, if you click the Initialize button on your Dishwasher, can you tell me what gets logged for the APP? It will help me track down if we're successfully communicating with that.
  2. We need to figure out why your MQTT disconnects. When you click the Initialize button as in the previous step, let me know what you see in the DEVICE logs
  3. Once we get that working, then we can start getting the code together so you can log some messages while you "do stuff" (use the oven/stove, use the dishwasher) then I have to figure out what those log messages mean and reverse engineer to get the state.

We're getting somewhere, but there is still a lot of work to do before this is a useful integration. I'm still adding more today though so we'll keep getting closer!

Nothing in the logs, nothing seen in the device.

Nothing logged initially, but then (below) showed up while I was looking at the app (cog) itself to see if any events were showing.

NOTHING in the device logs.

app:10672020-10-11 01:36:26.852 pm debug{countryCode=US, languageCode=en-US, thinq1Uri=https://aic.lgthinq.com:46030/api, thinq2Uri=https://aic-service.lgthinq.com:46030/v1, empUri=https://us.m.lgaccount.com, empSpxUri=https://us.m.lgaccount.com/spx, rtiUri:47878=aic.lgthinq.com, mediaUri:47800=aic-media.lgthinq.com, appLatestVer=3.5.1054, appUpdateYn=N, appLink=‎LG ThinQ on the App Store, nestSupportAppVer=9.0.0, uuidLoginYn=Y, lineLoginYn=N, lineChannelId=, cicTel=800-243-0000, cicUri=, isSupportVideoYn=N, countryLangDescription=USA/English, empTermsUri=https://us.emp.lgsmartplatform.com, googleAssistantUri=https://assistant.google.com/services/invoke/uid/000000d26892b8a3, smartWorldUri=http://us.lgworld.com/mall/mobile.main.dev?referUrl=ThinQ, racUri=us.rac.lgeapi.com, cssUri=https://aic-common.lgthinq.com, cssWebUri=http://s3-an2-op-t20-css-web-resource.s3-website.ap-northeast-2.amazonaws.com, iotssUri=https://kic-iotservice.lgthinq.com, chatBotUri=https://chatbot.lgthinq.com/us, autoOrderSetUri=http://us.lgworld.com/mall/mobile.product.RetrieveProdCategoryList.dev?initCategoryType=AUTO, autoOrderManageUri=http://us.lgworld.com/mall/mobile.mypage.RetrieveAutoRequestList.dev, aiShoppingUri=, onestopCall=, onestopEngineerUri=, amazonDrsYn=Y, features={amazonDrs=Y, pccPushProd=101,201,202,204,301,401, disableWeatherCard=N, thinqMall=Y, thinqCss=Y, thinqNotice=Y, groupControlYn=Y, cicSupport=Y, pccReceiptRegister=Y, pccPush=Y, qrRegisterYn=Y, pccWarrantyProd=101,201,202,204,301,401, pccWarranty=Y}, serviceCards=[{id=1014, order=1, title=null, message=null, bgImage=https://objectcontent.lgthinq.com/f8fee946-1abf-4fa6-9dbc-7e21ec948ff1?hdnts=exp=1663474811~hmac=edb84e17b42eef8dc3087b4a2b6aba7ceab6fb7dbf765c21f0937a38469ef68b, bgImageDescription=Convenient shopping at the ThinQ Store, smallImage=null, bgColor=null, link=thinqapp://internal?intent="Store", trackingKeyword=SVC_STO_DEF_US_001, priority=normal, startDate=1599177600, endDate=1893455999, minVer=null, maxVer=null, models=}, {id=1015, order=2, title=null, message=null, bgImage=https://objectcontent.lgthinq.com/a7969dea-c04e-4a06-bd6d-b2a04b1cfd2e?hdnts=exp=1664095275~hmac=4c0968c19a45635e2f22f823339c533fee61840acfe694c218891a5d8d65f1b5, bgImageDescription=ThinQ Store Grand Open Promotion. Great savings on water filters until Sep.30, smallImage=null, bgColor=null, link=thinqapp://store?url="http%3a%2f%2fus.lgworld.com%2fmall%2fmobile.corner.RetrieveEventDetailView.dev%3fpromotionId%3d1000020248", trackingKeyword=SVC_STO_PRO_US_001, priority=normal, startDate=1599177600, endDate=1601510399, minVer=null, maxVer=null, models=}, {id=1013, order=3, title=null, message=null, bgImage=https://objectcontent.lgthinq.com/6b6e6fd8-ff22-4cf8-85c9-bca23b9a6c75?hdnts=exp=1662539878~hmac=8bcba0c49379b86336cdbf0a663ad9064f6d842239d80dc516c7fb6ea56455c3, bgImageDescription=Experience LG Like Never Before, smallImage=null, bgColor=null, link=thinqapp://inappbrowser?url="https://www.lg.com/global/exhibition_m/main.jsp", trackingKeyword=SVC_PRO_US_EN_001, priority=normal, startDate=1598918400, endDate=1601510399, minVer=null, maxVer=null, models=}, {id=1003, order=4, title=null, message=null, bgImage=https://objectstore.lgthinq.com/8c32d5d2-7845-44b0-96fc-46de9c7cf765?Expires=1648696171&Signature=NHNXgnhtGs~~9YwLCAIUQxdTMy8gcQ1efB-a0yYDQqafnWVogX1IMtOAv7IVuWG5aDW5hMU0A2E6A0i9PaovNXhaz6A2v0Ruzym35tvZooqIwppWE1hAcx2O4q0b1vdLYodl3zzNGyXML8hOpNsdjEWo3-KQBeSbb7sOH-cra3bYV7uubmSvdvSV0N4-NcBWuhz-0mBOLN-~VATatnMUwg19IxRw-V2v3NeWN9taSALSGdJCSFH62djKIkOPchDAat4rV8u1AcPL29sJzzn1ID0FWGKkiXNzeor483NGv9ZWknKMEQl5l3d-85E0pMCLnrYq0aEO5X2je1UH5CXKSQ__&Key-Pair-Id=APKAI74R6YENXPGRIWLQ, bgImageDescription=Save 15% on laundry detergent with smart reorders. Offer valid through Apr.30.21, when you register until Mar.31.20, smallImage=null, bgColor=null, link=thinqapp://webapp?state="GCM_DRS01_productList", trackingKeyword=FUN_DRS_PRO_US, priority=normal, startDate=1569902400, endDate=1590983999, minVer=null, maxVer=null, models=}, {id=3002, order=4, title=null, message=null, bgImage=https://objectstore.lgthinq.com/0ccff33b-34af-4323-a4c2-4da032671da5?Expires=1661060231&Signature=Wkr0Kq5tJJpP05pl6G-sk2Q57GFj06IncDBOp~zV1fBjpvoXkS9bisOhGPeRE5~1IcrqCaC6Bb8PGuYVH7yKVMA43nSa2gfVny7pBfegudn6Cg1dbstkTLO2pjv8riicqHtnRIadsezjkanbK7DXJCWG4TYF2V5rXVoiNIWrCuyBIBWvYEWkEdVJeageQj5OEozy5imDvgFKW~s7M0HqvMgXEdEOmZPv~WLEC55c42IOP3j-Sc9spY5l8bQCwypdJ2mZePPHfWmbpbk-0klnD0OzTBCJ8BrVIxHAC-YcTZSUlVosaDtkgLn3E8zSMk0NzsrFM~8MDXh0VGkZslDONQ__&Key-Pair-Id=APKAI74R6YENXPGRIWLQ, bgImageDescription=See what else you can do with LG ThinQ, smallImage=null, bgColor=null, link=thinqapp://inappbrowser?url="https%3a%2f%2fwww.lg.com%2fus%2flg-thinq%3fcmpid%3ddisplay_gmc_thinq_2020thinq_brand_ThinQ-APP_mobile%26utm_source%3dThinQ-APP%26utm_medium%3ddisplay%26utm_campaign%3d2020thinq", trackingKeyword=SVC_OBS_US_EN_001, priority=normal, startDate=1597968000, endDate=1604188799, minVer=null, maxVer=null, models=}, {id=1004, order=5, title=null, message=null, bgImage=https://objectcontent.lgthinq.com/01522b49-1119-49ff-9eb0-10dbc207b08c?hdnts=exp=1663398266~hmac=5de89a26b6e95e5cdd33978c5eaa908dcc005c31636208cf25e905781f10d386, bgImageDescription=Set up Amazon Dash Replen-
ishment to automatically
reorder your favorite supp-
lies when you’re running low., smallImage=null, bgColor=null, link=thinqapp://webapp?state="GCM_DRS01_productList", trackingKeyword=SVC_DRS_DEF_EN_US_001, priority=normal, startDate=1597276800, endDate=1604188799, minVer=null, maxVer=null, models=}], uris={}}

Lol is your dishwater pushing amazon ads?