ubaransel / lgcommander Goto Github PK
View Code? Open in Web Editor NEWLicense: Other
License: Other
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
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?
Hi,
I tried to execute 255 and 251 but it returns nothing... My tv is LG LA6200 thanks
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] Подключение не установлено, т.к. конечн
ый компьютер отверг запрос на подключение
Hi
Have you thought putting the project under a license? I did not find any … I personally would go for AGPLv3. Is that OK with you?
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
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
Hello, does anyone find out what is the keycode for enabling In Start menu on LG's 2012?
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
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!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.