Giter VIP home page Giter VIP logo

lgcommander's Introduction

lgcommander.py

lgcommander.py is a python script for controlling your Smart Lg TV with your PC. It can be used for gaining access to hidden menus and modes.

Supported models:

Lg has released two TV remote control apps for android smartphones in Google Play app store; each with a list of supported models. One for 2012 models and the other for some earlier models. If your TV is not on those lists, it may not be controllable through a network connection and these scripts may not work for you.

To use it you need:

A PC, with python 3.x installed, connected to the same network as your Lg TV.

Some useful codes:

  • for EZ_ADJUST menu enter 255
  • for IN START menu enter 251
  • for Installation menu enter 207
  • for POWER_ONLY mode enter 254

Warning: do not enter 254 if you do not know what POWER_ONLY mode is. You can find additional information about menus and modes here: http://openlgtv.org.ru

As long as you do not "factory reset" your TV, pairing key doesn't change. You can use an editor to modify the line:

lgtv["pairingKey"] = "DDGWAF"    

to suit your TV's actual pairing key. This will eliminate the pairing key acquisition stage.

Problem with latest LG firmware:

If you upgrade your TV firmware to 05.12.05 or later, "Tool Option 3" may be greyed out and you may not be able to make changes. Please e-mail me if you have a solution to this problem (other than not upgrading).

"Quinny" says:

Thanks for LG Commander! I've just managed to sort out the Options3 greyed out issue. Follow the instructions here: http://www.avforums.com/forums/lg-forum/1651400-official-lg-lw550t-3d-led-thread-part-9-a.html

Windows users:

You can avoid the black console window if you change the "py" file extension to "pyw".

Newer LG Smart TV (year 2012) models:

Benke Tamás says:

"I wanted to use your lgcommander script, but i realized that its not working with lg 2012 smart tv series. I made some changes, now its working with the new series, but lg changed the keycodes too. Now, there are keycodes above 255 and ez-adjust, in-start code changed too, but i dont know them yet. I attached my version, if you want to improve yours."

I added Benke's version of the script as lg_2012_commander.py

Ajay Ramaswamy says:

quote:

Hi,

Thanks for your lgcommander script. I was playing around with my 2012 55LM6200 TV and LG has provided a Android App Smart TV which provides a remote control app.

I ran that app thru unzip, dex2class and JD-GUI and found the file com/lge/tv/remoteapps/Base/RemoteKeyIndex.class contains these key mappings

    KEY_IDX_3D=400;
    KEY_IDX_ARROW_DOWN=2;
    KEY_IDX_ARROW_LEFT=3;
    KEY_IDX_ARROW_RIGHT=4;
    KEY_IDX_ARROW_UP=1;
    KEY_IDX_BACK=23;
    KEY_IDX_BLUE=29;
    KEY_IDX_BTN_1=5;
    KEY_IDX_BTN_2=6;
    KEY_IDX_BTN_3=7;
    KEY_IDX_BTN_4=8;
    KEY_IDX_CH_DOWN=28;
    KEY_IDX_CH_UP=27;
    KEY_IDX_ENTER=20;
    KEY_IDX_EXIT=412;
    KEY_IDX_EXTERNAL_INPUT=47;
    KEY_IDX_GREEN=30;
    KEY_IDX_HOME=21;
    KEY_IDX_MUTE=26;
    KEY_IDX_MYAPPS=417;
    KEY_IDX_NETCAST=408;
    KEY_IDX_PAUSE=34;
    KEY_IDX_PLAY=33;
    KEY_IDX_POWER_OFF=1;
    KEY_IDX_PREV_CHANNEL=403;
    KEY_IDX_RED=31;
    KEY_IDX_STOP=35;
    KEY_IDX_VOL_DOWN=25;
    KEY_IDX_VOL_UP=24;
    KEY_IDX_YELLOW=32;

I have tried all these codes on my TV and they work OK

I hope you find this useful and someone else can test and confirm, and speed up the search for the Service Menu codes.

Thanks & best regards

Ajay

unquote

Nikolay Sukharev has commented:

quote

i found undocumented code range 418-470 that has response 200 most of codes displays only message with X except four:

458 - prompt for channel scanning
419,432,445 - set dtv channel 0

unquote

See his comment for images.

s-e-v-e-n has commented:

Hi there, the mapping from Ajay Ramaswamy didn't work for my 47LM640S-ZA. I just tried every number, here is what i found:

Robin Schneider's Version

Robin Schneider has developed a unified version of these scipts with command-line options. I am not able to test & verify his work which can be found here: https://github.com/ypid/lgcommander

This software was developed with inspiration and/or information taken from:

lgcommander's People

Contributors

senden9 avatar ubaransel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lgcommander's Issues

[Errno 61] Connection refused

I'm using the script to try to connect to an LG TV running WebOS, the script shows it has found the device and displays the correct IP address but then says 'Connection refused'. (see below)

DEBUG: Found device: ('10.0.1.7', 47680)
INFO: Using device: 10.0.1.7
DEBUG: Detecting accepted protocol.
DEBUG: Testing protocol: roap
[Errno 61] Connection refused

The is no pop-up on the television notifying of a pairing code.

Any ideas? Thanks

./lgcommander.py Network error

Hello.
Raspberry Pi 3B
Raspbian stretch
Python 3.5.3

Radndom erorr:
pi@raspberrypi:~/lgcommander $ ./lgcommander.py
Lg TV not found

pi@raspberrypi:~/lgcommander $ ./lgcommander.py
Network error

pi@raspberrypi:~/lgcommander $ ./lgcommander.py
Traceback (most recent call last):
File "./lgcommander.py", line 137, in
root = Tk()
File "/usr/lib/python3.5/tkinter/init.py", line 1880, in init
self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: no display name and no $DISPLAY environment variable

lg_2012_commander and multiple screens

In our office we have a Windows 7 PC dedicated to running a live MI reporting presentation on 5 LG screens (model: 47LN578V). Having obtained the pairing key for each screen I created 5 copies of lg_2012_commander.py, renamed as lgtv_IB1.pyw, lgtv_IB2.pyw etc. and hard-coded the pairing key for a different screen within each file.
My understanding was that this would then bypass the script's pairing key prompt and let me automatically send commands to the screens via vbscript.
Testing this from the command prompt, however, it either returns "Lg TV not found" or I get a dialog prompting to "Please enter the pairing key you see on your TV screen".
The screen that the displayed pairing key appears on seems to be random (remember there are 5 screens connected to the same LAN). And, I think, herein lies the problem.
I think perhaps the command sent from the script only hits one screen - invariably the wrong one - and so it resorts to the prompt.
Is there a clever python programmer out there who could write a loop to keep sending the hard-coded pairing key until it hits the right screen or fails after a certain number of attempts?

HTTP call

Hi! This is not really an issue, sorry for that.
I tried the python script an it works great! Thanks for sharing.

I'm trying to connect to my TV making direct HTTP POST calls. Could you help me out telling me how to make those calls directly from a web browser?

Thanks a lot!

lgcommander works intermittent

Hello
I do not know what is causing that but sometimes the script is not working
I am running it on Pi3 on LG 2012

pi@raspberrypi:~/domoticz/scripts/python $ ./lg_tv_on.py
Traceback (most recent call last):
File "/home/pi/domoticz/scripts/python/lg.py", line 42, in
theSessionid = getSessionid()
File "/home/pi/domoticz/scripts/python/lg.py", line 25, in getSessionid
conn.request("POST", "/roap/api/auth", pairCmd, headers=headers)
File "/usr/lib/python3.4/http/client.py", line 1090, in request
self._send_request(method, url, body, headers)
File "/usr/lib/python3.4/http/client.py", line 1128, in _send_request
self.endheaders(body)
File "/usr/lib/python3.4/http/client.py", line 1086, in endheaders
self._send_output(message_body)
File "/usr/lib/python3.4/http/client.py", line 924, in _send_output
self.send(msg)
File "/usr/lib/python3.4/http/client.py", line 859, in send
self.connect()
File "/usr/lib/python3.4/http/client.py", line 836, in connect
self.timeout, self.source_address)
File "/usr/lib/python3.4/socket.py", line 509, in create_connection
raise err
File "/usr/lib/python3.4/socket.py", line 500, in create_connection
sock.connect(sa)
OSError: [Errno 113] No route to host

not supportett protocol on lg 2016 (webos 3.0)

C:\Users\master\AppData\Local\Programs\Python\Python36-32>python lgcommander.py
--help
Traceback (most recent call last):
File "lgcommander.py", line 109, in
theSessionid = getSessionid()
File "lgcommander.py", line 78, in getSessionid
conn.request("POST", "/hdcp/api/auth", pairCmd, headers=headers)
File "C:\Users\master\AppData\Local\Programs\Python\Python36-32\lib\http\clien
t.py", line 1239, in request
self._send_request(method, url, body, headers, encode_chunked)
File "C:\Users\master\AppData\Local\Programs\Python\Python36-32\lib\http\clien
t.py", line 1285, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "C:\Users\master\AppData\Local\Programs\Python\Python36-32\lib\http\clien
t.py", line 1234, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "C:\Users\master\AppData\Local\Programs\Python\Python36-32\lib\http\clien
t.py", line 1026, in _send_output
self.send(msg)
File "C:\Users\master\AppData\Local\Programs\Python\Python36-32\lib\http\clien
t.py", line 964, in send
self.connect()
File "C:\Users\master\AppData\Local\Programs\Python\Python36-32\lib\http\clien
t.py", line 936, in connect
(self.host,self.port), self.timeout, self.source_address)
File "C:\Users\master\AppData\Local\Programs\Python\Python36-32\lib\socket.py"
, line 722, in create_connection
raise err
File "C:\Users\master\AppData\Local\Programs\Python\Python36-32\lib\socket.py"
, line 713, in create_connection
sock.connect(sa)
ConnectionRefusedError: [WinError 10061] Подключение не установлено, т.к. конечн
ый компьютер отверг запрос на подключение

Errno 111 Connection refused

i always get the following error: could someone please help?

its an lg lw5500 tv

root@raspberrypi:~/programme/LG# python3 lgcommander.py -H 192.168.0.100 -p 8080 -k DDGURF -c 25
# DEBUG: Detecting accepted protocol.
# DEBUG: Trying to connect to port 3000/tcp
# DEBUG: Testing protocol: hdcp
[Errno 111] Connection refused

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.