Discovery error since last update

I just updated from 0.43.2 to 0.45 and even after a few restart I still get this error in the log:

2017-05-21 13:54:03 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/lib/python3.4/asyncio/tasks.py", line 233, in _step
    result = coro.throw(exc)
  File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/discovery.py", line 119, in scan_devices
    None, _discover, netdisco)
  File "/usr/lib/python3.4/asyncio/futures.py", line 388, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.4/asyncio/tasks.py", line 286, in _wakeup
    value = future.result()
  File "/usr/lib/python3.4/asyncio/futures.py", line 277, in result
    raise self._exception
  File "/usr/lib/python3.4/concurrent/futures/thread.py", line 54, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/discovery.py", line 145, in _discover
    netdisco.scan()
  File "/home/homeassistant/.homeassistant/deps/netdisco/discovery.py", line 57, in scan
    self.ssdp.scan()
  File "/home/homeassistant/.homeassistant/deps/netdisco/ssdp.py", line 38, in scan
    self.update()
  File "/home/homeassistant/.homeassistant/deps/netdisco/ssdp.py", line 86, in update
    entry for entry in scan()
  File "/home/homeassistant/.homeassistant/deps/netdisco/ssdp.py", line 270, in scan
    return sorted(entries.values(), key=lambda entry: entry.location)
TypeError: unorderable types: NoneType() < str()
1 Like

I have exactly the same problem, but from 0.44.1 -> 0.45

I also had this error (running in Docker), when upgrading from 0.43.x to 0.45.

I had to execute: pip3 install netdisco==1.0.0rc3 , before running home-assistant upgrade.

Also you could update your Python from 3.4 to 3.6. You’ll use less memory and it should be faster :slight_smile:

Same problem.

I tried installing netdisco but it gives me this error

Exception:
Traceback (most recent call last):
File “/usr/local/lib/python3.6/site-packages/pip/basecommand.py”, line 215, in main
status = self.run(options, args)
File “/usr/local/lib/python3.6/site-packages/pip/commands/install.py”, line 342, in run
prefix=options.prefix_path,
File “/usr/local/lib/python3.6/site-packages/pip/req/req_set.py”, line 784, in install
**kwargs
File “/usr/local/lib/python3.6/site-packages/pip/req/req_install.py”, line 851, in install
self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
File “/usr/local/lib/python3.6/site-packages/pip/req/req_install.py”, line 1064, in move_wheel_files
isolated=self.isolated,
File “/usr/local/lib/python3.6/site-packages/pip/wheel.py”, line 345, in move_wheel_files
clobber(source, lib_dir, True)
File “/usr/local/lib/python3.6/site-packages/pip/wheel.py”, line 316, in clobber
ensure_dir(destdir)
File “/usr/local/lib/python3.6/site-packages/pip/utils/init.py”, line 83, in ensure_dir
os.makedirs(path)
File “/usr/local/lib/python3.6/os.py”, line 220, in makedirs
mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: ‘/usr/local/lib/python3.6/site-packages/requests’

You need to execute this command with sudo or an user with enough permission.

Does this need to be installed as the Home Assistant user? I’m using the all in one installer.

Touliloup,
Thank you for the link to this thread. I’ve run pip3 netdisco==1.0.0rc3, no dice.
Just for giggles, I ran it inside of the homeassistant@hassbian level as well. no dice.
I nuked the card and started over with hassbian 1.23 again, verified the same error existed, and started down the path of updating python3.5 and hit a few snags I was hoping you could help guide me with.

From root, I upgraded python following using the information (here), and verified after a reboot that it was now running python 3.5.1, (but when I reviewed the logs in HomeAssistant, its still pulling 3.4
( File "/srv/homeassistant/lib/python3.4/site-pa…blah blah blah).

I then thought I’d get wise and try the incredibly long process within HomeAssistant. As you are probably aware,
“Sorry, user homeassistant is not allowed to execute ‘/usr/bin/apt-get install python3’ as root on hassbian.”

Since outside of the container is running 3.5, and (This Page) says that outside is supposed to work inside, any thoughts on how I can make that happen?

(homeassistant) homeassistant@hassbian:/home/pi $ python3 --version
Python 3.4.2
(homeassistant) homeassistant@hassbian:/home/pi $ exit
exit
pi@hassbian:~ $ python3 --version
Python 3.5.1
pi@hassbian:~ $

About to give up on discovery and figure out the best way to static IP my sonos speakers so I can continue on my tts project! Arghh I was so close.

*Edit I now see that I’m running HA 0.45.1, still with the same errors though.

I just did a fresh install of hassbian (I was unable to upgrade from 0.44.1 to 0.45.0), and I have now the same discovery error. Anyone knows how to fix it ?

1 Like

Ok, tried it but nothing. I also tried to make a downgrade, but nothing. I would like to try at this point to reinstall the 44.1 with AIO but I do not know how to do it. With the normal sequence I install the 45.1

This worked for me:

change row 270 in .homeassistant/deps/netdisco/ssdp.py

from:
return sorted(entries.values(), key=lambda entry: entry.location)

to:
return sorted(entries.values(), key=lambda entry: entry.location or ‘’)

Restart and it works

4 Likes

Thank you for your Solution it worked for me.

i do want to add that there is a difference between " and '
And first i tried to use " But that gave another Error, and i could know that would because there would be needed another " to close whatever what was opened by the first "

but when i tried to use ’ twice it took a long time to start up 2 to 3 minutes but then everything worked So thank you for sharing :smiley:

return sorted(entries.values(), key=lambda entry: entry.location or '')

1 Like

Ola and DJFLuFFy,
That did the trick, discovery works, I’ve just got a malformed XML warning remaining. Not sure if it will lead to anything else, my Chromecast and Sonos speakers were picked up and I can interact with them.

I verified that a complete wipe and reload (Hassbian 1.23) and your solution did indeed by itself resolve the discovery failure. No need to update netdisco, or python.

I thank you both, and everyone else in this thread working past this little bug. Anyone have any idea how we submit the findings and resolution to ‘the group’ that is tirelessly working on this great piece of software?

XML warning:

017-05-23 22:39:18 WARNING (Thread-4) [netdisco.ssdp] Found malformed XML at http://10.18.0.30:8080/upnp: Apache Tomcat/7.0.75 - Error report

HTTP Status 404 - /upnp.jsp


type Status report

message /upnp.jsp

description The requested resource is not available.


Apache Tomcat/7.0.75

This solved for me too :smiley: thanks mate!