LGWebOS Binding (for LG WebOS TVs)

Tags: #<Tag:0x00007f5c93cf0ca0> #<Tag:0x00007f5c93cf0bb0>

The channel channelName was removed as channel now comes with options to show number and name in one. pls unlink the item

Perfect.

TnX

Jad

Hi, is there a way to launch the browser or switch it to full screen mode?

https://www.openhab.org/addons/bindings/lgwebos/

see launchBrowser action

full screen mode is not accessible via api to my knowledge

Thanks. I didn’t word my question properly. It should say “Is there a way to launch the browser in full screen mode”. I guess the answer is “no”. Thanks for the clarifications.

@Jademic: I guess your thing is outdated and should be created again.

@sprehn Rule triggered by Thing changed to ONLINE does not work anymore after upgrading from OH2.4

Hi Sebastian,

first off all: Thanks a lot for this great binding and caring of it over such a long time! I’m using it since years.

I use OH2.5.4, and the DSL rules engine in a docker container running on my Synology NAS

When I want to watch Netflix for example I press the Netflix Button on my HabPanel and some actions are triggered

  1. Turn on LG TV
  2. start Netflix app on LG TV
  3. Turn on receiver
  4. Switch to the correct Input on receiver
  5. Set the Hues to the right ambience

For step 2. I have to make sure, that the TV is switched on and ready to receive commands from OH. So I have a rule trigged by Thing “LGTVT” changed to ONLINE"

rule "SetUp LGTV simplified"
when
	Thing "lgwebos:WebOSTV:tv1" changed to ONLINE
then
	logDebug( filename, "Thing 'lgwebos:WebOSTV:tv1' changed to ONLINE")
//	Thread::sleep(2000)

	val actions = getActions("lgwebos","lgwebos:WebOSTV:tv1")
	if(null === actions) {
			logInfo("actions", "Actions not found, check thing ID")
			return
	}

	if(sceneSelected) {
	    logDebug( filename, "Launch '{}' on LG", setLgtvLivAppLaunch)
		actions.launchApplication(setLgtvLivAppLaunch)
		sceneSelected = false
	}	
end

In OH 2.4 this worked quite well. Now my actions take part too early as you can see in the logs below. My rule is triggered when the state changed from “OFFLINE: TV is off” to “ONLINE: Registering”.

09:54:23.825 [INFO ] [ome.event.ThingStatusInfoChangedEvent] - 'lgwebos:WebOSTV:tv1' changed from OFFLINE: TV is off to ONLINE: Registering - You may need to confirm pairing on TV.
09:54:23.825 [DEBUG] [smarthome.model.script.gaertner.rules] - Thing 'lgwebos:WebOSTV:tv1' changed to ONLINE
09:54:23.830 [DEBUG] [smarthome.model.script.gaertner.rules] - Launch 'netflix' on LG
09:54:23.833 [WARN ] [binding.lgwebos.action.LGWebOSActions] - Device with ThingID lgwebos:WebOSTV:tv1 is currently not connected.
09:54:23.835 [WARN ] [binding.lgwebos.action.LGWebOSActions] - Device with ThingID lgwebos:WebOSTV:tv1 does not support any app with id: netflix.

When wait for 2000ms after my rule is triggered every thin works fine

09:53:01.803 [DEBUG] [smarthome.model.script.gaertner.rules] - Launch 'netflix' on LG
09:53:01.872 [DEBUG] [binding.lgwebos.action.LGWebOSActions] - Response: org.openhab.binding.lgwebos.internal.handler.core.LaunchSession@5f0fedf9
09:53:03.514 [INFO ] [smarthome.event.ItemStateChangedEvent] - lgtvLivAppLaunch changed from com.webos.app.hdmi1 to netflix

My question: Is there a more elegant way to solve my problem? The rule should be triggered when the TV is connected and ready to receive commands from OH.

Thanks a lot!

Hi,

The “power switch” item should change from OFF to ON when the TV is turned on. You should be able to trigger on that event.

It also triggers when the TV changes from OFF to ON using the remote or buttons etc. At least in my case with the C9 model.

Switch tv_power “Living Room TV” {channel=“lgwebos:WebOSTV:asdadghahgd:power”, ga=“Switch”}

2020-05-02 10:11:56.473 [vent.ItemStateChangedEvent] - tv_power changed from OFF to ON

Hi Massssy,

thanks a lot! I tried this before and it does not work either. To make sure this is still the case I tried it again.

rule "SetUp LGTV simplified"
when
//	Thing "lgwebos:WebOSTV:tv1" changed to ONLINE
	Item lgtvLivPower changed from OFF to ON
then
//	logDebug( filename, "Thing 'lgwebos:WebOSTV:tv1' changed to ONLINE")
	logDebug( filename, "Item lgtvLivPower changed from OFF to ON")
//	Thread::sleep(2000)

	val actions = getActions("lgwebos","lgwebos:WebOSTV:tv1")
	if(null === actions) {
			logInfo("actions", "Actions not found, check thing ID")
			return
	}

	if(sceneSelected) {
		logDebug( filename, "Launch '{}' on LG", setLgtvLivAppLaunch)
		actions.launchApplication(setLgtvLivAppLaunch)
		sceneSelected = false
	}	
end

This rule is triggered later, but even not later enough in my case. Turning on DEBUG mode shows that it is triggered directly before the list of Apps appears in the log.

Here the Log entries:

11:08:17.464 [DEBUG] [smarthome.model.script.gaertner.rules] - Item lgtvLivPower changed from OFF to ON
11:08:17.464 [INFO ] [smarthome.event.ItemStateChangedEvent] - lgtvLivPower changed from OFF to ON
11:08:17.466 [DEBUG] [smarthome.model.script.gaertner.rules] - Launch 'netflix' on LG
11:08:17.469 [WARN ] [binding.lgwebos.action.LGWebOSActions] - No AppInfos found for device with ThingID lgwebos:WebOSTV:tv1.
11:08:17.471 [WARN ] [binding.lgwebos.action.LGWebOSActions] - Device with ThingID lgwebos:WebOSTV:tv1 does not support any app with id: netflix.
11:08:17.745 [DEBUG] [.lgwebos.internal.LauncherApplication] - AppInfo maxdome - Maxdome
11:08:17.747 [DEBUG] [.lgwebos.internal.LauncherApplication] - AppInfo netflix - Netflix
11:08:17.749 [DEBUG] [.lgwebos.internal.LauncherApplication] - AppInfo dazn - DAZN
11:08:17.751 [DEBUG] [.lgwebos.internal.LauncherApplication] - AppInfo ui30 - Wuaki.tv
11:08:17.753 [DEBUG] [.lgwebos.internal.LauncherApplication] - AppInfo com.disney.disneyplus-prod - Disney+
11:08:17.755 [DEBUG] [.lgwebos.internal.LauncherApplication] - AppInfo lovefilm.de - Amazon Prime Video
11:08:17.757 [DEBUG] [.lgwebos.internal.LauncherApplication] - AppInfo de.redbutton.hbbtv.app.lg-p7de - ProSieben

More ideas?

hi

use of power channel is correct -
at that point communication with tv is possible

the issue here is that once tv is connected the binding will query the device for all apps (AppInfo). these are then cached.

your command to start netflix arrives before the cache is filled and the binding does not find the appinfo object and thus ignores the command as show in the log message

using the delay is currently the only option i can think of.

btw. the app cache is available also via action getApplications() it would be possible to check if is filled

Hello,

The new channel works quite well. But I’ve the problem that there are e.g. two channels in the tv’s list with the number “1”. One is a TV channel , the other is a radio channel. In my case, if iI choose TV channel “1”, the shown channel name in the sitemap is the (wrong) Radio channel with the number “1”.

Regards,
Olli

Good catch, the number is not unique as you can have channel number N for each “service” (DVB-T TV, DVB-T radio, DVB-S, …). A solution has to be found, probably by extending the number with an additional info, but doing it only for users that encounters this case.

In my case the service is DVB-T2. Here in germany there are TV and Radio Channels(they are actuually internet streams) availible via DVB-T2.
TV:
tv

Radio:
Radio
Regards,
Olli

@Budo

rule "SetUp LGTV simplified"
when
//	Thing "lgwebos:WebOSTV:tv1" changed to ONLINE
	Item lgtvLivPower changed from OFF to ON
then
//	logDebug( filename, "Thing 'lgwebos:WebOSTV:tv1' changed to ONLINE")
	logDebug( filename, "Item lgtvLivPower changed from OFF to ON")
//	Thread::sleep(2000)

    createTimer(now.plusMillis(100), [ | 
        val actions = getActions("lgwebos","lgwebos:WebOSTV:tv1")
        if(null === actions) {
            logInfo("actions", "Actions not found, check thing ID")
            return
        }

        if(sceneSelected) {
            logDebug( filename, "Launch '{}' on LG", setLgtvLivAppLaunch)
            actions.launchApplication(setLgtvLivAppLaunch)
            sceneSelected = false
        }	
    ])
end

Hi Sebastian,

thanks for the quick response! That helps.

Best Budo

Hi @JimT,

that’s cool thanks a lot!

Best Budo

@memphiz : I proposed a fix for your problem.

1 Like

My PRs are now merged and the changes will be available in 2.5.5.
@memphiz : selecting the channel through the UI will now switch to the right channel even if you have several channels with the same number. As command for this channel, you can still use the channel number but you can also use the channel id which is of course the solution when you have several channels with the same number. To know what are the channel ids, there is now a console command to display them.

Great! Works perfect!

Thanks a lot,
Olli

Hint:
You have this error while using NEXT/PREVOIUS?

[INFO ] [.lgwebos.internal.MediaControlPlayer] - Only accept PlayPauseType, RewindFastforwardType, RefreshType. Type was class org.eclipse.smarthome.core.library.types.NextPreviousType.

To get your Player item work correctly use this simple workaround:

rule "Set working Player FASTFORWARD Command"
when 
	TV_Player received command NEXT 
then 
	TV_Player.sendCommand(FASTFORWARD)
end

rule "Set working Player PREVIOUS Command"
when 
	TV_Player received command PREVIOUS 
then 
	TV_Player.sendCommand(REWIND)
end

@Lolodomo:
The fix for the code seems to be simple, too:

From:

import org.eclipse.smarthome.core.library.types.RewindFastforwardType;

to

import org.eclipse.smarthome.core.library.types.NextPreviousType;

...
 else if (NextPreviousType.NEXT== command) {
            handler.getSocket().fastForward(getDefaultResponseListener());
} else if (NextPreviousType.PREVIOUS== command) {
            handler.getSocket().rewind(getDefaultResponseListener());
...

in MediaControlPlayer.java :wink:

Regards,
Olli