openhab / openhab-addons

Add-ons for openHAB
https://www.openhab.org/
Eclipse Public License 2.0
1.86k stars 3.58k forks source link

[lgwebos] B7 TV not discovered #4423

Closed olemr closed 3 years ago

olemr commented 5 years ago

Details here

wborn commented 5 years ago

Please provide the details here using the helpful template.

olemr commented 5 years ago

OK, once more:

TV LG B7 not discovered

[lgwebos]

This is the only issue with my system. Forum not able to help further.

Expected Behavior

I was expecting TV to automatically appear in the PaperUI inbox, and especially after initiating a manual search.

Discovery should work.

Current Behavior

No TV discovered

lgwebos log level set to TRACE. No log when attempting manual discovery. Uninstall/Re-install produces this trace:

Uninstall:

    2018-12-21 23:51:06.822 [DEBUG] [org.openhab.binding.lgwebos         ] - ServiceEvent UNREGISTERING - {org.eclipse.smarthome.config.discovery.DiscoveryService, org.openhab.binding.lgwebos.internal.discovery.LGWebOSDiscovery}={service.id=428, service.bundleid=249, service.scope=bundle, localIP=192.168.1.6, service.pid=binding.lgwebos, component.name=org.openhab.binding.lgwebos.internal.discovery.LGWebOSDiscovery, component.id=261} - org.openhab.binding.lgwebos
    2018-12-21 23:51:06.838 [DEBUG] [org.openhab.binding.lgwebos         ] - ServiceEvent UNREGISTERING - {org.eclipse.smarthome.core.thing.binding.ThingHandlerFactory}={service.id=429, service.bundleid=249, service.scope=bundle, localIP=192.168.1.6, service.pid=binding.lgwebos, component.name=org.openhab.binding.lgwebos.internal.LGWebOSHandlerFactory, component.id=262} - org.openhab.binding.lgwebos
    2018-12-21 23:51:07.136 [DEBUG] [org.openhab.binding.lgwebos         ] - BundleEvent STOPPING - org.openhab.binding.lgwebos
    2018-12-21 23:51:07.139 [DEBUG] [org.openhab.binding.lgwebos         ] - ServiceEvent UNREGISTERING - {org.osgi.service.cm.ManagedService}={service.id=427, service.bundleid=249, service.scope=singleton} - org.openhab.binding.lgwebos
    2018-12-21 23:51:07.186 [DEBUG] [org.openhab.binding.lgwebos         ] - BundleEvent STOPPED - org.openhab.binding.lgwebos
    2018-12-21 23:51:07.244 [DEBUG] [org.openhab.binding.lgwebos         ] - BundleEvent UNRESOLVED - org.openhab.binding.lgwebos
    2018-12-21 23:51:07.600 [DEBUG] [org.openhab.binding.lgwebos         ] - BundleEvent UNINSTALLED - org.openhab.binding.lgwebos
    2018-12-21 23:51:09.233 [INFO ] [core.karaf.internal.FeatureInstaller] - Uninstalled 'openhab-binding-lgwebos'

Re-install:

    2018-12-21 23:55:46.185 [DEBUG] [org.openhab.binding.lgwebos         ] - BundleEvent INSTALLED - org.openhab.binding.lgwebos
    2018-12-21 23:55:47.159 [DEBUG] [org.openhab.binding.lgwebos         ] - BundleEvent RESOLVED - org.openhab.binding.lgwebos
    2018-12-21 23:55:47.296 [DEBUG] [org.openhab.binding.lgwebos         ] - BundleEvent STARTING - org.openhab.binding.lgwebos
    2018-12-21 23:55:47.330 [DEBUG] [org.openhab.binding.lgwebos         ] - ServiceEvent REGISTERED - {org.osgi.service.cm.ManagedService}={service.id=436, service.bundleid=251, service.scope=singleton} - org.openhab.binding.lgwebos
    2018-12-21 23:55:47.398 [DEBUG] [org.openhab.binding.lgwebos         ] - ServiceEvent REGISTERED - {org.eclipse.smarthome.config.discovery.DiscoveryService, org.openhab.binding.lgwebos.internal.discovery.LGWebOSDiscovery}={service.id=437, service.bundleid=251, service.scope=bundle, localIP=192.168.1.6, service.pid=binding.lgwebos, component.name=org.openhab.binding.lgwebos.internal.discovery.LGWebOSDiscovery, component.id=263} - org.openhab.binding.lgwebos
    2018-12-21 23:55:47.619 [DEBUG] [.internal.discovery.LGWebOSDiscovery] - Config Parameters: {service.pid=binding.lgwebos, localIP=192.168.1.6, component.name=org.openhab.binding.lgwebos.internal.discovery.LGWebOSDiscovery, component.id=263}
    2018-12-21 23:55:47.623 [DEBUG] [.internal.discovery.LGWebOSDiscovery] - localIP property was explicitly set to: 192.168.1.6
    2018-12-21 23:55:47.657 [DEBUG] [org.openhab.binding.lgwebos         ] - ServiceEvent REGISTERED - {org.eclipse.smarthome.core.thing.binding.ThingHandlerFactory}={service.id=438, service.bundleid=251, service.scope=bundle, localIP=192.168.1.6, service.pid=binding.lgwebos, component.name=org.openhab.binding.lgwebos.internal.LGWebOSHandlerFactory, component.id=264} - org.openhab.binding.lgwebos
    2018-12-21 23:55:47.680 [DEBUG] [org.openhab.binding.lgwebos         ] - BundleEvent STARTED - org.openhab.binding.lgwebos

TV:

  $ ping 192.168.1.243
    PING 192.168.1.243 (192.168.1.243) 56(84) bytes of data.
    64 bytes from 192.168.1.243: icmp_seq=1 ttl=64 time=0.253 ms
    64 bytes from 192.168.1.243: icmp_seq=2 ttl=64 time=0.231 ms
    64 bytes from 192.168.1.243: icmp_seq=3 ttl=64 time=0.239 ms

Possible Solution

Steps to Reproduce (for Bugs)

1. 2.

Context

After installing the lgwebos binding my TV is not discovered.

Why does the binding not discover my TV?

Your Environment

l


    openhab> config:list "(service.pid=binding.lgwebos)"
    ----------------------------------------------------------------
    Pid:            binding.lgwebos
    BundleLocation: null
    Properties:
       localIP = 192.168.1.6
       service.pid = binding.lgwebos
    openhab>
    $ gssdp-discover -i enp2s0f5 --timeout=3 | grep -C3 .243
      Location: http://192.168.1.1:1990/WFADevice.xml
    resource available
      USN:      uuid:54d352f2-b97f-19e6-61aa-7219d7001626::upnp:rootdevice
      Location: http://192.168.1.243:1328/
    resource available
      USN:      uuid:94a5ffa1-8bb8-439c-ad6d-ddc3103f01a2::upnp:rootdevice
      Location: http://192.168.1.243:1412/
    resource available
      USN:      uuid:94a5ffa1-8bb8-439c-ad6d-ddc3103f01a2
      Location: http://192.168.1.243:1412/
    resource available
      USN:      uuid:54d352f2-b97f-19e6-61aa-7219d7001626
      Location: http://192.168.1.243:1328/
    resource available
      USN:      uuid:54d352f2-b97f-19e6-61aa-7219d7001626::urn:schemas-upnp-org:device:MediaRenderer:1
      Location: http://192.168.1.243:1328/
    resource available
      USN:      uuid:94a5ffa1-8bb8-439c-ad6d-ddc3103f01a2::urn:dial-multiscreen-org:service:dial:1
      Location: http://192.168.1.243:1412/
    resource available
      USN:      uuid:54d352f2-b97f-19e6-61aa-7219d7001626::urn:schemas-upnp-org:service:AVTransport:1
      Location: http://192.168.1.243:1328/
    resource available
      USN:      uuid:54d352f2-b97f-19e6-61aa-7219d7001626::urn:schemas-upnp-org:service:ConnectionManager:1
      Location: http://192.168.1.243:1328/
    resource available
      USN:      uuid:54d352f2-b97f-19e6-61aa-7219d7001626::urn:schemas-upnp-org:service:RenderingControl:1
      Location: http://192.168.1.243:1328/
    resource available
      USN:      uuid:d4753582-8f7f-a70a-38cc-47df24556b3f::upnp:rootdevice
      Location: http://192.168.1.243:1201/
    resource available
      USN:      uuid:d4753582-8f7f-a70a-38cc-47df24556b3f
      Location: http://192.168.1.243:1201/
    resource available
      USN:      uuid:d4753582-8f7f-a70a-38cc-47df24556b3f::urn:schemas-upnp-org:device:Basic:1
      Location: http://192.168.1.243:1201/
    resource available
      USN:      uuid:d4753582-8f7f-a70a-38cc-47df24556b3f::urn:lge-com:service:webos-second-screen:1
      Location: http://192.168.1.243:1201/
    resource available
      USN:      uuid:3ddcd1d3-2380-45f5-b069-2c4d54b06bc2::urn:schemas-upnp-org:device:WANConnectionDevice:1
wborn commented 5 years ago

Thanks for the information @olemr ! Maybe @sprehn knows why the binding doesn't work with your LG B7 TV?

sprehn commented 5 years ago

Hi @olemr

did you follow the instructions to enable

TV Settings The TV must be connected to the same network as openHAB. Under network settings allow "LG CONNECT APPS" to connect.

Note: Under general settings allow mobile applications to turn on the TV, if this option is available. In combination with the wake on LAN binding this will allow you to start the TV via openHAB.

olemr commented 5 years ago

I did.

TV is pingable. Wired connection. Mobile TV on is ON. LG Connect Apps is ON.

OH2 PC & TV are on ports on the same eth switch on the back of the router.

Also: just tried the LG TV Plus Android app and it is working fine.

Some additional info. When I bought this TV for my mother almost a year ago, the binding was working. Sometime during spring/summer -18 it was always marked as Offline even though the TV was on.

Yesterday I updated OH2 to the latest snapshot, and noticed that it was still offline. Then I tried uninstalling and re-installing the binding twice. The last time I lifted the attached logs.

sprehn commented 5 years ago

OK. Let's try to rule out another potential source of error: Are you running openhab in a docker container? you would need to run it with option --net=host

olemr commented 5 years ago

Are you running openhab in a docker container?

No docker, and the binding used to work. Could it be some 'leftovers' from the uninstall that causes this?

olemr commented 5 years ago

Or, not entirely sure. Have to read up on docker. Don't really know what it is. Noticed yesterday that Java was updated during the apt-get upgrade, but did not notice the word docker anywhere...

How do I know if openhab came in a docker container or not?

sprehn commented 5 years ago

if you don't know, then you are not running it in docker, I guess. You would start it via

docker run ...

olemr commented 5 years ago
$ docker
The program 'docker' is currently not installed. You can install it by typing:
sudo apt install docker.io

Guess I'm not ...

sprehn commented 5 years ago

Could you enable debug logging for the binding and provide output:

ssh -p 8101 openhab@localhost  // password is habopen
log:set DEBUG org.openhab.binding.lgwebos
olemr commented 5 years ago

But I already provided a TRACE debug under Current behaviour Also a gssdp-discover scan.

sprehn commented 5 years ago

No further log entries after this one?

2018-12-21 23:55:47.680 [DEBUG] [org.openhab.binding.lgwebos         ] - BundleEvent STARTED - org.openhab.binding.lgwebos

Please also set this one to debug: log:set DEBUG com.connectsdk

olemr commented 5 years ago

That is indeed the last log entry from lgwebos.

In karaf, no evidence of any connectsdk

openhab> list -s |grep -i conn
212 │ Active   │  80 │ 1.0.6                  │ org.eclipse.californium.element-connector
openhab>
sprehn commented 5 years ago

that is the library that handles the communication with webos devices. it is included in the binding. it may also generate log messages.

olemr commented 5 years ago

Well, then it looks like it has not been installed. Any way to re-install just the connectsdk?

wborn commented 5 years ago

There's nothing to reinstall. It's a library (JAR) that's embedded into the lgwebos bundle you already have installed:

249 │ Active │ 80 │ 2.5.0.201812210554 │ LG webOS Binding

It won't show up in the bundle list. Did you try raising the log level with log:set DEBUG com.connectsdk to see if it comes up with a clue that helps solving this mystery?

olemr commented 5 years ago
openhab> log:set DEBUG com.connectsdk
openhab>
openhab> list -s | grep webos
251 │ Active   │  80 │ 2.5.0.201812210554     │ org.openhab.binding.lgwebos
openhab> bundle:restart 251
2018-12-23 03:09:54.163 [DEBUG] [org.openhab.binding.lgwebos         ] - ServiceEvent UNREGISTERING - {org.eclipse.smarthome.core.thing.binding.ThingHandlerFactory}={service.id=447, service.bundleid=251, service.scope=bundle, localIP=192.168.1.6, service.pid=binding.lgwebos, component.name=org.openhab.binding.lgwebos.internal.LGWebOSHandlerFactory, component.id=274} - org.openhab.binding.lgwebos
2018-12-23 03:09:54.166 [DEBUG] [org.openhab.binding.lgwebos         ] - ServiceEvent UNREGISTERING - {org.eclipse.smarthome.config.discovery.DiscoveryService, org.openhab.binding.lgwebos.internal.discovery.LGWebOSDiscovery}={service.id=446, service.bundleid=251, service.scope=bundle, localIP=192.168.1.6, service.pid=binding.lgwebos, component.name=org.openhab.binding.lgwebos.internal.discovery.LGWebOSDiscovery, component.id=273} - org.openhab.binding.lgwebos
2018-12-23 03:09:54.172 [DEBUG] [org.openhab.binding.lgwebos         ] - BundleEvent STOPPING - org.openhab.binding.lgwebos
2018-12-23 03:09:54.176 [DEBUG] [org.openhab.binding.lgwebos         ] - ServiceEvent UNREGISTERING - {org.osgi.service.cm.ManagedService}={service.id=445, service.bundleid=251, service.scope=singleton} - org.openhab.binding.lgwebos
2018-12-23 03:09:54.178 [DEBUG] [org.openhab.binding.lgwebos         ] - BundleEvent STOPPED - org.openhab.binding.lgwebos
2018-12-23 03:09:54.181 [DEBUG] [org.openhab.binding.lgwebos         ] - BundleEvent STARTING - org.openhab.binding.lgwebos
2018-12-23 03:09:54.200 [DEBUG] [org.openhab.binding.lgwebos         ] - ServiceEvent REGISTERED - {org.osgi.service.cm.ManagedService}={service.id=448, service.bundleid=251, service.scope=singleton} - org.openhab.binding.lgwebos
2018-12-23 03:09:54.218 [DEBUG] [.internal.discovery.LGWebOSDiscovery] - Config Parameters: {service.pid=binding.lgwebos, localIP=192.168.1.6, component.name=org.openhab.binding.lgwebos.internal.discovery.LGWebOSDiscovery, component.id=275}
2018-12-23 03:09:54.220 [DEBUG] [.internal.discovery.LGWebOSDiscovery] - localIP property was explicitly set to: 192.168.1.6
2018-12-23 03:09:54.224 [DEBUG] [org.openhab.binding.lgwebos         ] - ServiceEvent REGISTERED - {org.eclipse.smarthome.config.discovery.DiscoveryService, org.openhab.binding.lgwebos.internal.discovery.LGWebOSDiscovery}={service.id=449, service.bundleid=251, service.scope=bundle, localIP=192.168.1.6, service.pid=binding.lgwebos, component.name=org.openhab.binding.lgwebos.internal.discovery.LGWebOSDiscovery, component.id=275} - org.openhab.binding.lgwebos
2018-12-23 03:09:54.249 [DEBUG] [org.openhab.binding.lgwebos         ] - ServiceEvent REGISTERED - {org.eclipse.smarthome.core.thing.binding.ThingHandlerFactory}={service.id=450, service.bundleid=251, service.scope=bundle, localIP=192.168.1.6, service.pid=binding.lgwebos, component.name=org.openhab.binding.lgwebos.internal.LGWebOSHandlerFactory, component.id=276} - org.openhab.binding.lgwebos
2018-12-23 03:09:54.252 [DEBUG] [org.openhab.binding.lgwebos         ] - BundleEvent STARTED - org.openhab.binding.lgwebos
olemr commented 5 years ago

I just fired up an older OH2 on my Windows laptop. There the TV was discovered as soon as the binding was installed (from PaperUI). image

This was 2.3.0-SNAPSHOT Build #1281

openhab> list -s | grep -i lgwebos
220 | Active   |  80 | 2.3.0.201805271653     | org.openhab.binding.lgwebos
sprehn commented 5 years ago

Hi, it must have sth to do with receiving the TV's response to the ssdp search requests. I suspect the requests go out fine, cause to my knowledge the TV only response with urn:lge-com:service:webos-second-screen:1 when a specific search request goes out on the network. And this is present in your ssdp discovery results. But for some reason the response is not noticed by the binding. Did you try using network auto discovery (setting no local IP address at all) or setting openHAB's primary IP address, which may be configured under paper ui network settings?

wborn commented 5 years ago

It would also be interesting to know if it works with 2.5.0-SNAPSHOT on the Windows machine. It helps with eleminating OS/network config variables.

olemr commented 5 years ago

Did you try using network auto discovery (setting no local IP address at all) or setting openHAB's primary IP address, which may be configured under paper ui network settings?

Yes, tried all permutations of the two settings.

Just trying latest 2.5.0 Snapshot on Win now. (downloading ...)

olemr commented 5 years ago

Windows snapshot 2.5.0-SNAPSHOT Build #1472 has the same bug. When I left the old Win install, the TV was in the Inbox. I never added it as a thing. After unzipping the new snapshot over the old, it disappeared from the inbox, noting is hidden. Manual scan turns up nothing.

wborn commented 5 years ago

Maybe it's due to the lines that got commented with #4292:

https://github.com/openhab/openhab2-addons/blob/1aa10d8f3e05db6a0bd12a2127544a2de8e768e9/addons/binding/org.openhab.binding.lgwebos/src/main/java/org/openhab/binding/lgwebos/internal/discovery/LGWebOSDiscovery.java#L118-L123

It would also be better if the README got updated so it uses localIP instead of LocalIP @sprehn . @olemr is using it the correct way though.

wborn commented 5 years ago

Maybe you can test this org.openhab.binding.lgwebos-2.5.0-SNAPSHOT.jar where the commented lines are uncommented (https://github.com/wborn/openhab2-addons/commit/51eb4b42bd1b01e6b7b1b7c37218b6cfc2e0b98c)?

openhab> list | grep LG
209 │ Active   │  80 │ 2.5.0.201812222247     │ LG webOS Binding
openhab> update 209 https://github.com/wborn/openhab2-addons/releases/download/lgwebos-bugfix-release/org.openhab.binding.lgwebos-2.5.0-SNAPSHOT.jar
openhab> list | grep LG
209 │ Active   │  80 │ 2.5.0.201812231629     │ LG webOS Binding

I don't use this binding myself. :wink:

olemr commented 5 years ago

Will do, when xmas preparations permit 😊

sprehn commented 5 years ago

Trying to reproduce this: Just upgraded my personal installation to 2.4 stable and it still all works fine. (on linux), also with explicit IP set.

sprehn commented 5 years ago

Maybe it's due to the lines that got commented with #4292:

openhab2-addons/addons/binding/org.openhab.binding.lgwebos/src/main/java/org/openhab/binding/lgwebos/internal/discovery/LGWebOSDiscovery.java Lines 118 to 123 in 1aa10d8 @Override public void onDeviceUpdated(DiscoveryManager manager, ConnectableDevice device) { logger.debug("Device updated: {}", device); // thingRemoved(createThingUID(device)); // thingDiscovered(createDiscoveryResult(device)); }

Don't think it is related. These two lines were just removing and adding the discovery result with identical thing id and therefore obsolete. We should see a lot of debug statements from connect sdk even before capabilities are updated, like so...

2018-12-23 20:55:27.096 [DEBUG] [com.connectsdk.core.Log             ] - Connect SDK - Service added: Fernseher (webOS TV)
2018-12-23 20:55:27.098 [DEBUG] [com.connectsdk.core.Log             ] - Connect SDK - Adding service webOS TV to device with address 192.168.2.119 and id 3aab9eea-953b-4272-bdbd-f0cd0ecf4a46
2018-12-23 20:55:27.113 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing 'lgwebos:WebOSTV:3aab9eea-953b-4272-bdbd-f0cd0ecf4a46' to inbox.

It would also be better if the README got updated so it uses localIP instead of LocalIP @sprehn

It is a capital "L" in the PaperUI config page. ... I mean, I am open. users of PaperUI would still get it, but those who manually configure via files, may need it as "localIP"

sprehn commented 5 years ago

Also tried with 2.5-snapshot and it worked as expected.

olemr commented 5 years ago

Hm, I was a bit too quick when trying out @wborn 's karaf commands. My lgwebos bundle was 252, but I issued the update command on bundle 209, hence wrongly updating Apache HttpClient OSGi bundle and ended up with 2 lgwebos bundles. Deleted them and re-installed, but now, when I try to start it I get:

openhab> bundle:start 253
Error executing command: Error executing command on bundles:
        Error starting bundle 253: Could not resolve module: org.openhab.binding.lgwebos [253]
  Unresolved requirement: Import-Package: org.apache.http.client.methods

Could you help me with the syntax for restoring org.apache.http.client.methods please?

olemr commented 5 years ago

I got it back after an apt-get upgrade. @wborn, I tried your binding, but no joy. Still nothing. @sprehn, this is trange ...

lolodomo commented 4 years ago

@olemr : this discussion is very old now. Is your problem solved with OH 2.5.3 ? If not, I can help you finding the reason.

olemr commented 4 years ago

@lolodomo : I havn't been able to test. This particular installation is at my mother's 140km away, and it's still on 2.5.0M3 Since I cannot go there these days, I dare not touch anything remotely in case something goes wrong.

I just use use the Harmony HUB to control her TV, and it works fine.

MortenVinding commented 4 years ago

I have a problem I hope is somewhat related. Please excuse me if i'm wrong.

My problem is not that the binding can't find my TV, it finds it just fine, but some time, maybe when going from 2.4 to 2.5 it stopped auto discovering it after it has been shutoff. I can restart the binding using: bundle:restart "openHAB Add-ons :: Bundles :: LG webOS Binding" and the binding finds the TV again.

Not really sure how to debug this.

The TV is a OLED66B6V and I'm running openHAB 2.5.3 Release Build on Openhabian on a RPi3

lolodomo commented 4 years ago

"it has been shutoff": the TV or the binding ?

MortenVinding commented 4 years ago

Okay maybe not total clear there... When I turn the TV off and on again, the binding no longer see it. But if I restart the binding it finds the TV again.

hmerk commented 3 years ago

closed due to inactivity