Git Product home page Git Product logo

netdisco's Introduction

This library is deprecated. We will no longer release new versions, fix bugs or accept pull requests. If you are looking to make your Home Assistant integration discoverable, use the zeroconf and SSDP manifest options.

NetDisco

NetDisco is a Python 3 library to discover local devices and services. It allows to scan on demand or offer a service that will scan the network in the background in a set interval.

Current methods of scanning:

  • mDNS (includes Chromecast, Homekit)
  • uPnP
  • Plex Media Server using Good Day Mate protocol
  • Logitech Media Server discovery protocol
  • Daikin discovery protocol
  • Web OS discovery protocol

It is the library that powers the device discovery within Home Assistant.

We are no longer accepting PRs that implement custom discovery protocols. Only PRs that use mDNS or uPnP are supported. See this issue

Installation

Netdisco is available on PyPi. Install using pip3 install netdisco.

Example

From command-line:

python3 -m netdisco
# To see all raw data:
python3 -m netdisco dump

In your script:

from netdisco.discovery import NetworkDiscovery

netdis = NetworkDiscovery()

netdis.scan()

for dev in netdis.discover():
    print(dev, netdis.get_info(dev))

netdis.stop()

Will result in a list of discovered devices and their most important information:

DLNA ['http://192.168.1.1:8200/rootDesc.xml', 'http://192.168.1.150:32469/DeviceDescription.xml']
google_cast [('Living Room.local.', 8009)]
philips_hue ['http://192.168.1.2:80/description.xml']
belkin_wemo ['http://192.168.1.10:49153/setup.xml']

netdisco's People

Contributors

bachp avatar balloob avatar bdraco avatar brburns avatar dotlambda avatar escoand avatar fabaff avatar fbradyirl avatar florianholzapfel avatar hellowlol avatar jaharkes avatar magicus avatar mjg59 avatar molobrakos avatar nielstron avatar ottowinter avatar patthoyts avatar pauln avatar pfalcon avatar postlund avatar pvizeli avatar robbiet480 avatar rofrantz avatar rytilahti avatar scop avatar sdague avatar sebk-666 avatar stevenlooman avatar syssi avatar tomduijf avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

netdisco's Issues

TypeError exception for NoneType

Running on an RPi with Raspian Jessie Python 2.7 I get this error when trying the example. Sometimes it works and shows my google_cast device and sometimes dies with the following:

Exception in thread Thread-3 (most likely raised during interpreter shutdown):
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
  File "/usr/local/lib/python2.7/dist-packages/zeroconf.py", line 1049, in run
  File "/usr/local/lib/python2.7/dist-packages/zeroconf.py", line 1399, in wait
  File "/usr/lib/python2.7/threading.py", line 289, in __exit__
  File "/usr/lib/python2.7/threading.py", line 216, in __exit__
  File "/usr/lib/python2.7/threading.py", line 203, in release
<type 'exceptions.TypeError'>: 'NoneType' object is not callable

Also happens using dump, which may give you more info?

pi@rpi2:~/development/ISYHelperPolyglot $ python -m netdisco dump
Zeroconf
[record[txt,in-unique,Master Bedroom._googlecast._tcp.local.,4500/4484.52118994,#id=a48]...,
 record[srv,in-unique,Master Bedroom._googlecast._tcp.local.,120/104.51998291,Master Bedroom.local.:8009],
 record[ptr,in,_googlecast._tcp.local.,120/103.764477783,Family Room._googlecast._tcp.local.],
 record[ptr,in,_googlecast._tcp.local.,120/103.900769043,Master Bedroom._googlecast._tcp.local.],
 record[txt,in-unique,Family Room._googlecast._tcp.local.,4500/4484.07796729,#id=3f1]...,
 record[srv,in-unique,Family Room._googlecast._tcp.local.,120/104.076370117,Family Room.local.:8009],
 192.168.1.44,
 192.168.1.248]

SSDP
[<UPNPEntry urn:schemas-wifialliance-org:device:WFADevice:1 - http://192.168.1.1:1990/WFADevice.xml>,
 <UPNPEntry uuid:fac2bccd-a10f-7638-39c9-31816c9dbd3b - http://192.168.1.1:1990/WFADevice.xml>,
 <UPNPEntry upnp:rootdevice - http://192.168.1.1:1990/WFADevice.xml>,
 <UPNPEntry urn:schemas-wifialliance-org:service:WFAWLANConfig:1 - http://192.168.1.1:1990/WFADevice.xml>,
 <UPNPEntry urn:schemas-upnp-org:device:InternetGatewayDevice:1 - http://192.168.1.1:33868/rootDesc.xml>,
 <UPNPEntry upnp:rootdevice - http://192.168.1.1:33868/rootDesc.xml>,
 <UPNPEntry urn:schemas-upnp-org:service:WANIPConnection:1 - http://192.168.1.1:33868/rootDesc.xml>,
 <UPNPEntry urn:schemas-upnp-org:service:WANCommonInterfaceConfig:1 - http://192.168.1.1:33868/rootDesc.xml>,
 <UPNPEntry urn:schemas-upnp-org:device:WANDevice:1 - http://192.168.1.1:33868/rootDesc.xml>,
 <UPNPEntry urn:schemas-upnp-org:device:WANConnectionDevice:1 - http://192.168.1.1:33868/rootDesc.xml>,
 <UPNPEntry uuid:c87b1e10-8430-4cee-ae6a-5110ca3bbbd8 - http://192.168.1.1:33868/rootDesc.xml>,
 <UPNPEntry uuid:c87b1e10-8430-4cee-ae6a-5110ca3bbbd7 - http://192.168.1.1:33868/rootDesc.xml>,
 <UPNPEntry urn:schemas-upnp-org:service:Layer3Forwarding:1 - http://192.168.1.1:33868/rootDesc.xml>,
 <UPNPEntry urn:schemas-upnp-org:service:WANPPPConnection:1 - http://192.168.1.1:33868/rootDesc.xml>,
 <UPNPEntry uuid:c87b1e10-8430-4cee-ae6a-5110ca3bbbd9 - http://192.168.1.1:33868/rootDesc.xml>,
 <UPNPEntry upnp:rootdevice - http://192.168.1.248:8008/ssdp/device-desc.xml>,
 <UPNPEntry uuid:3f156e3a-71a1-9b58-9f08-c84e8ab19808 - http://192.168.1.248:8008/ssdp/device-desc.xml>,
 <UPNPEntry urn:dial-multiscreen-org:device:dial:1 - http://192.168.1.248:8008/ssdp/device-desc.xml>,
 <UPNPEntry urn:dial-multiscreen-org:service:dial:1 - http://192.168.1.248:8008/ssdp/device-desc.xml>,
 <UPNPEntry upnp:rootdevice - http://192.168.1.1:1990/WFADevice.xml>,
 <UPNPEntry upnp:rootdevice - http://192.168.1.248:8008/ssdp/device-desc.xml>]

GDM
[]

LMS
[]


Discovered devices:
google_cast [('192.168.1.44', 8009), ('192.168.1.248', 8009)]

Discovered 1 devices
Exception in thread Thread-2 (most likely raised during interpreter shutdown):
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
  File "/usr/local/lib/python2.7/dist-packages/zeroconf.py", line 917, in run
  File "/usr/local/lib/python2.7/dist-packages/zeroconf.py", line 1399, in wait

Feature Request: Discover by default ports

I don't know if it has been discussed before, but I had the idea of discovering services by the ports they use by default. Is this a thing netdisco should do? The basic concept of what I mean:

#!/usr/bin/python3
import asyncio
import time

NOW = time.time()
DESTS = ["192.168.1.{}".format(i) for i in range(1, 255)]
PORTS = {
    1883: "mqtt",
    2000: "homematic-wired",
    2001: "homematic-wireless",
    2010: "homematic-ip",
    3306: "mysql",
    5432: "postgres",
    6466: "androidtv",
    8086: "influxdb",
    8883: "mqtts",
    # etc.
}

async def check_port(ip, port, loop):
    try:
        reader, writer = await asyncio.open_connection(ip, port, loop=loop)
        print(ip, port, PORTS[port])
        writer.close()
        return (ip, port, True)
    except:
        return (ip, port, False)

async def run(dests, ports, loop):
    tasks = [asyncio.ensure_future(check_port(d, p, loop)) for d in dests for p in ports]
    responses = await asyncio.gather(*tasks)
    return responses

LOOP = asyncio.get_event_loop()
FUTURE = asyncio.ensure_future(run(DESTS, PORTS.keys(), LOOP))
LOOP.run_until_complete(FUTURE)
print('#'*50)
print('Total time: ', time.time() - NOW)

(modified version of this)

It takes me ~130 seconds to scan my class C network, but the main relevant services actually show up rather quickly. I wouldn't go as far as expecting the results to be 100% accurate. But maybe services discovered this way could show a proposed HASS component (with link to documentation) that might work together with the discovered service.

That way especially newbies could be informed, that they have something that might be integrated into HASS, which they have not thought before because they haven't looked through all the components HASS supports. I would consider this a workaround for services which don't publish themselves via mDNS etc.

The question would be: do you think netdisco would be improved by using this approach?

Scope of this project and possible future requirements

Hey everyone,

I'm working on another library specifically for discovering and controlling uPnP devices and realise that your implementation of SSDP discovery is far superior (great job!). I believe I'm right in thinking though that actual control of uPnP devices is beyond the scope of this library, otherwise I'd submit patches here.

My question is whether to include this whole library as a dependency (just to use the ssdp module), or to lift the ssdp module (copyright notice, attribution and all) and just use that. My worry with including this as a dependency is that there's potential for many more network discovery protocols to be implemented in netdisco which could depend on even more libraries I wouldn't need.

I recognise that this isn't your problem, I just wonder what your thoughts would be on the best way for me to proceed here?

Thanks for your time!
Ellis

UnicodeEncodeError: 'ascii' codec .......

ERROR:
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2022' in position 227: ordinal not in range(128)

Fix netdisco.ssdp.py @line: 141
CHANGE THIS:

  • tree = ElementTree.fromstring(xml)
    TO:
  • tree = ElementTree.fromstring(xml.encode("utf-8"))

PyPi package is missing LICENSE file

It would be good to include the LICENSE file in the tarball on PyPi.
This way upstream packagers like Yocto can automatically verify it during package creation.

I'm not sure why it is missung anayway. It's acutally the first package I encoutered this problem.

SSDP suffers from multibyte string decode problem

It seems there are several other problems with multibyte string decoding and encoding in this package. Let me add my $0.0000000000002 😃.

Some device in my network has an SSDP response that blows up ssdp.py discovery sock.recv().decode("utf-8") with UnicodeDecodeError: 'utf-8' codec can't decode byte 0x90 in position 5: invalid start byte. Since I cannot control all devices and since this is really a robustness issue, I tried replacing the bad UTF-8 with the default replacement by changing the code to

                    response = sock.recv(1024).decode("utf-8", "replace")

This solves my problem by allowing the discovery to continue even after a response from such an evil device is found. It seems harmless to do this.

AttributeError after system restart

After a service restart I have found an AttributeError exception on log

Python release (python3 --version):
3.4.2

Installed versions:
home-assistant-frontend==20171204.0
homeassistant==0.59.2
netdisco==1.2.3

below the traceback

2017-12-09 22:00:59 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/lib/python3.5/asyncio/tasks.py", line 241, in _step
    result = coro.throw(exc)
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/discovery.py", line 129, in scan_devices
    results = yield from hass.async_add_job(_discover, netdisco)
  File "/usr/lib/python3.5/asyncio/futures.py", line 361, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.5/asyncio/tasks.py", line 296, in _wakeup
    future.result()
  File "/usr/lib/python3.5/asyncio/futures.py", line 274, in result
    raise self._exception
  File "/usr/lib/python3.5/concurrent/futures/thread.py", line 55, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/discovery.py", line 157, in _discover
    for disc in netdisco.discover():
  File "/srv/homeassistant/lib/python3.5/site-packages/netdisco/discovery.py", line 92, in discover
    return [dis for dis, checker in self.discoverables.items()
  File "/srv/homeassistant/lib/python3.5/site-packages/netdisco/discovery.py", line 93, in <listcomp>
    if checker.is_discovered()]
  File "/srv/homeassistant/lib/python3.5/site-packages/netdisco/discoverables/__init__.py", line 17, in is_discovered
    return len(self.get_entries()) > 0
  File "/srv/homeassistant/lib/python3.5/site-packages/netdisco/discoverables/octoprint.py", line 11, in get_entries
    "manufacturer": "The OctoPrint Project"
  File "/srv/homeassistant/lib/python3.5/site-packages/netdisco/discoverables/__init__.py", line 71, in find_by_device_description
    return self.netdis.ssdp.find_by_device_description(values)
  File "/srv/homeassistant/lib/python3.5/site-packages/netdisco/ssdp.py", line 74, in find_by_device_description
    if location not in seen and entry.match_device_description(values):
  File "/srv/homeassistant/lib/python3.5/site-packages/netdisco/ssdp.py", line 180, in match_device_description
    for key, val in values.items())
  File "/srv/homeassistant/lib/python3.5/site-packages/netdisco/ssdp.py", line 180, in <genexpr>
    for key, val in values.items())
AttributeError: 'list' object has no attribute 'get'

New DirecTV scanner not working with RVU units (i.e. DIRECTV C51-100)

Hi @cbulock

The new DirecTV component works great with my main unit, but it does not seem to work with remote players (i.e. the Mini Genie remotes).

I have 3 DIRECTV C51-100 that are not detected.

The code appears to be checking for:
"manufacturer": "DIRECTV",
"deviceType": "urn:schemas-upnp-org:device:MediaServer:1"
while that actual device is
"manufacturer": "TMM",
"deviceType": "urn:schemas-upnp-org:device:MediaRenderer:1"

Also, the DirecTV remote mini genie's trigger this error in the log in the wemo scanner when found - it'd be nice if that was cleaned up:
16-07-31 21:20:23 pywemo.ssdp: Error fetching description at @http://169.254.9.75:63444/upnp/xml/devices/MediaRenderer1.xml

it's Device XML is:


2
0


urn:schemas-upnp-org:device:MediaRenderer:1
TMM RVU Client MediaRenderer
TMM
DIRECTV C51-100
C51
100

uuid:MediaRenderer-08_95_2A_F9_58_9E


urn:schemas-upnp-org:service:AVTransport:1
urn:upnp-org:serviceId:AVTransport
/upnp/xml/services/AVTransport1.xml
/upnp/control/AVTransport1
/upnp/event/AVTransport1



urn:schemas-rvualliance-org:service:StreamSplicing:1

urn:upnp-org:serviceId:StreamSplicing
/upnp/xml/services/StreamSplicing1.xml
/upnp/control/StreamSplicing1
/upnp/event/StreamSplicing1


urn:schemas-upnp-org:service:RenderingControl:1
urn:upnp-org:serviceId:RenderingControl
/upnp/xml/services/RenderingControl1.xml
/upnp/control/RenderingControl1
/upnp/event/RenderingControl1


urn:schemas-upnp-org:service:ConnectionManager:1
urn:upnp-org:serviceId:ConnectionManager
/upnp/xml/services/ConnectionManager1.xml
/upnp/control/ConnectionManager1
/upnp/event/ConnectionManager1




urn:schemas-upnp-org:device:ManageableDevice:1
TMM RVU Client ManageableDevice
TMM
DIRECTV C51-100
C51
100

uuid:ManageableDevice-08_95_2A_F9_58_9E



urn:schemas-upnp-org:service:ConfigurationManagement:1

urn:upnp-org:serviceId:ConfigurationManagement
/upnp/xml/services/ConfigurationManagement1.xml
/upnp/control/ConfigurationManagement1
/upnp/event/ConfigurationManagement1


urn:schemas-upnp-org:service:BasicManagement:1
urn:upnp-org:serviceId:BasicManagement
/upnp/xml/services/BasicManagement1.xml
/upnp/control/BasicManagement1
/upnp/event/BasicManagement1



Lutron Caseta Pro hub is homekit and identified as mystrom

I am trying to sort out how you are detecting this but, could use some assistance with this. Here is the dev info being retruned:

mystrom [('Smart Bridge Pro 2', 'http://192.168.1.30', '50:72:24:bd:94:38')]
homekit [{'s#': '1', 'host': 'http://192.168.1.30', 'ff': '1', 'sf': '1', 'id': '50:72:24:bd:94:38', 'md': 'Smart Bridge Pro 2', 'c#': '6', 'ci': '2'}]

If pointed in the right direction, I might be able to determine the fix as, I am working on adding this hub to Home Assistant.

Unable to detect Philips Hue bridge 2015

Currently Philips Hue detection is hardcoded on the 2012 bridge model number. The 2015 version has a new model number.

<?xml version="1.0" encoding="UTF-8"?>
<root>
   <specVersion>
      <major>1</major>
      <minor>0</minor>
   </specVersion>
   <URLBase>http://192.168.1.8:80/</URLBase>
   <device>
      <deviceType>urn:schemas-upnp-org:device:Basic:1</deviceType>
      <friendlyName>Philips hue (192.168.1.8)</friendlyName>
      <manufacturer>Royal Philips Electronics</manufacturer>
      <manufacturerURL>http://www.philips.com</manufacturerURL>
      <modelDescription>Philips hue Personal Wireless Lighting</modelDescription>
      <modelName>Philips hue bridge 2015</modelName>
      <modelNumber>BSB002</modelNumber>
      <modelURL>http://www.meethue.com</modelURL>
      <serialNumber>xxxxxxxxxxxx</serialNumber>
      <UDN>uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx</UDN>
      <presentationURL>index.html</presentationURL>
      <iconList>
         <icon>
            <mimetype>image/png</mimetype>
            <height>48</height>
            <width>48</width>
            <depth>24</depth>
            <url>hue_logo_0.png</url>
         </icon>
         <icon>
            <mimetype>image/png</mimetype>
            <height>120</height>
            <width>120</width>
            <depth>24</depth>
            <url>hue_logo_3.png</url>
         </icon>
      </iconList>
   </device>
</root>

multibyte encodings not supported

I get this error running on MACOS:

Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/Library/Python/2.7/site-packages/netdisco/__main__.py", line 33, in <module>
    main()
  File "/Library/Python/2.7/site-packages/netdisco/__main__.py", line 24, in main
    for dev in netdisco.discover():
  File "/Library/Python/2.7/site-packages/netdisco/discovery.py", line 66, in discover
    if checker.is_discovered()]
  File "/Library/Python/2.7/site-packages/netdisco/discoverables/__init__.py", line 9, in is_discovered
    return len(self.get_entries()) > 0
  File "/Library/Python/2.7/site-packages/netdisco/discoverables/philips_hue.py", line 20, in get_entries
    "modelNumber": ["929000226503", "BSB002"]
  File "/Library/Python/2.7/site-packages/netdisco/discoverables/__init__.py", line 53, in find_by_device_description
    return self.netdis.ssdp.find_by_device_description(values)
  File "/Library/Python/2.7/site-packages/netdisco/ssdp.py", line 73, in find_by_device_description
    if entry.match_device_description(values)]
  File "/Library/Python/2.7/site-packages/netdisco/ssdp.py", line 161, in match_device_description
    device = self.description.get('device')
  File "/Library/Python/2.7/site-packages/netdisco/ssdp.py", line 138, in description
    tree = ElementTree.fromstring(xml)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xml/etree/ElementTree.py", line 1300, in XML
    parser.feed(text)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xml/etree/ElementTree.py", line 1640, in feed
    self._parser.Parse(data, 0)
ValueError: multi-byte encodings are not supported

SSDP discovery running on wired network only finds other wired devices (RPi)

I've got an issue running netdisco (via Home Assistant) on a Raspberry Pi 2 Model B. It's set up wired, not wireless, and when netdisco is run it can only discover other wired devices (in my case a Hue). The two other devices that are on the same network but connected with wifi, aren't found.

On the other hand netdisco run from my laptop on wifi runs perfectly and finds all wifi-connected and wireless-connected devices.

Python versions are the same, Pi is up-to-date. Unfortunately I don't have a WiFi stick to test what devices the RPi will find.

gdm.py: Misuse of socket timeout in seconds as multicast TTL value

gdm.py has:

        # setup socket for discovery -> multicast message
        sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
        sock.settimeout(gdm_timeout)

        # Set the time-to-live for messages for local network
        sock.setsockopt(socket.IPPROTO_IP,
                        socket.IP_MULTICAST_TTL,
                        gdm_timeout)

This is clearly a thinko. Socket timeout is in seconds, while TTL is in the number of route hops. A normal value for multicast TTL is 1 (local net only). (Which happens to be the value of gdm_timeout, but that's a coincident).

Discovery cycle is too long

It seems that majority of discovery handlers are run in blocking mode ("foreground" words in https://github.com/home-assistant/netdisco/blob/master/netdisco/discovery.py#L20), sequentially. And now the current duration for such blocking scan in various services seems to be 5s, and with 5 such services already, the single iteration takes 25s. I'd say that's too much, and may hurt user experience, if used in e.g. HomeAssistant. Discovery in HA is itself not much useful (home-assistant/core#9135), but can at least serve as a "display hack" of "Whoa, HA automatically found my devices [now I need to go and configure them manually]". But with the delays like above, it can turn into "It takes half and hour minute for HA to recognize my devices after start, HA is slow, slow, slow!!!11".

So, as a first step to remedy problem, #141 uses the duration of 3s. I'd say that actually too much for "local LAN" still, and I'd propose to set the default duration as 2s for all current services. Even better, set default as 2s, and let the caller specify max duration to be used for each individual service. Then, a small value (e.g. 0.5s) can be used on first call to quickly pick up majority of device after startup, and later, larger durations can be used for slowpoke devices.

BubbleUPnP renderer

My openhome renderer that has been created with BubbleUPnP server, is not discovered. Is there any special reason for that?

General question regarding component settings w/ netdisco

Hi,

Maybe not the right place for this. How do other components set basic settings when they are being autodiscovered? I see only one example, and that is the Hue bulbs using a configuration file. Is there any other? Is that the preferred method to set preferences for a component?

For example, I did some work around the Yeelight bulb component. They support both "sudden" and "smooth" transitions to new states (colors/brightness/etc). What's the recommended way to allow users to specify which transition method they prefer?

AttributeError: no attribute 'NetworkDiscovery'

I'm following the README example script but I'm getting the:

Traceback (most recent call last):
netdis = netdisco.NetworkDiscovery()
AttributeError: 'module' object has no attribute 'NetworkDiscovery'

message.

I tried both Python 3.4 and 2.7.

EDIT: I managed to get it working with:

import netdisco
from netdisco.discovery import NetworkDiscovery
netdis = netdisco.discovery.NetworkDiscovery()

Either change the example or fix it :)

Cannot parse HTTP headers without white space after colon in SSDP response

ssdp.py fails to parse HTTP headers like;
Location:http://192.168.1.1:1900/
when there is no white space after the first colon(:).
HTTP 1.1 allows 0 or more white spaces after the first colon.

This is caused by regular expression in line 19 of ssdp.py
RESPONSE_REGEX = re.compile(r'\n(.): (.)\r')
which requires 1 (and only 1) white space to be present.

This regular expression should be changed to
RESPONSE_REGEX = re.compile(r'\n(.?):\s(.*)\r')
to allow arbitrary number of white spaces.

MDNSDiscoverable.ip_from_host fails on ipv6 addresses

I have a ipv6-address on my kodi machine, and that makes netdisco break:

  File "netdisco/__main__.py", line 31, in <module>
    main()
  File "netdisco/__main__.py", line 24, in main
    print(dev, netdisco.get_info(dev))
  File "/home/anton/Downloads/netdisco/netdisco/discovery.py", line 76, in get_info
    return self.discoverables[dis].get_info()
  File "/home/anton/Downloads/netdisco/netdisco/discoverables/kodi.py", line 21, in get_info
    return [self.info_from_entry(entry) for entry in self.get_entries()
  File "/home/anton/Downloads/netdisco/netdisco/discoverables/kodi.py", line 22, in <listcomp>
    if entry.name.startswith('Kodi ')]
  File "/home/anton/Downloads/netdisco/netdisco/discoverables/kodi.py", line 17, in info_from_entry
    return (self.ip_from_host(entry.server), entry.port)
  File "/home/anton/Downloads/netdisco/netdisco/discoverables/__init__.py", line 108, in ip_from_host
    return repr(ips[0]) if ips else host
TypeError: __repr__ returned non-string (type bytes)

Support LIFX light discovery

It seems like home-assistant is already using aiolifx to talk to LIFX lights, would you be open to depending on it here so lights can be auto-discovered?

Dump finds UPNP entry but normal discover ignores them

Running dump gives the following:

<UPNPEntry http://192.168.1.6:2870/dmr.xml - upnp:rootdevice>,
<UPNPEntry http://192.168.1.6:2870/dmr.xml - uuid:13ca17c6-b6f2-19ef-a0d1-486dbb128856>,
<UPNPEntry http://192.168.1.6:2870/dmr.xml - urn:schemas-upnp-org:device:MediaRenderer:1>,
<UPNPEntry http://192.168.1.6:2870/dmr.xml - urn:schemas-upnp-org:service:RenderingControl:1>,
<UPNPEntry http://192.168.1.6:2870/dmr.xml - urn:schemas-upnp-org:service:ConnectionManager:1>,
<UPNPEntry http://192.168.1.6:2870/dmr.xml - urn:schemas-upnp-org:service:AVTransport:1>,
<UPNPEntry http://192.168.1.6:9080 - upnp:rootdevice>,
<UPNPEntry http://192.168.1.6:9080 - uuid:RPHLNTFLX=00000000000000000000000000494260>,
<UPNPEntry http://192.168.1.6:9080 - urn:schemas-upnp-org:device:mdxdevice:1>,
<UPNPEntry http://192.168.1.6:9080 - urn:mdx-netflix-com:service:target:3>]

But they are both ignored on a normal run.

GDM discovery assumes ASCII

The GDM discovery component assumes it will be receiving ASCII. This is likely to cause an issue if someone has non-ASCII characters in their Plex server name. @nauticus25 reported the following crash in the Home Assistant gitter channel:

Exception in thread Thread-3:
Traceback (most recent call last):
  File "/usr/lib/python3.4/threading.py", line 920, in _bootstrap_inner
    self.run()
  File "/home/pi/.homeassistant/deps/netdisco/service.py", line 60, in run
    self._scan()
  File "/home/pi/.homeassistant/deps/netdisco/service.py", line 74, in _scan
    self.discovery.scan()
  File "/home/pi/.homeassistant/deps/netdisco/discovery.py", line 57, in scan
    self.gdm.scan()
  File "/home/pi/.homeassistant/deps/netdisco/gdm.py", line 23, in scan
    self.update()
  File "/home/pi/.homeassistant/deps/netdisco/gdm.py", line 89, in update
    data = data.decode('ascii')
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 124: ordinal not in range(128)

My guess is it would be safer to assume utf-8 when decoding, but I don't have any Plex stuff, so I'm not able to test that.

Plex Media Player is discovered as a Roku

homeassistant (0.29.6)
netdisco (0.7.1)
Python 3.4.2

Description of problem:
I currently have both a Plex Media Server and Plex Media Player running on the same Fedora 24 node. The discovery component correctly identifies Plex Media Server, as well as 3 other Roku's on my network. The discovery component then incorrectly identifies plexmediaplayer-1.1.4-1.fc24.x86_64 (Plex Pass) as a Roku device and throws an exception.

Expected:
Either the discovery component identifies Plex Media Player or it ignores the device.

Traceback:

16-10-03 08:29:40 homeassistant.components.media_player.roku: Discovered Roku: 192.168.0.201
16-10-03 08:29:40 homeassistant.components.media_player.roku: Discovered Roku: 192.168.1.10
16-10-03 08:29:40 homeassistant.components.media_player.plex: Connected to: http://192.168.1.10:32400
16-10-03 08:29:40 homeassistant.components.media_player: Error while setting up platform roku
Traceback (most recent call last):
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py", line 107, in _setup_platform
    discovery_info)
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/homeassistant/components/media_player/roku.py", line 54, in setup_platform
    new_roku = RokuDevice(host)
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/homeassistant/components/media_player/roku.py", line 80, in __init__
    self.update()
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/homeassistant/components/media_player/roku.py", line 91, in update
    if self.roku.current_app is not None:
  File "/home/hass/.homeassistant/deps/roku/core.py", line 234, in current_app
    resp = self._get('/query/active-app')
  File "/home/hass/.homeassistant/deps/roku/core.py", line 144, in _get
    return self._call('GET', path, *args, **kwargs)
  File "/home/hass/.homeassistant/deps/roku/core.py", line 164, in _call
    raise RokuException(resp.content)
roku.core.RokuException: b''

Additional info:

❨~❩#─► ip a show enp0s26u1u4 | sed -nr 's|.*inet ([^ ]+)/.*|\1|p'
192.168.1.10
❨~❩#─► sudo netstat -lnp | grep plexmediaplay | grep -E 'tcp|udp'
tcp        0      0 0.0.0.0:32433           0.0.0.0:*               LISTEN      2271/plexmediaplaye
tcp6       0      0 :::8060                 :::*                    LISTEN      2271/plexmediaplaye
udp        0      0 0.0.0.0:1900            0.0.0.0:*                           2271/plexmediaplaye
udp        0      0 0.0.0.0:32412           0.0.0.0:*                           2271/plexmediaplaye

Discovery Issue in home-assistant

When using netdisco 0.8.2 within home-assistant, discovery appears to fail. 0.8.1 works fine.

I wound back some of the features added in 0.8.2 and it looks like the addition of the fluxled component added as part of #91 seems to stop the discovery from completing.

The home assistant issue is home-assistant/core#5947

Unable to import netdisco

Hello. After successfully installing netdisco by using "pip install -r requirements.txt" i was notified that the module couldn't be imported (import netdisco). Im using python 2.7.10. And tried 3.4 as well. What am i doing wrong?

Unknown miio device found

I'm having issue with the discovery of my Yeelight Ceiling lights for a while now. It gives the following error every 5 minutes or so (for each of my lights):

Unknown miio device found: ServiceInfo(type='_miio._udp.local.', name='yeelink-light-ceiling1_mibt77535239._miio._udp.local.', address=b'\xc0\xa8\x01#', port=54321, weight=0, priority=0, server='yeelink-light-ceiling1_mibt77535239.local.', properties={b'epoch': b'1', b'mac': b'7811dca8d7be'})

It has been pointed out to me that it will be resolved with the next 'netdisco' update.

Would you be so kind to let us know when we could expect an update.

Apple TV error

17-04-16 18:40:53 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/lib/python3.5/asyncio/tasks.py", line 241, in _step
    result = coro.throw(exc)
  File "/home/robbiet480/home-assistant/homeassistant/components/discovery.py", line 113, in scan_devices
    None, _discover, netdisco)
  File "/usr/lib/python3.5/asyncio/futures.py", line 361, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.5/asyncio/tasks.py", line 296, in _wakeup
    future.result()
  File "/usr/lib/python3.5/asyncio/futures.py", line 274, in result
    raise self._exception
  File "/usr/lib/python3.5/concurrent/futures/thread.py", line 55, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/robbiet480/home-assistant/homeassistant/components/discovery.py", line 138, in _discover
    for service in netdisco.get_info(disc):
  File "/home/robbiet480/home-assistant/venv/lib/python3.5/site-packages/netdisco/discovery.py", line 104, in get_info
    return self.discoverables[dis].get_info()
  File "/home/robbiet480/home-assistant/venv/lib/python3.5/site-packages/netdisco/discoverables/__init__.py", line 22, in get_info
    return [self.info_from_entry(entry) for entry in self.get_entries()]
  File "/home/robbiet480/home-assistant/venv/lib/python3.5/site-packages/netdisco/discoverables/__init__.py", line 22, in <listcomp>
    return [self.info_from_entry(entry) for entry in self.get_entries()]
  File "/home/robbiet480/home-assistant/venv/lib/python3.5/site-packages/netdisco/discoverables/apple_tv.py", line 16, in info_from_entry
    info[ATTR_NAME] = info[ATTR_PROPERTIES]['name'].replace('\xa0', ' ')
KeyError: 'name'

I have two Apple TVs on my network:

  • Robbie's Bedroom Apple TV
  • Living Room Apple TV

/cc @postlund

AttributeError: __exit__ in tellstick.py

C:\Users\Hellowlol\Desktop>python -m netdisco dump
Traceback (most recent call last):
  File "C:\Python27\lib\runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "C:\Python27\lib\runpy.py", line 72, in _run_code
    exec code in run_globals
  File "C:\Python27\lib\site-packages\netdisco\__main__.py", line 33, in <module>
    main()
  File "C:\Python27\lib\site-packages\netdisco\__main__.py", line 14, in main
    netdisco.scan()
  File "C:\Python27\lib\site-packages\netdisco\discovery.py", line 58, in scan
    self.tellstick.scan()
  File "C:\Python27\lib\site-packages\netdisco\tellstick.py", line 25, in scan
    self.update()
  File "C:\Python27\lib\site-packages\netdisco\tellstick.py", line 35, in update
    with socket.socket(socket.AF_INET, socket.SOCK_DGRAM) as sock:
AttributeError: __exit__

C:\Users\Hellowlol\Desktop>

Im using python 2.7.10

malformed XML error on my DVR

16-11-08 18:03:41 netdisco.ssdp: Found malformed XML at http://192.168.1.17:49155/description2.xml:

I am getting the above in the HA log, not a very important device (nothing I can do with it as far as I can tell) but is there anything I can do to remove this error ?
like maybe tell it to ignore the device in some way or something ?

Discovery failure with introduction of Samsung AC support.

Discovery stopped working on my Synology NAS after home-assistant updated to 0.7.6.

Running the discovery manually it showed a failure opening the discovery port in the Samsung smart AC code (commit d43bec3) because the port is already in use on the NAS. Not sure if the Samsung AC discovery is able to use an arbitrary local port instead.

TypeError: __repr__ returned non-string (type bytes)

Reported in the chat. The stack trace mentions mystrom. User said the IP was his Hue. It complains about bytes vs strings (ugh). Not sure where we are having bytes.

Jul 31 22:44:46 hass hass[25944]: INFO:requests.packages.urllib3.connectionpool:Starting new HTTP connection (1): 192.168.0.14
Jul 31 22:44:48 hass hass[25944]: Exception in thread Thread-2:
Jul 31 22:44:48 hass hass[25944]: Traceback (most recent call last):
Jul 31 22:44:48 hass hass[25944]:   File "/usr/lib/python3.5/threading.py", line 914, in _bootstrap_inner
Jul 31 22:44:48 hass hass[25944]:     self.run()
Jul 31 22:44:48 hass hass[25944]:   File "/home/hass/.homeassistant/deps/netdisco/service.py", line 59, in run
Jul 31 22:44:48 hass hass[25944]:     self._scan()
Jul 31 22:44:48 hass hass[25944]:   File "/home/hass/.homeassistant/deps/netdisco/service.py", line 76, in _scan
Jul 31 22:44:48 hass hass[25944]:     for service in self.discovery.get_info(disc):
Jul 31 22:44:48 hass hass[25944]:   File "/home/hass/.homeassistant/deps/netdisco/discovery.py", line 76, in get_info
Jul 31 22:44:48 hass hass[25944]:     return self.discoverables[dis].get_info()
Jul 31 22:44:48 hass hass[25944]:   File "/home/hass/.homeassistant/deps/netdisco/discoverables/mystrom.py", line 20, in get_info
Jul 31 22:44:48 hass hass[25944]:     return [self.info_from_entry(entry) for entry in self.get_entries()]
Jul 31 22:44:48 hass hass[25944]:   File "/home/hass/.homeassistant/deps/netdisco/discoverables/mystrom.py", line 20, in <listcomp>
Jul 31 22:44:48 hass hass[25944]:     return [self.info_from_entry(entry) for entry in self.get_entries()]
Jul 31 22:44:48 hass hass[25944]:   File "/home/hass/.homeassistant/deps/netdisco/discoverables/mystrom.py", line 15, in info_from_entry
Jul 31 22:44:48 hass hass[25944]:     'http://{}'.format(self.ip_from_host(entry.server)),
Jul 31 22:44:48 hass hass[25944]:   File "/home/hass/.homeassistant/deps/netdisco/discoverables/__init__.py", line 108, in ip_from_host
Jul 31 22:44:48 hass hass[25944]:     return repr(ips[0]) if ips else host
Jul 31 22:44:48 hass hass[25944]: TypeError: __repr__ returned non-string (type bytes)

Drop Python 2 support

As far as I know, this package is only used by Home Assistant. Home Assistant is Python 3.4.2+.

There is no need in keeping Python 2 support around.

HomeKit - TypeError: __repr__ returned non-string (type bytes)

Seen during startup of Home Assistant 0.30.0dev0

Exception in thread Thread-11:
Traceback (most recent call last):
  File "/usr/lib/python3.4/threading.py", line 920, in _bootstrap_inner
    self.run()
  File "/home/robbiet480/home-assistant/venv/lib/python3.4/site-packages/netdisco/service.py", line 59, in run
    self._scan()
  File "/home/robbiet480/home-assistant/venv/lib/python3.4/site-packages/netdisco/service.py", line 76, in _scan
    for service in self.discovery.get_info(disc):
  File "/home/robbiet480/home-assistant/venv/lib/python3.4/site-packages/netdisco/discovery.py", line 76, in get_info
    return self.discoverables[dis].get_info()
  File "/home/robbiet480/home-assistant/venv/lib/python3.4/site-packages/netdisco/discoverables/homekit.py", line 21, in get_info
    return [self.info_from_entry(entry) for entry in self.get_entries()]
  File "/home/robbiet480/home-assistant/venv/lib/python3.4/site-packages/netdisco/discoverables/homekit.py", line 21, in <listcomp>
    return [self.info_from_entry(entry) for entry in self.get_entries()]
  File "/home/robbiet480/home-assistant/venv/lib/python3.4/site-packages/netdisco/discoverables/homekit.py", line 16, in info_from_entry
    info['host'] = 'http://{}'.format(self.ip_from_host(entry.server))
  File "/home/robbiet480/home-assistant/venv/lib/python3.4/site-packages/netdisco/discoverables/__init__.py", line 108, in ip_from_host
    return repr(ips[0]) if ips else host
TypeError: __repr__ returned non-string (type bytes)

Plex server not being discovered

Component/platform:
netdisco/plex

Description of problem:
Executing

import time
from netdisco.discovery import NetworkDiscovery

netdis = NetworkDiscovery()

netdis.scan()

for dev in netdis.discover():
    print(dev, netdis.get_info(dev))

netdis.stop()

Does not find any plex servers

This is causing issues

Expected:
Find plex server

Ssteps to reproduce:

  1. python3 -m venv venv
  2. pip install netdisco
  3. Execute code above

How do you want me to approach Yeelight bulbs?

Hi,

Yeelight bulbs listen on a different port for SSDP callouts (1982 vs 1900).

M-SEARCH * HTTP/1.1\r\n HOST: 239.255.255.250:1982\r\n MAN: "ssdp:discover"\r\n ST: wifi_bulb\r\n

And they respond:

HTTP/1.1 200 OK\r\n Cache-Control: max-age=3600\r\n Date:\r\n Ext:\r\n Location: yeelight://192.168.1.239:55443\r\n Server: POSIX UPnP/1.0 YGLC/1\r\n id: 0x000000000015243f\r\n model: color\r\n fw_ver: 18\r\n support: get_prop set_default set_power toggle set_bright start_cf stop_cf set_scene cron_add cron_get cron_del set_ct_abx set_rgb\r\n power: on\r\n bright: 100\r\n color_mode: 2\r\n ct: 4000\r\n rgb: 16711680\r\n hue: 100\r\n sat: 35\r\n name: my_bulb

So, while it kind of works like normal SSDP, it doesn't follow many standards.

Instead of adding a bunch of if code to support the bulbs in the ssdp.py module, I made a separate module. The thing is, most of the code comes from the ssdp module, just with minor changes.

If there was an interest in adding auto-discovery support for these bulbs, how would you want to approach it?

Here's the PR if you are interested in what I've added: https://github.com/peeepers/netdisco/commit/c5d3dbbfdc2004e50e2ec87117060c834a92e66e

Netdisco error in 0.17.2 on Mac OSX

HI, I just upgraded from 0.16.1 to 0.17.2 and am now getting the following in my log file:

Traceback (most recent call last):
File "/Users/keith/.homeassistant/lib/netdisco/ssdp.py", line 223, in scan
sock.sendto(ssdp_request, ssdp_target)
OSError: [Errno 65] No route to host
16-04-13 17:01:16 netdisco.ssdp: Socket error while discovering SSDP devices
Traceback (most recent call last):
File "/Users/keith/.homeassistant/lib/netdisco/ssdp.py", line 223, in scan
sock.sendto(ssdp_request, ssdp_target)
OSError: [Errno 65] No route to

Netgear router discovery crashes for WNDR3700

When I run python3 -m netdisco dump for a fresh netdisco repo clone I get:

Zeroconf                                                                                                                                                 
[]

SSDP
[<UPNPEntry upnp:rootdevice - http://192.168.1.1:5555/rootDesc.xml>,
 <UPNPEntry uuid:4d696e69-444c-164e-9d42-c43dc7a2e65b - http://192.168.1.1:5555/rootDesc.xml>,
 <UPNPEntry urn:schemas-upnp-org:device:InternetGatewayDevice:1 - http://192.168.1.1:5555/rootDesc.xml>,
 <UPNPEntry urn:schemas-upnp-org:service:Layer3Forwarding:1 - http://192.168.1.1:5555/rootDesc.xml>,
 <UPNPEntry uuid:4d696e69-444c-164e-9d43-c43dc7a2e65b - http://192.168.1.1:5555/rootDesc.xml>,
 <UPNPEntry urn:schemas-upnp-org:device:WANDevice:1 - http://192.168.1.1:5555/rootDesc.xml>,
 <UPNPEntry urn:schemas-upnp-org:service:WANCommonInterfaceConfig:1 - http://192.168.1.1:5555/rootDesc.xml>,
 <UPNPEntry uuid:4d696e69-444c-164e-9d44-c43dc7a2e65b - http://192.168.1.1:5555/rootDesc.xml>,
 <UPNPEntry urn:schemas-upnp-org:device:WANConnectionDevice:1 - http://192.168.1.1:5555/rootDesc.xml>,
 <UPNPEntry urn:schemas-upnp-org:service:WANIPConnection:1 - http://192.168.1.1:5555/rootDesc.xml>,
 <UPNPEntry urn:schemas-upnp-org:service:WANPPPConnection:1 - http://192.168.1.1:5555/rootDesc.xml>,
 <UPNPEntry urn:schemas-upnp-org:service:WANEthernetLinkConfig:1 - http://192.168.1.1:5555/rootDesc.xml>,
 <UPNPEntry upnp:rootdevice - http://192.168.1.1:49153/wps_device.xml>,
 <UPNPEntry uuid:00000000-0000-1000-0000-c43dc7a2e65b - http://192.168.1.1:49153/wps_device.xml>,
 <UPNPEntry urn:schemas-wifialliance-org:device:WFADevice:1 - http://192.168.1.1:49153/wps_device.xml>,
 <UPNPEntry urn:schemas-wifialliance-org:service:WFAWLANConfig:1 - http://192.168.1.1:49153/wps_device.xml>,
 <UPNPEntry upnp:rootdevice - http://192.168.1.1:49152/wps_device.xml>,
 <UPNPEntry uuid:00000000-0000-1000-0000-c43dc7a2e65b - http://192.168.1.1:49152/wps_device.xml>,
 <UPNPEntry urn:schemas-wifialliance-org:device:WFADevice:1 - http://192.168.1.1:49152/wps_device.xml>,
 <UPNPEntry urn:schemas-wifialliance-org:service:WFAWLANConfig:1 - http://192.168.1.1:49152/wps_device.xml>,
 <UPNPEntry upnp:rootdevice - http://192.168.1.1:49152/wps_device.xml>,
 <UPNPEntry upnp:rootdevice - http://192.168.1.1:49153/wps_device.xml>]

Discovered devices:
Traceback (most recent call last):
  File "/usr/lib/python3.4/runpy.py", line 170, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.4/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/mizy/Code/netdisco/netdisco/__main__.py", line 20, in <module>
    print(dev, nd.get_info(dev))
  File "/home/mizy/Code/netdisco/netdisco/discovery.py", line 69, in get_info
    return self.discoverables[dis].get_info()
  File "/home/mizy/Code/netdisco/netdisco/discoverables/__init__.py", line 38, in get_info
    self.info_from_entry(entry) for entry in self.get_entries()))
  File "/home/mizy/Code/netdisco/netdisco/discoverables/__init__.py", line 38, in <genexpr>
    self.info_from_entry(entry) for entry in self.get_entries()))
  File "/home/mizy/Code/netdisco/netdisco/discoverables/netgear_router.py", line 16, in info_from_entry
    url = urlparse(entry.description['URLBase'])
KeyError: 'URLBase'

I went into info_from_entry in discoverables/netgear_router.py and did some investigating:

pprint.pprint(entry) gives:

<UPNPEntry upnp:rootdevice - http://192.168.1.1:5555/rootDesc.xml>

while pprint.pprint(entry.description) gives:

{'device': {'UDN': 'uuid:4d696e69-444c-164e-9d42-c43dc7a2e65b',
            'deviceList': {'device': {'UDN': 'uuid:4d696e69-444c-164e-9d43-c43dc7a2e65b',
                                      'UPC': 'MINIUPNPD',
                                      'deviceList': {'device': {'UDN': 'uuid:4d696e69-444c-164e-9d44-c43dc7a2e65b',
                                                                'UPC': 'MINIUPNPD',
                                                                'deviceType': 'urn:schemas-upnp-org:device:WANConnectionDevice:1',
                                                                'friendlyName': 'WANConnectionDevice',
                                                                'manufacturer': 'MiniUPnP',
                                                                'manufacturerURL': 'http://miniupnp.free.fr/',
                                                                'modelDescription': 'MiniUPnP '
                                                                                    'daemon',
                                                                'modelName': 'MiniUPnPd',
                                                                'modelNumber': 'WNDR3700',
                                                                'modelURL': 'http://miniupnp.free.fr/',
                                                                'serialNumber': '00000000',
                                                                'serviceList': {'service': [{'SCPDURL': '/WANIPCn.xml',
                                                                                             'controlURL': '/ctl/IPConn',
                                                                                             'eventSubURL': '/evt/IPConn',
                                                                                             'serviceId': 'urn:upnp-org:serviceId:WANIPConn1',
                                                                                             'serviceType': 'urn:schemas-upnp-org:service:WANIPConnection:1'},
                                                                                            {'SCPDURL': '/WanEth.xml',
                                                                                             'controlURL': '/ctl/WanEth',
                                                                                             'eventSubURL': '/evt/WanEth',
                                                                                             'serviceId': 'urn:upnp-org:serviceId:WANEthLinkC1',
                                                                                             'serviceType': 'urn:schemas-upnp-org:service:WANEthernetLinkConfig:1'},
                                                                                            {'SCPDURL': '/WANPPPCn.xml',
                                                                                             'controlURL': '/ctl/PPPConn',
                                                                                             'eventSubURL': '/evt/PPPConn',
                                                                                             'serviceId': 'urn:upnp-org:serviceId:WANPPPConn1',
                                                                                             'serviceType': 'urn:schemas-upnp-org:service:WANPPPConnection:1'}]}}},
                                      'deviceType': 'urn:schemas-upnp-org:device:WANDevice:1',
                                      'friendlyName': 'WANDevice',
                                      'manufacturer': 'MiniUPnP',
                                      'manufacturerURL': 'http://miniupnp.free.fr/',
                                      'modelDescription': 'WAN Device',
                                      'modelName': 'WAN Device',
                                      'modelNumber': 'WNDR3700',
                                      'modelURL': 'http://miniupnp.free.fr/',
                                      'serialNumber': '00000000',
                                      'serviceList': {'service': {'SCPDURL': '/WANCfg.xml',
                                                                  'controlURL': '/ctl/CommonIfCfg',
                                                                  'eventSubURL': '/evt/CommonIfCfg',
                                                                  'serviceId': 'urn:upnp-org:serviceId:WANCommonIFC1',
                                                                  'serviceType': 'urn:schemas-upnp-org:service:WANCommonInterfaceConfig:1'}}}},
            'deviceType': 'urn:schemas-upnp-org:device:InternetGatewayDevice:1',
            'friendlyName': 'WNDR3700v2 (Gateway)',
            'manufacturer': 'NETGEAR, Inc.',
            'manufacturerURL': 'http://www.netgear.com',
            'modelDescription': 'WNDR3700 router',
            'modelName': 'WNDR3700 router',
            'modelName': 'WNDR3700 router',                                                                                                                                           [1/1926]
            'modelNumber': 'WNDR3700',
            'modelURL': 'http://www.netgear.com/products',
            'presentationURL': 'http://www.routerlogin.net',
            'serialNumber': '00000000',
            'serviceList': {'service': {'SCPDURL': '/Layer3F.xml',
                                        'controlURL': '/ctl/L3Forwarding',
                                        'eventSubURL': '/evt/L3Forwarding',
                                        'serviceId': 'urn:upnp-org:serviceId:L3Forwarding1',
                                        'serviceType': 'urn:schemas-upnp-org:service:Layer3Forwarding:1'}}},
 'specVersion': {'major': '1', 'minor': '0'}}

Since I have no idea what the URLBase key should be like or which key in this config could replace it, I cannot fix this.

install error

windows 10,Python 3.5.1
pip3 install netdisco

then error comes

 ----------------------------------------
  Failed building wheel for netifaces
  Running setup.py clean for netifaces
Failed to build netifaces
Installing collected packages: netifaces, zeroconf, netdisco
  Running setup.py install for netifaces ... error
    Complete output from command python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\pip-build-7l373rjf\\netifaces\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record C:\Users\ADMINI~1\AppData\Local\Temp\pip-qkxw779n-record\install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_ext
    building 'netifaces' extension
    error: Unable to find vcvarsall.bat

    ----------------------------------------
Command "python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\pip-build-7l373rjf\\netifaces\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record C:\Users\ADMINI~1\AppData\Local\Temp\pip-qkxw779n-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\ADMINI~1\AppData\Local\Temp\pip-build-7l373rjf\netifaces\

Received packet from invalid interface.

Nov 21 08:34:42 home-assistant hass[4346]: #033[32m16-11-21 08:34:42 INFO (Thread-25) [netdisco.service] Scanning#033[0m
Nov 21 08:34:42 home-assistant avahi-daemon[497]: Received packet from invalid interface.
Nov 21 08:34:42 home-assistant avahi-daemon[497]: Received packet from invalid interface.
Nov 21 08:34:42 home-assistant avahi-daemon[497]: Received packet from invalid interface.
Nov 21 08:34:42 home-assistant avahi-daemon[497]: Received packet from invalid interface.

yamaha.py - TypeError: list indices must be integers or slices, not str

$ python3 -m netdisco
Discovered devices:
Traceback (most recent call last):
File "/usr/local/Cellar/python3/3.5.2_3/Frameworks/Python.framework/Versions/3.5/lib/python3.5/runpy.py", line 184, in _run_module_as_main
"main", mod_spec)
File "/usr/local/Cellar/python3/3.5.2_3/Frameworks/Python.framework/Versions/3.5/lib/python3.5/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/usr/local/lib/python3.5/site-packages/netdisco/main.py", line 31, in
main()
File "/usr/local/lib/python3.5/site-packages/netdisco/main.py", line 23, in main
print(dev, netdisco.get_info(dev))
File "/usr/local/lib/python3.5/site-packages/netdisco/discovery.py", line 104, in get_info
return self.discoverables[dis].get_info()
File "/usr/local/lib/python3.5/site-packages/netdisco/discoverables/init.py", line 40, in get_info
self.info_from_entry(entry) for entry in self.get_entries()))
File "/usr/local/lib/python3.5/site-packages/netdisco/discoverables/init.py", line 40, in
self.info_from_entry(entry) for entry in self.get_entries()))
File "/usr/local/lib/python3.5/site-packages/netdisco/discoverables/yamaha.py", line 13, in info_from_entry
yam['X_serviceList']['X_service']['X_controlURL'][1:])
TypeError: list indices must be integers or slices, not str

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.