Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Controlling APIv2 devices #108

Open
ljtilley opened this issue Jun 23, 2020 · 8 comments
Open

Controlling APIv2 devices #108

ljtilley opened this issue Jun 23, 2020 · 8 comments

Comments

@ljtilley
Copy link

I did some poking around on how to control devices that are using APIv2 and found that you use the following endpoint to send commands:

POST https://aic-service.lgthinq.com:46030/v1/service/devices/{device-id}/control-sync
Request Body:
{
"command": "Operation",
"ctrlKey": "basicCtrl",
"dataKey": "airState.operation",
"dataValue": "0"
}

The request body basically matched the json model info that you can dump using the existing code. I tried directly copying this by re-implementing the post function in the code, but it was returning a '9999' error.

Then I did some research and found another library called thinq2-python that seems to have made a bunch more headway in reverse engineering the new API.

I think the key is registering the client id after you get your oauth token but before you try to issue commands. you register a client by doing a POST request to https://aic-service.lgthinq.com:46030/v1/service/users/client and you can check if a client is already registered by doing a GET at the same address.

The thinq2-python library generates the client id as a 32 byte random hex value (secrets.token_hex(32)) but when I dissassembled the LG Thinq apk it looks like they generate it as a base64 encoded uuid, but the end result works either way.

@sampsyo
Copy link
Owner

sampsyo commented Jun 23, 2020

Indeed! We are actually in the process of trying to merge in APIv2 support from ollo69's fork in #100. There is a lot of work to do still, but the basics are there—including, I think, the client ID registration stuff. We could use all the help we can get, if you're interested. 😃

@digginsa
Copy link

Indeed! We are actually in the process of trying to merge in APIv2 support from ollo69's fork in #100. There is a lot of work to do still, but the basics are there—including, I think, the client ID registration stuff. We could use all the help we can get, if you're interested. 😃

I dont have any programming experience, but have two AC units (on APIv2 in the UK )and 24 years IT experience so happy to test anything if needed.

@pifou25
Copy link
Contributor

pifou25 commented Jul 19, 2020

How can we check if any device should use Wideq APIv1 or the LG APIv2 protocol ?

@codeplexnl
Copy link

Indeed! We are actually in the process of trying to merge in APIv2 support from ollo69's fork in #100. There is a lot of work to do still, but the basics are there—including, I think, the client ID registration stuff. We could use all the help we can get, if you're interested. 😃

I have a multi-split airco system that uses v2 and would like to have it integrated :D
Is there something i can do to help integrate V2?

@netdiag
Copy link

netdiag commented Sep 11, 2020

Hi
I've got a Therma-V Low Temp Split (HU091-U43) unit installed and am just looking at installing the WiFi Modem in order to gain remote access etc.
More than happy to help with this work If I can.

@TheGabeMan
Copy link

Owner of 1x PC09SQ and 2x PC18SQ LG Airco's. I'd be happy to help with debugging.

@jacekpaszkowski
Copy link

Hello, i also can help with debugging. I have 1 x DC12RQ and 2 x DC09RQ :)

Looking forward for v2 support :)

@majki09
Copy link

majki09 commented Jul 18, 2021

Thank you @sampsyo and @no2chem for your work and making people happier!
For long time I was searching, trying and disassembling the mobile app and finally I've found your repo.

I've made a domoticz plugin which uses v2 API. Even if domoticz is not you friend, you can step in to my repo to propose a change, submit the issue ticket or just review the code.

v2 API domoticz plugin here: domoticz_lg_thinq_plugin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants