Hi Barney,
Sorry for being so slow on testing, but finally I can confirm that it is working on my 47LH4000 LG TV.
these are my settings now
Power
#193 Off
SendCommand("ka 01 00",1000,2)
#192 On
SendCommand("ka 01 01",10000,4)
Inputs
#316 AV 1
SendCommand("xb 01 02",1000,4)
#317 AV 2
SendCommand("xb 01 21",1000,4)
#712 Component 1
SendCommand("xb 01 05",1000,4)
#361 HDMI
SendCommand("xb 01 90",1000,4)
#767 HDMI 2
SendCommand("xb 01 91",1000,4)
#930 HDMI 3
SendCommand("xb 01 92",1000,4)
#154 RGB
SendCommand("xb 01 60",1000,4)
#166 Tuner
SendCommand("xb 01 10",1000,4)
#873 Tuner - Digital
SendCommand("xb 01 00",1000,4)
General
#190 Enter/Go
Internal
#373 Private Method Listing
# Private - Date: 28.02.2008 # the docs are wrong. they say responses are terminated with a \r. In reality some sets do, others don't. def SendCommand(command,timeout,retransmit) for i in 0...retransmit conn_.Send(command + "\r") # wait up to 8 seconds since it may be very slow if this is an 'on' command buf = conn_.RecvDelimited("x", timeout) if( !buf.nil? && (!buf.index("01 OK").nil? || !buf.index("01 NG").nil?)) print "Received good reply in less than ", timeout, "ms: ", buf, "\n" return else buf = conn_.Recv(1000,1000); print "Flushed buffer: ", buf, "invalid resonse in ", timeout, "seconds\n" end end end
#351 Process IDLE
#350 Process Incoming Data
#355 Process Initialize
# Initialize --- Date: 28.02.2008 # the docs are wrong. they say responses are terminated with a \r. In reality some sets do, others don't. # some sets won't respond to ka 01 ff when the tv is off. others do. @mute = false; # unfortunately we have to turn the device on if it's off to know that it's alive or else it won't respond to anything @input=-1 for iRetry in 0...4 print "Initializing unit\n" # Query the current volume level conn_.Send("kf 1 ff\r") # wait 4 seconds for the status command, which won't work if the tv is off $buf = conn_.RecvDelimited("x", 4000) if( !$buf.nil? && !$buf.index("01 OK").nil? ) print "Initialized ok - tv is on\n" # Use the returned response to set the volume x = $buf.index("OK") volume_level =$buf[x+2,2].to_i(16) print "Setting volume to ", volume_level, "\n" cmd_313(volume_level) return end print "TV is either off or not connected\n" # try turning it on conn_.Send("ka 1 01\r") # wait 10 seconds for the TV to respond sleep(10) # Query the current volume level conn_.Send("kf 1 ff\r") # wait 4 seconds for the status command, which won't work if the tv is off $buf = conn_.RecvDelimited("x", 4000) if( !$buf.nil? && !$buf.index("01 OK").nil? ) print "Initialized ok - tv was off\n" # Use the returned response to set the volume x = $buf.index("OK") volume_level =$buf[x+2,2].to_i(16) print "Setting volume to ", volume_level, "\n" cmd_313(volume_level) # Turn TV off again conn_.Send("ka 1 00\r") return end print "TV is not connected\n" sleep(1) end #DisableDevice( device_.devid_, true ) print "The device wouldn't respond. Disabling it.\n"
#384 Process Receive Command For Child
#356 Process Release
Numbers
#204 0
<$"mc 01 10\r"$>
#205 1
<$"mc 01 11\r"$>
#206 2
<$"mc 01 12\r"$>
#207 3
<$"mc 01 13\r"$>
#208 4
<$"mc 01 14\r"$>
#209 5
<$"mc 01 15\r"$>
#210 6
<$"mc 01 16\r"$>
#211 7
<$"mc 01 17\r"$>
#212 8
<$"mc 01 18\r"$>
#213 9
<$"mc 01 19\r"$>
Simple Control
#64 Skip Back - Channel/Track Lower
<$"mc 01 01\r"$>
#63 Skip Fwd - Channel/Track Greater
<$"mc 01 00\r"$>
Sound & Volume
#97 Mute
if(@mute) SendCommand("ke 01 00",10000,4) else SendCommand("ke 01 01",10000,4) end @mute=!@mute
#313 Set Volume
@volume=level.to_i() ilevel = (@volume).to_i print "setting volume to ", ilevel , "\n" if ilevel <16 SendCommand("kf 01 0" + "%x" % ilevel,1000,4) else SendCommand("kf 01 " + "%x" % ilevel,1000,4) end SetDeviceDataInDB( device_.devid_,device_.devid_.to_i , ilevel.to_s) print "volume and corresponding device data set\n"
#90 Vol Down
print "lowering volume from ", @volume, "\n" cmd_313(@volume-1)
#89 Vol Up
print "raising volume from ", @volume, "\n" cmd_313(@volume+1)
so now I can select tuner and change channels with the MCE remote.