[SOLVED] LG TV binding Netcast 3.0 issue connecting with TV

no need to restart
changes to the lgtv.cfg should be immediate

I just tried changing to 8080 for few minutes but log was still throwing error related to port 60128.

2018-12-07 19:09:36.489 [ERROR] [binding.lgtv.internal.LgtvConnection] - IO Exception at Connection to: http://192.168.1.19:60128/udap/api/pairing
2018-12-07 19:09:36.492 [INFO ] [binding.lgtv.internal.LgtvConnection] - sendpairkey with result=#error/connect-1 connectionstatus=CS_NOTCONNECTED

Yeah, this is unknown which port to use it for start.

try to restart your OH2 service just to be sure… changes to *.cfg files are read and implemented immediately by OH2 usually but there maybe some quartz scheduler still running in the background with the old parameters…

these guys made it work with 8080…

What`s the correct command to restart openhab service ?
I was normally restarting RPI with sudo reboot

no need to reboot the entire rPi
you are in the Linux world now where uptime is important :slight_smile:

sudo systemctl restart openhab2

Thanks. After changing port to 8080 and restarting service it looks like its connected this time according to log.

2018-12-07 19:22:06.510 [ERROR] [ab.binding.lgtv.internal.LgtvBinding] - cannot find device lg
2018-12-07 19:22:06.513 [ERROR] [ab.binding.lgtv.internal.LgtvBinding] - cannot find device lg
2018-12-07 19:22:06.520 [ERROR] [ab.binding.lgtv.internal.LgtvBinding] - cannot find device lg
2018-12-07 19:22:06.523 [ERROR] [ab.binding.lgtv.internal.LgtvBinding] - cannot find device lg
2018-12-07 19:22:06.526 [ERROR] [ab.binding.lgtv.internal.LgtvBinding] - cannot find device lg
2018-12-07 19:22:06.573 [INFO ] [lgtv.lginteraction.LgTvMessageReader] - Started LgTv Servlet at /udap/api/event
2018-12-07 19:22:06.576 [ERROR] [binding.lgtv.internal.LgtvConnection] - sendtotv but connection status is CS_NOTCONNECTED
2018-12-07 19:22:06.593 [INFO ] [binding.lgtv.internal.LgtvConnection] - lgtv connectionstatus of ip=192.168.1.19 changed from CS_NOTCONNECTED to CS_PAIRED
2018-12-07 19:22:06.596 [INFO ] [binding.lgtv.internal.LgtvConnection] - sendpairkey with result=200 successconnectionstatus=CS_PAIRED

So now need to solve items and sitemap for this tv , still something isn`t right with my syntax here

sitemap

}
Frame label=“Tv” {
Switch item=LgTvConnStatus
Switch item=LgTvPower mappings=[ON=“Power Off”]
Setpoint item=LgTvChannel minValue=0 maxValue=300 step=1.0
Setpoint item=LgTvVolume minValue=0 maxValue=100 step=1.0
Switch item=LgTvMute mappings=[ON=“Mute”, OFF=“Mute”]
Text item=LgTvChannelName
Selection item=LgTvChannel mappings=[1=“ORF1”,2=“ORF2”]
Switch item=LgTvAppExecute label=“AppExecute” mappings=[Skype=Skype, Spotify=Spotify]
Switch item=LgTvAppTerminate label=“AppTerminate” mappings=[Skype=Skype, Spotify=Spotify]
}
}

items

/* LGTV */
Switch LgTvPower                        "Power Command"                 (GF_Living)     {lgtv="ON:lg:POWER"}
Switch LgTvMute                         "Mute"                          (GF_Living)     {lgtv="ON:lg:KEY_MUTE, OFF:lg:KEY_MUTE"}
Number LgTvVolume                       "lgVolume [%.1f]"               (GF_Living)     {lgtv="INIT:lg:VOLUME_CURRENT, INCREASE:lg:VOLUME_UP, DECREASE:lg:VOLUME_DOWN, *:lg:VOLUME_SET"}
Number LgTvChannel                      "Channel [%.1f]"                (GF_Living)     {lgtv="INIT:lg:CHANNEL_CURRENTNUMBER, INCREASE:lg:CHANNEL_UP, DECREASE:lg:CHANNEL_DOWN, *:lg:CHANNEL_SET" }
String LgTvChannelName                  "Channelname [%s]"              (GF_Living)     {lgtv="INIT:lg:CHANNEL_CURRENTNAME"}
String LgTvGetChannels                  "getchannels [%s]"              (GF_Living)     {lgtv="INIT:lg:GET_CHANNELS, ON:lg:GET_CHANNELS"}
String LgTvGetApps                      "getapps [%s]"                  (GF_Living)     {lgtv="INIT:lg:GET_APPS, ON:lg:GET_APPS"}
String LgTvAppExecute                   "excuteapp"                     (GF_Living)     {lgtv="*:lg:APP_EXECUTE"}
String LgTvAppTerminate                 "terminateapp"                  (GF_Living)     {lgtv="*:lg:APP_TERMINATE"}
Switch LgTvConnStatus                   "connstatus "                   (GF_Living)     {lgtv="*:lg:CONNECTION_STATUS"} 


Not trying to butt in, just following the thread and learning,:grinning: but:

FYI, It’s best to stop OH from running before rebooting.

1 Like

Thanks H102. Is there a command to stop openhab2 before restarting RPI ?

guys @vzorglub @H102 we have found another documentation issue!
unbelievable… who would expect to find 2 inaccuracies in the same day against such perfect docs ! :blush: (joking of course :slight_smile:)

port default is 8080 versus docs showing 60128

wait for more corrections… I think PR 5726 will be 2 pages long … :stuck_out_tongue:

now we debug Andy’s sitemap and Items

1 Like

Use the same command @Dim provided above.

sudo systemctl stop openhab2

And just something to keep in your back pocket, if you need to clean the cache and tmp files b/c of weird things showing up in the logs or as a first step in troubleshooting.

First, stop OH
sudo systemctl stop openhab2
then
sudo openhab-cli clean-cache
and start back up
sudo systemctl start openhab2

Great - thanks a lot, I made a note for future.

1 Like

syntax of both sitemap (the partial entries that you posted) and Items file looks good to me…

what do you see in the logs now?

@Dim think setting the logs to DEBUG will help? Also the doc’s mention that turning the T.V. on is not possible, scrape that item?

For those who try to POWER ON - LgTV shuts down the network port so only power off is availiable :sob:

#

But that could be incorrect as well.:smile:

got it: wrong alias used lg in the binding config:

Switch LgTvPower                        "Power Command"                 (GF_Living)     {lgtv="ON:wohnzimmer:POWER"}
Switch LgTvMute                         "Mute"                          (GF_Living)     {lgtv="ON:wohnzimmer:KEY_MUTE, OFF:wohnzimmer:KEY_MUTE"}
Number LgTvVolume                       "lgVolume [%.1f]"               (GF_Living)     {lgtv="INIT:wohnzimmer:VOLUME_CURRENT, INCREASE:wohnzimmer:VOLUME_UP, DECREASE:wohnzimmer:VOLUME_DOWN, *:wohnzimmer:VOLUME_SET"}
Number LgTvChannel                      "Channel [%.1f]"                (GF_Living)     {lgtv="INIT:wohnzimmer:CHANNEL_CURRENTNUMBER, INCREASE:wohnzimmer:CHANNEL_UP, DECREASE:wohnzimmer:CHANNEL_DOWN, *:wohnzimmer:CHANNEL_SET" }
String LgTvChannelName                  "Channelname [%s]"              (GF_Living)     {lgtv="INIT:wohnzimmer:CHANNEL_CURRENTNAME"}
String LgTvGetChannels                  "getchannels [%s]"              (GF_Living)     {lgtv="INIT:wohnzimmer:GET_CHANNELS, ON:wohnzimmer:GET_CHANNELS"}
String LgTvGetApps                      "getapps [%s]"                  (GF_Living)     {lgtv="INIT:wohnzimmer:GET_APPS, ON:wohnzimmer:GET_APPS"}
String LgTvAppExecute                   "excuteapp"                     (GF_Living)     {lgtv="*:wohnzimmer:APP_EXECUTE"}
String LgTvAppTerminate                 "terminateapp"                  (GF_Living)     {lgtv="*:wohnzimmer:APP_TERMINATE"}
Switch LgTvConnStatus                   "connstatus "                   (GF_Living)     {lgtv="*:wohnzimmer:CONNECTION_STATUS"} 

(let’s hope that the docs are not wrong… even here :stuck_out_tongue:
Ref: https://www.openhab.org/addons/bindings/lgtv1/#examples

The latest lines from openhab2 log , strangely the last entry was 20 minutes ago…

2018-12-07 19:22:06.510 [ERROR] [ab.binding.lgtv.internal.LgtvBinding] - cannot find device lg
2018-12-07 19:22:06.513 [ERROR] [ab.binding.lgtv.internal.LgtvBinding] - cannot find device lg
2018-12-07 19:22:06.520 [ERROR] [ab.binding.lgtv.internal.LgtvBinding] - cannot find device lg
2018-12-07 19:22:06.523 [ERROR] [ab.binding.lgtv.internal.LgtvBinding] - cannot find device lg
2018-12-07 19:22:06.526 [ERROR] [ab.binding.lgtv.internal.LgtvBinding] - cannot find device lg
2018-12-07 19:22:06.573 [INFO ] [lgtv.lginteraction.LgTvMessageReader] - Started LgTv Servlet at /udap/api/event
2018-12-07 19:22:06.576 [ERROR] [binding.lgtv.internal.LgtvConnection] - sendtotv but connection status is CS_NOTCONNECTED
2018-12-07 19:22:06.593 [INFO ] [binding.lgtv.internal.LgtvConnection] - lgtv connectionstatus of ip=192.168.1.19 changed from CS_NOTCONNECTED to CS_PAIRED
2018-12-07 19:22:06.596 [INFO ] [binding.lgtv.internal.LgtvConnection] - sendpairkey with result=200 successconnectionstatus=CS_PAIRED
2018-12-07 19:22:14.125 [WARN ] [org.apache.felix.fileinstall        ] - Error while starting bundle: file:/usr/share/openhab2/addons/org.openhab.persistence.logging-1.8.3.jar
org.osgi.framework.BundleException: Could not resolve module: org.openhab.persistence.logging [192]
  Unresolved requirement: Import-Package: ch.qos.logback.classic

	at org.eclipse.osgi.container.Module.start(Module.java:444) [?:?]
	at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:383) [?:?]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1260) [9:org.apache.felix.fileinstall:3.6.4]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1233) [9:org.apache.felix.fileinstall:3.6.4]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.startAllBundles(DirectoryWatcher.java:1221) [9:org.apache.felix.fileinstall:3.6.4]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:515) [9:org.apache.felix.fileinstall:3.6.4]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:365) [9:org.apache.felix.fileinstall:3.6.4]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:316) [9:org.apache.felix.fileinstall:3.6.4]

Need to add persistence to the item? Just guessing, as its not mention in the doc’s

fix your Items as in the example

change the alias from lg

Switch LgTvPower                        "Power Command"                 (GF_Living)     {lgtv="ON:lg:POWER"}

to lgtv in all Item binding configs:

Switch LgTvPower                        "Power Command"                 (GF_Living)     {lgtv="ON:lgtv:POWER"}
1 Like

this is something else I think (not related to the lgtv binding)…
Andy: why did you install this addon jar?
(/usr/share/openhab2/addons/org.openhab.persistence.logging-1.8.3.jar)

Nice catch @Dim, :+1:

1 Like