How to interface to LG TV (LG SL8000)

Well i did get my USB to RS232 convertor installed correctly (bough a compatible one from DX)
But now the ‘fun’ part of actually sending codes over the convertor.
Im going to use it to only switch on my TV and when finished switching it off again.
According to the manual of my tv (LG SL8000) the following must be send:

ka 1 00 [CR]

Where [cr] is Carriage Return ASCII code ‘0x0D’
The serail port configuration is all-ready set according to the manual so that shouldn’t be a problem.
I figured out that you must asign the convertor to a (virtual) device but i just dont get it how to implement the code sending.

To create a plugin to control your LG TV, try using something like this in your device implementation file (you can use the Panasonic TV plugin as your template):

 function sendCommand(command) if ( .. string.char(13)) == false) then luup.log("Cannot send command " .. command .. " communications error", 1) luup.set_failure(true) return false end return true end 

<action> <serviceId>urn:micasaverde-com:serviceId:DiscretePower1</serviceId> <name>Off</name> <run> -- Power off sendCommand("ka 00 00") </run> </action> 
<action> <serviceId>urn:micasaverde-com:serviceId:DiscretePower1</serviceId> <name>On</name> <run> -- Power on sendCommand("ka 00 01") </run> </action>

[quote=“The-Source, post:1, topic:170587”]According to the manual of my tv (LG SL8000) the following must be send:

ka 1 00 [CR]

Where [cr] is Carriage Return ASCII code ‘0x0D’[/quote]

I split this conversation out from the [sticky] post on getting Serial ports working with Vera’s OS.

Well i did some editing to the panasonic files and came up with the attached files.
When i try to test some luup code to it (device 60 is my created device id) is get.

luup.call_action("urn:micasaverde-com:serviceId:DiscretePower1","Off",{}, 60)
Received empty response.

I took some time to look into the log file and i see that the I.xml isn’t loading as it should

01 02/21/12 20:51:07.681 Device_LuaUPnP::LoadDeviceDoc can't load /etc/cmh-lu//D_LGsl8x00.xml <0x400> 02 02/21/12 20:51:07.682 JobHandler_LuaUPnP::m_sMissingFile_set /etc/cmh-lu//D_LGsl8x00.xml <0x400> 01 02/21/12 20:51:07.682 JobHandler_LuaUPnP::CreateDevice_LuaUPnP failed to load 60/D_LGsl8x00.xml so device 60 is offline <0x400> 01 02/21/12 20:51:15.835 Device_LuaUPnP::CreateServices Aborting device 60 because the topmost device has no interface <0x400> 01 02/21/12 20:51:15.835 JobHandler_LuaUPnP::CreateAllServices failed to create 60 <0x400> 01 02/21/12 20:51:15.901 UPnPAction_Send::ParseState can't find name <0x400>

I also updated the attached files. But when i want to test some luup code againt the virtual device it causes my vera to reboot.

2012-02-21 21:08:08 - LuaUPnP Terminated with Exit Code: 245

2012-02-21 21:08:08 - LuaUPnP crash

Well i did take some time today to try make it work. But every time the engine crashes.
Maybe somebody who is more experience in this can point me in the right direction. Basically i stripped the Panasonic plugin but i dont get it why the engine crashes.

What version of MiOS are you running?

A vera2 with firmware 1.5.255

ok, I’m assuming you’re still having the problems from Feb 20th.

At that time, you had the log line:

01 02/21/12 20:51:07.681 Device_LuaUPnP::LoadDeviceDoc can't load /etc/cmh-lu//[b]D_LGsl8x00.xml[/b] <0x400>

Inidicating it couldn’t find the device declaration file (highlighted), but the device filename you’ve attached (D_LGSL8x00TV.xml) has a different name/case)

So Vera couldn’t find the Device file, and hadn’t [yet] gotten as far as attempting to find the implementation. If you fix up the Filename, or change the D_xxxx filename reference in your existing device to match the filename, then it should get a few steps closer.

Well the file names in the virtual devices are corresponding with the ones attached in the latest post.

And what notepad++ didn’t mention and i just found out when is wanted to open the D file in Firefox was that there was no > in the last line of the file. so the was never closed.
Now the funtion on/off work okay. :slight_smile:
Attached is the function D file.

Processing the incoming part is something which i will try to find out when its a raining weekend :wink:

Just to add something to this thread, I was testing the files with my LG LV5500 and I had to add a carriage return to the beginning of the “ON” command to make it work. I read in another forum that this was required to “wake” it up so it will accept the ON Command. My OFF command works as you have it written. I’ll test out any other available commands when I get a chance.

I have two LG xxLV5500 tvs. Would love a plugin for this.

Since my initial ‘release’ i didn’t pay much attention to the plugin. Think the big reason is that on/off is the only thing i use. But as my home simulation scene is growing bigger and bigger i think im going to use more function of my TV.
My digital receiver is in no way accessible with rs-232 or Ethernet (according to the manufacture) so i have to work around that problem :wink:

I still could use some help in processing incoming and creating json for controlling it with the UI. But first I will add some extra fuctions to the plugin.

I just bought an LG7600 smarttv and it is very slick. However I did take a step back in that my previous led tv used IR so I used GlobalCache’s Wifi2IR blaster to power on my tv, turn on receiver, start DVD player, etc.
With new LG TV it uses RF rather than IR so I can’t turn on TV when i select my “Movie Time” scene. Does anyone know how (wirelessly) to turn on a LG smarttv? If the magic remote can do it then I’m sure it can be done…although their Android app does NOT allow turning on of tv either :frowning:


Have you tried the attached plugin?

The LG TV I was considering buying the other week has a programming guide for it, including all the codes. Not sure how much they vary by model, but might be a good starting point.