LGWebOS Binding (for LG WebOS TVs)

Hi There, I just installed OH2 for first time and adding 4 LG tvs with the Webos binding. every time i turn the tv on i creates a new inbox with a different id: here’s a log example.
2019-04-29 10:17:41.382 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing ‘lgwebos:WebOSTV:9b87e8d1-d7c2-4f34-99e3-8b767a8e8a8b’ to inbox.
2019-04-29 10:22:23.640 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing ‘lgwebos:WebOSTV:435115cf-cc2b-4fa3-bd8f-6ab037a5bb65’ to inbox.
2019-04-29 10:25:09.144 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing ‘lgwebos:WebOSTV:5a9b3040-8331-4358-b100-9549f1310db3’ to inbox.
2019-04-29 10:26:39.145 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing ‘lgwebos:WebOSTV:d8c21120-41b4-47b3-b4c4-9085efcb6e2b’ to inbox.
2019-04-29 10:28:17.344 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing ‘lgwebos:WebOSTV:e49e3194-91b7-47aa-a8d6-cd81a4de7287’ to inbox.
2019-04-29 10:29:02.546 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing ‘lgwebos:WebOSTV:f27c3b5b-d427-468a-baf0-6bd4fee9d163’ to inbox.
2019-04-29 10:30:17.809 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing ‘lgwebos:WebOSTV:db3785b3-1518-434b-ae59-6d6ae67bcfe9’ to inbox.
2019-04-29 10:34:20.623 [WARN ] [com.connectsdk.core.Log ] - Connect SDK - already connecting; not trying to connect again: CONNECTING
2019-04-29 10:45:08.778 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing ‘lgwebos:WebOSTV:33adb870-710f-4010-9ea7-27d7e373d9b9’ to inbox.
2019-04-29 10:47:49.305 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing ‘lgwebos:WebOSTV:f632b25f-9aa1-47f2-b967-90a21680e207’ to inbox.
2019-04-29 10:47:52.991 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing ‘lgwebos:WebOSTV:87d6d516-bff7-4cca-8bc9-1822780fbc34’ to inbox.

I thought the the tv would have only one id for configuring a Thing and then an Item.
Can you refer me to doc that show how this works… thanks

Hi @rdsgi

could it be that the user under which you execute openhab has no permission to write to openhab’s userdata folder?. Under userdata there should be a folder lgwebos and a file StoredDevices.

Kind Regards
Sebastian

Interesting.
unfortunately im kind of a noob when it comes to things outside the standard openHAB “rules” and “things” etc.
How do you implement this python script into openHAB and how do i communicate with it using my rules? are there some starting points you can guide me to or maybe even tell us how its done in some tutorial? :innocent:

Hi @sprehn
Any change in “lack of time” area ? :slight_smile:

Hi @sprehn
First of all thanks for your effort! Is there a way to send Button command via API ?
I couldn’t find any API which could be used to send button command. :frowning_face:

Another thing which still a mystery for me is why every time my TV goes OFF/ON I getting a new deviceID ?

Hi,

re new device, maybe a permissions problem. Pls check if this file exists relative to you openhab installation and your openhab user has rw permissions: userdata/lgwebos/StoredDevices

Sebastian

Same issue here on two TVs. Can’t get the toast working. The debug log seems to imply the binding detects the toast as an available function, but sending it a toast command does nothing at all. No errors, nothing.

I’ve actually started experiencing this with new models of WebOS 4.0+ for another platform. Toasts will work with no image data. However, as soon as you send an image the command hangs and won’t even respond with an error. I’ve tried quite a few different image formats, but as soon as the iconData parameter is included with the toast command it will hang.

The same command still works on my old WebOS 3.0 TV. I’m not sure if there’s a work around or a new parameter on 4.0+?

How do you send a toast without image data? In my reading of the docs, it seems to me that if an image is not specified, a default image is sent.

If you exclude the ‘iconData’ and ‘iconExtension’ parameters in the request to the television the television will default to the little chat message icon, but this icon is from the TV itself. It has no problem handling it.

the binding will send the openhab logo per default when triggered via message to toast channel. please experiment with the showToast(icon,text) action in which you can set your own icon.

@sprehn And what about API ? Unfortunately the documentation does not clear on how to use the actions.sendButton("OK")command with API. could you please advise on which API url should be used and how the body should look like ? Thanks!

hi

pls check the example under Rule Action

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

it shows how to obtain the reference to the actions instance in rules.

no api or url required

please experiment with the showToast(icon,text) action in which you can set your own icon

As @rjbouch mentioned, iconData & iconExtension should be excluded in the request.
But it looks like the binding does not support that, Either it sends the default icon or it requires a valid url to a icon.

@sprehn: is it possible to modify the binding to not send iconData & iconExtension ?

I think that should be possible.

Pull Request is #5966

actually finally found some time :slight_smile:

Hi,

would like to inform the community that I am working on a complete rework of this binding.
Have already removed completely connectsdk library and with that a lot of abstraction layers.
Now this binding will natively communicate with the device and use openHABs on-board means to do UPNP discovery, JSON parsing, websocket communication etc… Tonight I was able to connect and control basic functionality on my local TV.

Changes:

  • Removing the ability to set the local ip. UPNP discovery will rely on OHs on-board UPNP discovery. IP can be set in system settings.
  • ipAddress becomes a configuration parameter. So if UPNP discovery does not work, or users don’t want to use it, this binding should still work. ipAddress will be updated by UPNP if ThingID uses the generated one. This is standard OH behavior. If anybody prefers to set Things up manually (e.g. via file or UI) any Thing ID will do. If the thing ID is different to the one discovered by UPNP ipAddress config parameter won’t be updated.
  • detecting whether device is Online or Offline is now independent from UPNP discovery and based on network connectivity
  • no more lgwebos userdata in the file system to store device information. Using openHAB’s thing registry to store all information.

For anyone interested, development is ongoing on this branch:

3 Likes

Thank you Sebastian :slight_smile: any chance to get pre-release version? I have 3 LG tvs…with webos 2.x, 3.x and 4.x

absolutely
just need to finish at least basic testing for all features.
i’ll publish a link shortly, maybe tonight