-
Notifications
You must be signed in to change notification settings - Fork 157
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
Comments
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. |
How can we check if any device should use Wideq APIv1 or the LG APIv2 protocol ? |
I have a multi-split airco system that uses v2 and would like to have it integrated :D |
Hi |
Owner of 1x PC09SQ and 2x PC18SQ LG Airco's. I'd be happy to help with debugging. |
Hello, i also can help with debugging. I have 1 x DC12RQ and 2 x DC09RQ :) Looking forward for v2 support :) |
Thank you @sampsyo and @no2chem for your work and making people happier! 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 |
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.
The text was updated successfully, but these errors were encountered: