I like to integrate my LG devices like AC for example by the LG Thinq API. Has someone already done this and could share the script here?
I found a start at this website https://forum.fibaro.com/topic/51441-hc3...martthinq/ with the script below. Would be great if we can get it to work.
The script berlow is not mine but copied from the website i shared. It seems you'll need a secret key and client key but i'm not sure where to get it as i could not find clear information about it. So all help is much appriciated to get this work.
With slight modifications this code should work - HTTP request via socket.http and hashing via encdec.hmacsha1
Client / secret key are fixed. You need your own access / refresh tokens to make requests and periodically update tokens.
(08.05.2023, 08:55)admin Wrote: With slight modifications this code should work - HTTP request via socket.http and hashing via encdec.hmacsha1
Client / secret key are fixed. You need your own access / refresh tokens to make requests and periodically update tokens.
Could you make this modifications please just to make sure everything is set correct so far? Otherwise it will be a lot trial before it might work.
Many thanks in advance!
I changed print to log already but i have no idea how to change the hash part correct.
Also i see
Code:
1
self:debug
and i believe it's not valid code for the LM correct?
Use log() instead of self:debug. There are no callbacks for HTTP requests anyway, just the return values. Search the forums, there are many similar HTTP request examples available.
LG Thinq 08.05.2023 14:35:56
Library socket/http:0: bad argument #1 to 'escape' (string expected, got function)
stack traceback:
[C]: in function 'request'
Resident script:31: in function 'auth_request'
No i have this code working with the below response. Do you think it's due to the wrong credentials or is it part of the code? ( Is still can't find any information on how to get my own credentials from LG..)
LG Thinq 08.05.2023 16:35:17
* arg: 1
* string: {"error":{"request":"/oauth/1.0/oauth2/token","code":"LG.OAUTH.EC.2105","service":"oauth","message":"Signature doesn't match request."}}
* arg: 2
* number: 406
The problem is that LG only accepts developers to use their API. I see others like Home Assistant use Wideq. I read onine (from recent posts) that is working succesfull. Only problem is that it's in Python script. Is someone interested to 'translate' it to Lua?