[Solved] LG webOS: "connection lost" when to select the right HDMI input


(Michael Rumpf) #1

I try to turn my LG TV and I cannot get the input channel selection working.
The rule looks like this:

rule "Turn TV on" 
when
    Item LG_TV changed from OFF to ON
then
    logWarn("tv", "AT_Office_Power_Entertainment.sendCommand(ON): " + AT_Office_Power_Entertainment.state.toString )
    if (AT_Office_Power_Entertainment.state == OFF) {
        logWarn("tv", "AT_Office_Power_Entertainment.sendCommand(ON)")
        AT_Office_Power_Entertainment.sendCommand(ON)
    }
    Thread::sleep(15000)
    logWarn("tv", "TV.sendCommand(ON)")
    LG_TV0_WOL.sendCommand(ON)
    Thread::sleep(5000)

    logWarn("tv", "TV.sendCommand(com.webos.app.hdmi3)")
    LG_TV0_Application.sendCommand("com.webos.app.hdmi3")
end

I added some sleeps to give the devices some time to boot into their standby mode.
The WakeOnLAN works, the TV starts and shows the input channel that was selected before turning it off (livetv for testing).
When sending the command to the appLauncher with the parameter “com.webos.app.hdmi3” I receive an error “error requesting application list: connection lost”:

2019-02-08 11:58:06.656 [WARN ] [rg.eclipse.smarthome.model.script.tv] - AT_Office_Power_Entertainment.sendCommand(ON): OFF
2019-02-08 11:58:06.670 [WARN ] [rg.eclipse.smarthome.model.script.tv] - AT_Office_Power_Entertainment.sendCommand(ON)
2019-02-08 11:58:21.686 [WARN ] [rg.eclipse.smarthome.model.script.tv] - TV.sendCommand(ON)
2019-02-08 11:58:21.701 [INFO ] [nhab.binding.wol.internal.WolBinding] - Wake-on-LAN packet sent [broadcastIp=192.168.178.255, macaddress=785dc84db832]
2019-02-08 11:58:26.699 [WARN ] [rg.eclipse.smarthome.model.script.tv] - TV.sendCommand(com.webos.app.hdmi3)
2019-02-08 11:58:26.790 [WARN ] [lgwebos.internal.LauncherApplication] - error requesting application list: connection lost.

What could be the reason for this connection lost or how could I make the thing more resilient against short-lived connection drops?


(CM6.5 H102) #2

Use the console to set the log level to DEBUG and see if that provides a clue to whats causing the warning.

Also you have some long thread sleeps in your rule.
See this topic:


(Michael Rumpf) #3

Thank you for the hint. I stumbled over the topic before, but did not realize that there is a limit of 5 threads which also applies to my use-case. I switched to a timer based solution and it seems to be working now.


(CM6.5 H102) #4

Glad I could help.:+1:

If this fix’s your issue please mark the topic solved by clicking the square box that provided the solution and edit the title to start with [Solved]. This will help others with a similar issue find a quick solution.

Thank.