The 2 only things that are not working properly are:
Power ON, but in the doc is said that is not working so far.
DESCRIPTION. Current power setting. TV can only be powered off, not on.
and channels, I cannot get change them the setup.
ITEMS:
Dimmer LG_TV0_Volume "Volume [%S]" { channel="lgwebos:WebOSTV:8c6bbc16-8ef5-4e80-aed4-d0f88417353d:volume" }
Number LG_TV0_VolDummy "VolumeUpDown"
Number LG_TV0_ChannelNo "Channel [%d]" { channel="lgwebos:WebOSTV:8c6bbc16-8ef5-4e80-aed4-d0f88417353d:channel" }
Number LG_TV0_ChannelDummy "ChannelUpDown"
String LG_TV0_Channel "Channel [%S]" { channel="lgwebos:WebOSTV:8c6bbc16-8ef5-4e80-aed4-d0f88417353d:channelNam$
RULES:
// for relative volume changes
rule "VolumeUpDown"
when Item LG_TV0_VolDummy received command
then
switch receivedCommand{
case 0: LG_TV0_Volume.sendCommand(DECREASE)
case 1: LG_TV0_Volume.sendCommand(INCREASE)
}
end
// for relative channel changes
rule "ChannelUpDown"
when Item LG_TV0_ChannelDummy received command
then
switch receivedCommand{
case 0: LG_TV0_ChannelNo.sendCommand(DECREASE)
case 1: LG_TV0_ChannelNo.sendCommand(INCREASE)
}
end
Maybe the rule, we are missing something?
The rest of items works fine, I can open netflix, TV Guide and so on, power is working only to OFF, but not to ON, volumen works fine…
Your LG_TV0_ChannelNo item is a Number item. It doesn’t accept the command INCREASE or DECREASE.
The Volume works because it is a Dimmer item.
Change your code to:
// for relative channel changes
rule "ChannelUpDown"
when Item LG_TV0_ChannelDummy received command
then
val Number Channel = LG_TV0_ChannelNo.state as Number
switch receivedCommand {
case 0: LG_TV0_ChannelNo.sendCommand(Channel - 1)
case 1: LG_TV0_ChannelNo.sendCommand(Channel + 1)
}
end
There may be a problem with that code when the channel number is 1 and you decrease the number
I don’t know if the LG TV accept the channel number 0
You may need to check in the number is 0 and chage it to the max channel number to cycle through the channels
The same goes when you get to the max channel number
Your code would the be: (Assuming that you have 199 channels)
// for relative channel changes
rule "ChannelUpDown"
when Item LG_TV0_ChannelDummy received command
then
if (receivedCommand == NULL) return; do nothing if NULL command received
var Number Channel = LG_TV0_ChannelNo.state as Number
switch receivedCommand {
case 0: Channel = Channel - 1
case 1: Channel = Channel + 1
}
if (Channel == 0) Channel = 199
if (Channel == 200) Channel = 1
LG_TV0_ChannelNo.sendCommand(Channel)
end
val Number Channel = LG_TV0_ChannelNo.state as Number
The rule:
rule "ChannelUpDown"
when Item LG_TV0_ChannelDummy received command
then
val Number Channel = LG_TV0_ChannelNo.state as Number
switch receivedCommand{
case 0: Channel = Channel - 1
case 1: Channel = Channel + 1
}
LG_TV0_ChannelNo.sendCommand(Channel)
end
Whe it is working, I will add the limit channel, but My TV has more than 199 channel
2018-08-29 11:14:07.795 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model 'home.rules' has errors, therefore ignoring it: [431,6]: no viable alternative at input 'Channel'
[434,17]: no viable alternative at input 'Channel'
[434,35]: missing '}' at '-'
[435,9]: mismatched input 'case' expecting 'end'
```
```
rule "ChannelUpDown"
when Item LG_TV0_ChannelDummy received command
then
//Line 431
var Channel = LG_TV0_ChannelNo.state as Number
switch receivedCommand{
case 0: Channel = Channel - 1
case 1: Channel = Channel + 1
}
LG_TV0_ChannelNo.sendCommand(Channel)
end
```
Allright maybe Channel is reserved try changing the name of the variable:
rule "ChannelUpDown"
when Item LG_TV0_ChannelDummy received command
then
var channelNo = LG_TV0_ChannelNo.state as Number
switch receivedCommand {
case 0: channelNo = channelNo - 1
case 1: channelNo = channelNo + 1
}
LG_TV0_ChannelNo.sendCommand(channelNo)
end
yes, that was the issue. I was trying in parallel while waiting your answer, and that was the issue.
Now, is working, cool. Only for changing channel, there is a delay of 3-4 seconds, for volume and other thing, no delay. I guess this is normal, I do not know…
About the issue with Power up, this will be solved in the future?
And, what about for more than 199 channels limitation? My TV has more than 199.
For power the binding can’t turn the TV on because the TV’s API isn’t running while the TV is off. If you look at the binding docs for the WebOS binding I believe they explain how you can power the TV on using the wake on lan binding. I do this with my webos 3.5 TV and it works great.
Actually I have setup the WOL, but something I am missing because is not working the arping. I have this info in the log, and the macaddress is not right, I miss " : "…
I only have this warning, I do not know about what, but everything works fine:
2018-08-29 23:30:25.933 [WARN ] [mmon.WrappedScheduledExecutorService] - Scheduled runnable ended with an exception
java.lang.NullPointerException: null
at org.openhab.binding.lgwebos.internal.BaseChannelHandler.refreshSubscription(BaseChannelHandler.java:59) ~[?:?]
at org.openhab.binding.lgwebos.handler.LGWebOSHandler.lambda$4(LGWebOSHandler.java:210) ~[?:?]
at java.util.HashMap.forEach(HashMap.java:1289) [?:?]
at java.util.Collections$UnmodifiableMap.forEach(Collections.java:1505) [?:?]
at org.openhab.binding.lgwebos.handler.LGWebOSHandler.refreshAllChannelSubscriptions(LGWebOSHandler.java:210) [239:org.openhab.binding.lgwebos:2.3.0]
at org.openhab.binding.lgwebos.handler.LGWebOSHandler.onCapabilityUpdated(LGWebOSHandler.java:156) [239:org.openhab.binding.lgwebos:2.3.0]
at com.connectsdk.device.ConnectableDevice$2.run(ConnectableDevice.java:217) [239:org.openhab.binding.lgwebos:2.3.0]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:?]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [?:?]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
at java.lang.Thread.run(Thread.java:748) [?:?]
```
I seem to get this same exception every time my TV is turned off. I’m sure it’s due to the TV dropping the connection with the binding as it’s powered off.