LGWebOS Binding (for LG WebOS TVs)

The binding is basically working for my TV, with few exceptions:

  • I often get the following warning (although the TV is off):

Duplicate resource 3de40538-20c0-4f6c-9d51-ea9f5c14d8a5. Could be caused by a dead connection not detected by your server. Replacing the old one with the fresh one

  • The welcome-toast is a nice hint for the first test, but afterwards it is quite annoying (my wife always asks what that is). Please, could you make that optional?
  • As soon as I launch your sample sitemap in Habdroid with the TV switched on, the channel jumps to the first one configured in the Selection (might be a bug of Habdroid though?). I resolved this by simply removing that sitemap entry.
  • Nice work reducing the final jar size :slight_smile: still, please try to remove as many libs as possible, e.g. by importing already existing libs such as httpcore/httpclient.
  • My two cents about the toast image: the openhab icon should be fine for the current state of the binding. As soon as all other issues are resolved (and the binding is ready for a pull request), we could discuss whether and how the image could be customized.

OT: officially it is not possible with Webos 2 to use Simplink and optical audio at the same time. Did anyone of you get that working anyway?

Keep up the good work!

Hi,

Re duplicate resource, could you share some logs. I have never seen this kind of message.

Re welcome toast. I will remove it from the binding in the next release. Indeed this was more meant for easy debugging in the beginning. Behavior can easily be recreated and customized with a rule:

rule "Welcome Message"
when 
Item LG_TV0_Power changed to ON
then
	LG_TV0_Toast.sendCommand("Willkommen bei Openhab!")
end

Re jar size: I tried removing the two jars, but then the binding does not work. Is there a better way then trial and error to know which packages are exported by the basic installation?

New version without the welcome toast message released

Hi Sebastian, thank you for your newest release. I have noticed that my TV sometimes doesn’t connect to openHAB. There is a message like “Connection was aborted”. I will post a screenshot with logs when i come home later. So 40 % of my connections are aborted. Other things are working really well and stable.

Okay, sorry for my late answer.

Here is my screenshot in the console:

In the Logs there isn’t anything related to this.

To get Connected again i have to restart the TV or restart openHAB. But it could be that the connection will be aborted a second or a third time. (It failed 4 times in a row when i tested it today.)

BTW: Tested on Raspberry Pi 2 and Raspberry Pi B+

Hi

so the Connection refused by thr TV.
Under your TVs Settings in the Network section, did you enable lg connect apps?

Also please ensure that you confirm the pairing request on your tv screen.

Sebastian

Sure, the Connect Apps are enabled and also i confirmed the pairing on the device. Sometimes it works, so the TV gets connected, other times it will not connect, until i restart openHAB.
Could it be, because my TV is connected with Wifi?

If not, i would say that it has something to do with the Binding.

If connection is refused then there is no port open on other side of the network.
Are you sure your network is stable and your tv has a permanent ip.
I currently have no other idea.
Otherwise. Please send a log file with debugging enabled. This is how we were able to trace a few other issues in this thread.

I noticed that these libs are indeed used by other addons, however, they are not exported. Especially not by any core packages. In OH2 httpclient, httpcore jmdns may be exported (not confirmed) but to make it runnable in 1.8 they have to be packaged.
lib/json-20140107.jar, <- e.g. io.myopenhab
lib/httpclient-4.0.2.jar, <- e.g. cups
lib/httpcore-4.0.1.jar <- e.g. cups

As a next step I will attempt to test this with Openhab2, as this seems to be the new policy for acceptance into the main project. I have to test yet another plugin. But first I have to setup a openhab2 test instance, might take some time


My network is stable, don’t know what happens here, i will post a log file with debugging enabled later.

About openHAB 2 compatibility, i will test this later too, have a openhab2 instance up and running.

@sprehn: thanks for clarifying these dependencies, I didn’t know that they are only provided in OH2 and not in OH1 (I came accross this issue in the ESH FS Internet Radio binding, so I guess these libs are already provided by ESH).

Btw, I checked the logs about the ‘Duplicate resource’ warnings (openhab.log) but there are no further entries. The TV was off during that time. I assume the next step would be to increase log level to DEBUG


One more question, concerning functionality: do you see any possibility to trigger record or pause (timeshift)?

Okay, i have a new Provlem, after switching to the “apt-get install openhab-runtime” method, my TV gets connected everytime I restart openHAB. When turning the TV off and on it doesn’t get reconnected. I managed to give write access to the etc folder for the “storedDevices” file. But that isn’t doing the trick. Maybe someone have a other idea.

Screenshot of the Log:

As you can see on 20:42 the device is disconnecting and on 20:43 it was turned on again, but no “Device Ready” message appeared.

I checked connectsdk code but I cannot find any support for recording.

@viruz: In order to help you I would need a log file (not just the screenshot) with debug level logging enabled.

Sure no problem,

here you have a log file from starting of openhab to successfull connection of the TV, then i turned off the TV and On again.

http://pastebin.com/XpSgRs5u

Hi

well, I don’t have an answer yet, but the key lines are 685 and 686. Directly after device discovery connect sdk disconnects the device again.

18:37:12.756 [INFO ] [b.c.internal.ConnectSDKBinding:208 ] - added: {“modelName”:“LG Smart TV”,“lastConnected”:9223372036854775807,“lastKnownIPAddress”:“192.168.178.125” 

18:37:12.789 [DEBUG] [b.c.internal.ConnectSDKBinding:234 ] - Device disconnected: {“modelName”:“LG Smart TV”,“lastConnected”:9223372036854775807,“lastKnownIPAddress”:“192.168.178.125”


Once the binding discovers a new device it checks if any items are configured for it. You have items configured, so next step is that it will attempt to connect to the device. For some reason this fails immediately (only 33ms later) and thus disconnect gets called. We have to understand why the connection cannot be established.

I am also confused why there are no further log statements, that would give a clue on the root cause.

Now, connection to the TV works exactly once, after openhab start and fails for any consecutive TV starts? Does it work when you try it several minutes, or an hour later, without restarting openhab?

Hi,

thanks for your answer,

so the Connection to the TV works the first time after openhab start, and sometimes it connects also a 2nd time when you wait a day or longer, but then it won`t connect again, even after 10 days. So if you have luck it connects 2 times after openhab start. The only connection that is working every time is the first connection after openhab start. 2nd Connection after one or two days is more luck.

Cheers,

Pascal

Are you still working on this?

Hi,
I really have no idea, what could cause this behavior and how to reproduce. I run the plugin on a day to day basis and it runs 100% stable.

Sebastian