HI,
How can i ask in a rule the status - on or off - of a connected LG Webos TV?
Also is there a way to request the app what is running if it is on and the channel number?
I would like to use these as conditions in a rule.
Thanks a lot
PallR
HI,
How can i ask in a rule the status - on or off - of a connected LG Webos TV?
Also is there a way to request the app what is running if it is on and the channel number?
I would like to use these as conditions in a rule.
Thanks a lot
PallR
Hi,
I´m using a simple, not perfect (!) set of rules to see when the TV switches on and which source / channel it is running. You have kids ? Then you can guess why…
They send some information to Telegram and log file when things change.
Maybe it is a starting point you can build on.
Some things can be improved, e.g. not logging the channel in case the input is not “livetv”, …
Regards
Thomas
Items related:
Switch LG_TV0_Power “TV Power” { autoupdate=“false”, channel=“lgwebos:WebOSTV:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx:power” }
String LG_TV0_Channel “Channel [%S]” { channel=“lgwebos:WebOSTV:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx:channelName”}
String LG_TV0_Application “Application [%s]” { channel=“lgwebos:WebOSTV:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx:appLauncher”}
You could use the channel number channel as well:
Number LG_TV0_ChannelNo “Channel [%d]” { channel=“lgwebos:WebOSTV:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx:channel” }
rule “TVON”
when
Item LG_TV0_Power changed from OFF to ON
then
var String app = LG_TV0_Application.state.toString
var bits = app.split(“\.”)
var String outApp = bits.get(bits.size-1);
logInfo(“TV”, “TV switched on”)
sendTelegram(“bot1”, “TV switched on”+“,Source:”+outApp+ “, Channel:”+LG_TV0_Channel.state.toString)
end
rule “TVOFF”
when
Item LG_TV0_Power changed from ON to OFF
then
logInfo(“TV”, “TV switched off”)
sendTelegram(“bot1”, “TV switched off”)
end
rule “TVInputChanged”
when
Item LG_TV0_Application changed
then
var String app = LG_TV0_Application.state.toString
var bits = app.split(“\.”)
var String outApp = bits.get(bits.size-1);
if ( LG_TV0_Power.state == ON){
sendTelegram( “bot1”, “Source:”+outApp+ “, Channel:”+LG_TV0_Channel.state.toString)
logInfo(“TV”, “Source:”+outApp)
}
end