LG-TV 2012 IP - a new plugin for LG SMART TV sets

Do you have questions about writing plugins or scripts in Python? Meet the coders here.
Post Reply
peterhjalmarsson
Posts: 6
Joined: Sun Mar 31, 2013 2:49 pm

LG-TV 2012 IP - a new plugin for LG SMART TV sets

Post by peterhjalmarsson » Wed May 07, 2014 1:15 am

Here's my first go at writing a plugin. It's written for LG SMART TV:s from 2012 and up. I've only been able to test it on my 2013 LG, but it should work on everything from 2012 and up.

This is my first plugin, and likewise my first Python project, so please be nice. :wink: Seriously though, any and all hints on how the plugin can be improved are more than welcome.
(Oh yeah, I know next to nothing about SOAP either. Or about LG TV:s. As a matter of fact it's something of a miracle that I even got it running.)
Unpack the included zip file in EG's plugin directory, and that should be it.

After some feedback here, a couple of revisions, and I'll try to wrap it up nicely, and create a post in the plugin support forum - at least I think that's how it's supposed to be, right? Any and all info on what's the appropriate way to do that, let me know.

I do plan one additional feature: a kind of macro command where you can pass a string with key codes (such as "<4><42><24>") to the TV at once. Other than that I don't have any ideas on what to add.

- Peter
P.S. The reason I'm writing this is that I failed miserably to get HDMI-CEC to do basic stuff like turning on Live TV. On the other hand, it's impossible to turn on the TV over IP, so both plugins seem necessary for maximum functionality.
Attachments
LG-2012-IP.zip
(5.24 KiB) Downloaded 578 times

kalia
Experienced User
Posts: 109
Joined: Wed Aug 12, 2009 1:10 am

Re: LG-TV 2012 IP - a new plugin for LG SMART TV sets

Post by kalia » Wed May 07, 2014 4:26 am

Thanks Peter.

I will try to test it out later this week and let you know. Too bad that you can't turn the TV on over IP.

Thanks,

kalia

Jakov
Posts: 3
Joined: Mon May 12, 2014 6:30 pm

Re: LG-TV 2012 IP - a new plugin for LG SMART TV sets

Post by Jakov » Mon May 12, 2014 6:31 pm

Great!

snoop23sfc
Posts: 1
Joined: Mon Jun 16, 2014 7:22 am

Re: LG-TV 2012 IP - a new plugin for LG SMART TV sets

Post by snoop23sfc » Mon Jun 16, 2014 7:36 am

thanks it works like a charm.... i have been looking for a software to control my tv using my pc and then i found this.
i already have tv remote software on my android and wondered if it is available in my pc too.. thanks a lot :D

Jakov
Posts: 3
Joined: Mon May 12, 2014 6:30 pm

Re: LG-TV 2012 IP - a new plugin for LG SMART TV sets

Post by Jakov » Fri Aug 15, 2014 12:45 pm

Hi

Is it possible to send Power ON commands at all?
The Power off only works for me. Are you still developing this plugin?

Thanks

Jefman
Posts: 4
Joined: Tue Nov 26, 2013 1:09 pm

Re: LG-TV 2012 IP - a new plugin for LG SMART TV sets

Post by Jefman » Tue Aug 16, 2016 5:20 pm

Hi,

I have a 2015 LG and tried this script but I get a bunch of errors:

Error in Action: "LG-TV 2012 IP: Send Key From List: 4 - Number 2"
Traceback (most recent call last) (1722):
File "C:\Program Files (x86)\EventGhost\eg\Classes\ActionBase.py", line 170, in CallWrapper
return self(*args)
File "C:\Program Files (x86)\EventGhost\plugins\LG-2012-IP\__init__.py", line 245, in __call__
sendCommand(keyCode)
File "C:\Program Files (x86)\EventGhost\plugins\LG-2012-IP\__init__.py", line 214, in sendCommand
theSessionid = getSessionid()
File "C:\Program Files (x86)\EventGhost\plugins\LG-2012-IP\__init__.py", line 191, in getSessionid
conn.request("POST", "/roap/api/auth", pairCmd, headers=headers)
File "httplib.pyc", line 910, in request
File "httplib.pyc", line 947, in _send_request
File "httplib.pyc", line 904, in endheaders
File "httplib.pyc", line 776, in _send_output
File "httplib.pyc", line 735, in send
File "httplib.pyc", line 716, in connect
File "socket.pyc", line 514, in create_connection
error: [Errno 10061] No connection could be made because the target machine actively refused it

I do not get any Pairing question on the tv, so question is where I should look for the problem?

User avatar
kgschlosser
Site Admin
Posts: 4931
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: LG-TV 2012 IP - a new plugin for LG SMART TV sets

Post by kgschlosser » Sat Aug 20, 2016 3:07 am

i am not familiar with this plugin. tho from reading the error message it seems that either you have the plugin pointed to the wrong IP address or the tv doesn't have some kind of network feature turned on. they will typicall have a feature you have to turn on to allow network control. or LG could have changed their API for controlling the TV all together.


I would look into the ip address settings in the plugin config and on the TV as well.

for something like this I would make sure you have the TV set to a static IP address.
If you like the work I have been doing then feel free to Image

Post Reply