-
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
After AC call with wideq it lock android app... #80
Comments
With questions like this, the only people who can definitively answer are the API developers at LG. We are stuck guessing just as much as you! You are welcome to dive in and try to investigate yourself, but I’m afraid no one else knows any more than you. |
I think this is related to #76 Basically LG API doesn't allow 2 users to use the api at the same time. This is true even when using only the official app provided by them. Furthermore, I noticed that @wkd8176 in the PR #34 mentioned in the description something that might be related too: "6. Delete permission for using mobile app and HA at the same time". Maybe there's a clue there on how to deal with this. |
Yes, but when I using official app after I back to main screen I can use app on other device without warning, look like official app close connection to api on some way when we back to main screen of app... |
This is the API call I think is doing the trick: Request
Response
We should implement this... at the moment is beyond my knowledge on how to implement it. |
Well, this works: client.session.post("rti/delControlPermission", {
"deviceId": "d27bdb00-7149-11d3-80b0-XXXXXXXXXXXX"
}) Maybe add this to run always, after every command? |
That’s probably the way to go. Can you try? |
…e (mentioned in related sampsyo/wideq#80)
I made a patch for this in the js variant of this repository, ssut/wideq-js#15. I do not have any experience with this library, however, maybe the patch for this will be similar? |
I have the same issue with the iOS app.
But my experiments are stuck because I'm getting a message that I'm not logged in. The response however is: For now things are hardcoded, obviously not going to keep it this way |
Hmm, that's strange. Your session is sending all the needed headers and whatnot? I had to MITM my phone and the script a lot when debugging to see what didn't line up. |
headers = {
'x-thinq-application-key': APP_KEY,
'x-thinq-security-key': SECURITY_KEY,
'Accept': 'application/json',
}
if access_token:
headers['x-thinq-token'] = access_token
if session_id:
headers['x-thinq-jsessionId'] = session_id
with retry_session() as session:
res = session.post(url, json={DATA_ROOT: data}, headers=headers)
out = res.json()[DATA_ROOT]
if "rtiControl" in url:
with retry_session() as session:
res = session.post('https://kic.lgthinq.com:46030/api/rti/delControlPermission', json={DATA_ROOT: {'deviceId': 'ID_HERE_XXXXX_XXXX_XXX'}}, headers=headers)
temp = res
print(temp.status_code)
print(temp.text)
# Check for API errors.
if 'returnCd' in out:
code = out['returnCd']
if code != '0000':
message = out['returnMsg']
if code in API_ERRORS:
raise API_ERRORS[code](code, message)
else:
raise APIError(code, message)
return out I'm doing this in the core.py file after the post, so I'm using the same headers as the actual post to control the AC unit (which is working correctly) |
Hmm, I'm now looking at what my phone is sending and it seems like there's a new header, |
Ok I figured it out by printing the actual control url, my hardcoded url was going to another instance of their API If I use the same url (eic.lgthinq.com instead of kic.lgthinq.com) the request return 0000 as code |
Glad it's working now! Not sure why I got new issues with that |
I've opened a PR: #102 |
After some command in wideq my AC is locked in android/ios app for few minutes, I have warning that AC using some other user...why wideq don`t close connection to API? How to fix it?
The text was updated successfully, but these errors were encountered: