Mysterious light component and/or hue-related error

I’m getting the following error in the log (sometimes 2 or 3 times)

2017-07-29 12:59:27 ERROR (MainThread) [homeassistant.components.light] Error while setting up platform hue
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/homeassistant/helpers/entity_component.py", line 164, in _async_setup_platform
    SLOW_SETUP_MAX_WAIT, loop=self.hass.loop)
  File "/usr/lib/python3.6/asyncio/tasks.py", line 352, in wait_for
    return fut.result()
  File "/usr/lib/python3.6/asyncio/futures.py", line 244, in result
    raise self._exception
  File "/usr/lib/python3.6/concurrent/futures/thread.py", line 55, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/lib/python3.6/site-packages/homeassistant/components/light/hue.py", line 138, in setup_platform
    allow_in_emulated_hue, allow_hue_groups)
  File "/usr/lib/python3.6/site-packages/homeassistant/components/light/hue.py", line 258, in setup_bridge
    update_lights()
  File "/usr/lib/python3.6/site-packages/homeassistant/util/__init__.py", line 303, in wrapper
    result = method(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/homeassistant/util/__init__.py", line 303, in wrapper
    result = method(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/homeassistant/components/light/hue.py", line 182, in update_lights
    api = bridge.get_api()
  File "/usr/lib/python3.6/site-packages/phue.py", line 838, in get_api
    return self.request('GET', '/api/' + self.username)
TypeError: must be str, not NoneType

It first appeared around the time I added the custom_ui by Andrey, so at first I thought they were related… but commenting out those references in customize.yaml doesn’t get rid of the error, so now I’m starting to think it was a coincidence and the real problem is caused by something else I’ve done.

I’m not adept at reading error codes. Does anyone have any idea what this might be?

Not knowing much about Hue and HASS, by looking at the error, it looks like Hue api username seems to be missing in your setup (in file phue.conf, maybe?).

Hope this is somehow useful to you.

@pplucky Thanks for taking a look. That’s very strange, because as far as I know, Emulated Hue doesn’t have any sort of username or password configuration as an option. https://home-assistant.io/components/emulated_hue/

Even weirder that I appear to be the only person getting this error, and that it persisted through a manual upgrade from Hassbian to Hass.io (suggesting it’s something I’ve put in my config that is causing these problems)

I think I’m going to have to comment out half my config and trial and error my way towards understanding what’s causing this :frowning:

I think I solved the problem. For anyone who comes across this error in the future, I just commented out the discovery: line and the errors have stopped. It’s weird, because I don’t have any Hue bulbs or hubs for discovery: to find and throw up errors in the first place, and I used HASS for months before this (always with discovery: on) and no problems.

Maybe an update raised this in my config or something else unknown.

Unsure if there’s any underlying issues that remain or if just turning off discovery hides a problem that’s still lurking, but for now at least - out of sight out of mind!

Instead of disabling discovery, just tell it to ignore philips_hue.

discovery:
  ignore:
    - philips_hue 

I was getting the same error messages and as I am not using the hue component, just the emulated hue one I added this to discovery and the errors stopped.

Will