home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.8k stars 30.89k forks source link

WebosTv autodiscovery is failing when host is missing #4128

Closed rofrantz closed 8 years ago

rofrantz commented 8 years ago

Home Assistant release (hass --version): 0.32.0.dev0

Python release (python3 --version): 3.5.2

Component/platform: netdisco, webostv

Description of problem: In the docs it's specified that the host is optional for the webos media player, but the this is not autodiscovered

This is what I see in the logs:

16-10-30 03:56:38 homeassistant.components.media_player.webostv: No TV found in configuration file or with discovery

Expected: Webos TV to be auto discovered

Problem-relevant configuration.yaml entries and steps to reproduce:

media_player LG_TV:
  platform: webostv
  name: LG TV Dormitor
  customize:
    sources:
      - livetv
      - youtube
fabaff commented 8 years ago

What's the output of the command below?

$ python3 -m netdisco
rofrantz commented 8 years ago

Thanks @fabaff for looking into it; afraid that some Halloween ghosts might close this issue, I've done the same last night and discovered the issue which lies in netdisco.

I have a newer lgtv model (web3.0) where the search for the device with

{
        "deviceType": "urn:dial-multiscreen-org:device:dial:1",
        "friendlyName": "[LG] webOS TV"
}

doesn't work anymore.

See https://github.com/home-assistant/netdisco/blob/master/netdisco/discoverables/webos_tv.py#L17. The reasons why I'm saying this are based on a) lunching the command python3.5 -m netdisco dump|grep 118 (the actual IP of the tv) which returns:

[ UPNPEntry upnp:rootdevice - http://192.168.4.118:1164, UPNPEntry upnp:rootdevice - http://192.168.4.118:1532, UPNPEntry uuid:3f308dea-52a7-9e24-a9e0-917db87e23b6 - http://192.168.4.118:1164, UPNPEntry uuid:f2954cc1-dfc4-3aaa-9ece-5e6911100163 - http://192.168.4.118:1532, UPNPEntry urn:schemas-upnp-org:device:MediaRenderer:1 - http://192.168.4.118:1164, UPNPEntry urn:schemas-upnp-org:device:Basic:1 - http://192.168.4.118:1532, UPNPEntry urn:schemas-upnp-org:service:AVTransport:1 - http://192.168.4.118:1164, UPNPEntry urn:lge-com:service:webos-second-screen:1 - http://192.168.4.118:1532, UPNPEntry urn:schemas-upnp-org:service:ConnectionManager:1 - http://192.168.4.118:1164, UPNPEntry urn:schemas-upnp-org:service:RenderingControl:1 - http://192.168.4.118:1164, UPNPEntry upnp:rootdevice - http://192.168.4.118:1164, UPNPEntry upnp:rootdevice - http://192.168.4.118:1532 ]

b) https://github.com/msloth/lgtv.js/issues/15

So in conclusion we should look also for urn:lge-com:service:webos-second-screen:1 (and don't remove the existing code in order not to break older tv models/firmware discoveries and based on the debug output from below we should probably look for a new pair like they do it for the other model

{
    'manufacturer': 'LG Electronics.',
    'modelName': ['LG TV','LG Smart TV']
}

Or something like that; unfortunatelly I didn't had time last night to actually finish solving the bug in netdisco.

Below you have the actual output that I get when filtering for SSDP:

{'UDN': 'uuid:3f308dea-52a7-9e24-a9e0-917db87e23b6',
 'X_DLNADOC': 'DMR-1.50',
 'X_LG_DLNA_DOC': '1.0',
 'X_compatibleId': 'MS_DigitalMediaDeviceClass_DMR_V001',
 'X_deviceCategory': ['MediaDevices', 'Multimedia.DMR'],
 'X_modelId': 'LG Digital Media Renderer TV',
 'deviceType': 'urn:schemas-upnp-org:device:MediaRenderer:1',
 'friendlyName': '[LG] webOS TV UH7507',
 'manufacturer': 'LG Electronics.',
 'manufacturerURL': 'http://www.lge.com',
 'modelDescription': 'LG WebOSTV DMRplus',
 'modelName': 'LG TV',
 'modelNumber': '1.0',
 'modelURL': None,
 'serialNumber': None,
 'serviceList': {'service': [{'SCPDURL': '/AVTransport/3f308dea-52a7-9e24-a9e0-917db87e23b6/scpd.xml',
                              'controlURL': '/AVTransport/3f308dea-52a7-9e24-a9e0-917db87e23b6/control.xml',
                              'eventSubURL': '/AVTransport/3f308dea-52a7-9e24-a9e0-917db87e23b6/event.xml',
                              'serviceId': 'urn:upnp-org:serviceId:AVTransport',
                              'serviceType': 'urn:schemas-upnp-org:service:AVTransport:1'},
                             {'SCPDURL': '/ConnectionManager/3f308dea-52a7-9e24-a9e0-917db87e23b6/scpd.xml',
                              'controlURL': '/ConnectionManager/3f308dea-52a7-9e24-a9e0-917db87e23b6/control.xml',
                              'eventSubURL': '/ConnectionManager/3f308dea-52a7-9e24-a9e0-917db87e23b6/event.xml',
                              'serviceId': 'urn:upnp-org:serviceId:ConnectionManager',
                              'serviceType': 'urn:schemas-upnp-org:service:ConnectionManager:1'},
                             {'SCPDURL': '/RenderingControl/3f308dea-52a7-9e24-a9e0-917db87e23b6/scpd.xml',
                              'controlURL': '/RenderingControl/3f308dea-52a7-9e24-a9e0-917db87e23b6/control.xml',
                              'eventSubURL': '/RenderingControl/3f308dea-52a7-9e24-a9e0-917db87e23b6/event.xml',
                              'serviceId': 'urn:upnp-org:serviceId:RenderingControl',
                              'serviceType': 'urn:schemas-upnp-org:service:RenderingControl:1'}]}}
{'UDN': 'uuid:f2954cc1-dfc4-3aaa-9ece-5e6911100163',
 'deviceType': 'urn:schemas-upnp-org:device:Basic:1',
 'friendlyName': '[LG] webOS TV UH7507',
 'manufacturer': 'LG Electronics',
 'manufacturerURL': 'http://www.lge.com',
 'modelDescription': None,
 'modelName': 'LG Smart TV',
 'modelNumber': '43UH7507-ZA',
 'modelURL': 'http://www.lge.com',
 'serialNumber': None,
 'serviceList': {'service': {'SCPDURL': '/WebOS_SecondScreen/f2954cc1-dfc4-3aaa-9ece-5e6911100163/scpd.xml',
                             'controlURL': '/WebOS_SecondScreen/f2954cc1-dfc4-3aaa-9ece-5e6911100163/control.xml',
                             'eventSubURL': '/WebOS_SecondScreen/f2954cc1-dfc4-3aaa-9ece-5e6911100163/event.xml',
                             'serviceId': 'urn:lge-com:serviceId:webos-second-screen-3000-3001',
                             'serviceType': 'urn:lge-com:service:webos-second-screen:1'}}}
{'UDN': 'uuid:f2954cc1-dfc4-3aaa-9ece-5e6911100163',
 'deviceType': 'urn:schemas-upnp-org:device:Basic:1',
 'friendlyName': '[LG] webOS TV UH7507',
 'manufacturer': 'LG Electronics',
 'manufacturerURL': 'http://www.lge.com',
 'modelDescription': None,
 'modelName': 'LG Smart TV',
 'modelNumber': '43UH7507-ZA',
 'modelURL': 'http://www.lge.com',
 'serialNumber': None,
 'serviceList': {'service': {'SCPDURL': '/WebOS_SecondScreen/f2954cc1-dfc4-3aaa-9ece-5e6911100163/scpd.xml',
                             'controlURL': '/WebOS_SecondScreen/f2954cc1-dfc4-3aaa-9ece-5e6911100163/control.xml',
                             'eventSubURL': '/WebOS_SecondScreen/f2954cc1-dfc4-3aaa-9ece-5e6911100163/event.xml',
                             'serviceId': 'urn:lge-com:serviceId:webos-second-screen-3000-3001',
                             'serviceType': 'urn:lge-com:service:webos-second-screen:1'}}}
{'UDN': 'uuid:f2954cc1-dfc4-3aaa-9ece-5e6911100163',
 'deviceType': 'urn:schemas-upnp-org:device:Basic:1',
 'friendlyName': '[LG] webOS TV UH7507',
 'manufacturer': 'LG Electronics',
 'manufacturerURL': 'http://www.lge.com',
 'modelDescription': None,
 'modelName': 'LG Smart TV',
 'modelNumber': '43UH7507-ZA',
 'modelURL': 'http://www.lge.com',
 'serialNumber': None,
 'serviceList': {'service': {'SCPDURL': '/WebOS_SecondScreen/f2954cc1-dfc4-3aaa-9ece-5e6911100163/scpd.xml',
                             'controlURL': '/WebOS_SecondScreen/f2954cc1-dfc4-3aaa-9ece-5e6911100163/control.xml',
                             'eventSubURL': '/WebOS_SecondScreen/f2954cc1-dfc4-3aaa-9ece-5e6911100163/event.xml',
                             'serviceId': 'urn:lge-com:serviceId:webos-second-screen-3000-3001',
                             'serviceType': 'urn:lge-com:service:webos-second-screen:1'}}}
rofrantz commented 8 years ago

This PR should fix this issue. Once it gets approved and get merged we should only make sure that we bump also netdisco in HA to 0.7.6

rofrantz commented 8 years ago

@balloob shouldn't we also update netdisco dependency in HA to 0.7.6 in order to make use of this fix ?

balloob commented 8 years ago

Yes, pr welcome

On Sat, Nov 5, 2016, 17:34 Frantz notifications@github.com wrote:

@balloob https://github.com/balloob shouldn't we also update netdisco dependency in HA to 0.7.6 in order to make use of this fix ?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/home-assistant/home-assistant/issues/4128#issuecomment-258652075, or mute the thread https://github.com/notifications/unsubscribe-auth/ABYJ2vzU4-7Nx-5CN5HT4dXon1zGoQ6Aks5q7SClgaJpZM4KkQpA .