Hi
I'm trying to implement some basic control of an LG television. I have the protocol document from LG however haven't figured out how to script the generation of the encryption key or send the encrypted commands to the TV.
Is this possible with lua?
Turing on the device is pretty straightforward by sending a WOL packet to the MAC address of the TV, however before it will process any commands (like setting inputs, changing the volume or switching off) one must complete the handshake with the tv.
One can view the TV's pairing key code from the TV itself - it is an 8 digit key ie: BK2AT22Y
Handshake notes from LG
Client encrypts the password with PBKDF2 (Password-Based Key Derivation Function 2) method. First 16 Bytes of encrypted password are AES128 key. Following parameters must be used:
Algorithm: sha256
Salt: 0x63,0x61,0xb8,0x0e, 0x9b,0xdc,0xa6,0x63,0x8d,0x07,0x20, 0xf2,0xcc,0x56,0x8f,0xb9 Number of Iteration: 2**14
Here is the link to the full protocol https://www.dropbox.com/s/hanc8sva8468d1...P.pdf?dl=0
Here's as far as I got with my send command
function sendCommand(command)
socket = require("socket").tcp()
data, err = socket:connect('192.168.1.100', 9761)
-- add logic to complete handshake and encrypt command before sending
data, err = socketend(command .. '\x0D\x0A')
end
Initially all I'd like to send is the 'POWER off' and 'INPUT_SELECT hdmi1' command as detailed in the dropbox link.
Any help would be greatly appreciated.
Kind Regards
James
I'm trying to implement some basic control of an LG television. I have the protocol document from LG however haven't figured out how to script the generation of the encryption key or send the encrypted commands to the TV.
Is this possible with lua?
Turing on the device is pretty straightforward by sending a WOL packet to the MAC address of the TV, however before it will process any commands (like setting inputs, changing the volume or switching off) one must complete the handshake with the tv.
One can view the TV's pairing key code from the TV itself - it is an 8 digit key ie: BK2AT22Y
Handshake notes from LG
Client encrypts the password with PBKDF2 (Password-Based Key Derivation Function 2) method. First 16 Bytes of encrypted password are AES128 key. Following parameters must be used:
Algorithm: sha256
Salt: 0x63,0x61,0xb8,0x0e, 0x9b,0xdc,0xa6,0x63,0x8d,0x07,0x20, 0xf2,0xcc,0x56,0x8f,0xb9 Number of Iteration: 2**14
Here is the link to the full protocol https://www.dropbox.com/s/hanc8sva8468d1...P.pdf?dl=0
Here's as far as I got with my send command
function sendCommand(command)
socket = require("socket").tcp()
data, err = socket:connect('192.168.1.100', 9761)
-- add logic to complete handshake and encrypt command before sending
data, err = socketend(command .. '\x0D\x0A')
end
Initially all I'd like to send is the 'POWER off' and 'INPUT_SELECT hdmi1' command as detailed in the dropbox link.
Any help would be greatly appreciated.
Kind Regards
James