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
71.93k stars 30.16k forks source link

Error setting up Hue on restart on version 101 #28402

Closed shauder closed 4 years ago

shauder commented 4 years ago

Home Assistant release with the issue: 0.101.0 - Frontend version: 20191025.1 - latest

Last working Home Assistant release (if known): 0.100.3

Operating environment (Hass.io/Docker/Windows/etc.): Docker on Linux

Integration: https://www.home-assistant.io/integrations/hue

Description of problem: I am seeing a new error after upgrading. The error does not seem to prevent the Hue lights from working. I have 3 Hue hubs integrated with HA and this error appears 2 times. Seems like the error is happening only when there are more than one Hub.

Problem-relevant configuration.yaml entries and (fill out even if it seems unimportant): They were setup through the Frontend UI

Traceback (if applicable):

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 150, in _async_setup_platform
    await asyncio.wait_for(asyncio.shield(task), SLOW_SETUP_MAX_WAIT)
  File "/usr/local/lib/python3.7/asyncio/tasks.py", line 442, in wait_for
    return fut.result()
  File "/usr/src/homeassistant/homeassistant/components/hue/sensor.py", line 36, in async_setup_entry
    await shared_async_setup_entry(hass, config_entry, async_add_entities, binary=False)
  File "/usr/src/homeassistant/homeassistant/components/hue/sensor_base.py", line 44, in async_setup_entry
    await manager.start()
  File "/usr/src/homeassistant/homeassistant/components/hue/sensor_base.py", line 89, in start
    await async_update_bridge(None)
  File "/usr/src/homeassistant/homeassistant/components/hue/sensor_base.py", line 83, in async_update_bridge
    await self.async_update_items()
  File "/usr/src/homeassistant/homeassistant/components/hue/sensor_base.py", line 174, in async_update_items
    current,
  File "/usr/src/homeassistant/homeassistant/components/hue/helpers.py", line 19, in remove_devices
    await entity.async_remove()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 474, in async_remove
    self.hass.states.async_remove(self.entity_id)
AttributeError: 'NoneType' object has no attribute 'states'

I also see this error

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/hue/sensor_base.py", line 83, in async_update_bridge
    await self.async_update_items()
  File "/usr/src/homeassistant/homeassistant/components/hue/sensor_base.py", line 174, in async_update_items
    current,
  File "/usr/src/homeassistant/homeassistant/components/hue/helpers.py", line 19, in remove_devices
    await entity.async_remove()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 474, in async_remove
    self.hass.states.async_remove(self.entity_id)
AttributeError: 'NoneType' object has no attribute 'states'

Additional information: It still seems to connect to all 3 hubs and lights work as expected but these errors did not exist until upgrading.

I restarted many times to make sure it wasn't just a one time thing.

probot-home-assistant[bot] commented 4 years ago

Hey there @balloob, mind taking a look at this issue as its been labeled with a integration (hue) you are listed as a codeowner for? Thanks!

ianfretwell commented 4 years ago

This issue seems to be linked to a problem I saw after moving from 100.1 to 101.2 - I have two Hue bridges - 4 motion detectors on each - on one of them, although the motion detectors are fine the temp & lux level values all changed to 'Unknown'. Revrting to 100.1 fixed it immediately. Thanks.

shauder commented 4 years ago

I have motion sensors but they are in a box since I switched to the wyze ones. I can control all my lights still it seems but this error does not go away. The motion sensors are still paired to my bridges, I forgot to remove them, I can see if only the ones on one bridge work when I am home.

Fuzzerbear commented 4 years ago

My hue motion sensor no longer shows the temp or light level values. (Ive just upgraded to 101.3). Numerous reboots / and Hassbian update made no difference. Please could your repair.

bramkragten commented 4 years ago

Should be fixed with https://github.com/home-assistant/home-assistant/pull/28679