Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Philips Hue gone at 0.66.0: 'Config' object has no attribute 'apiversion' #13571

Closed
m0wlheld opened this issue Mar 31, 2018 · 30 comments
Closed

Comments

@m0wlheld
Copy link

Home Assistant release with the issue:
0.66.0

Last working Home Assistant release (if known):
0.65.6

Operating environment (Hass.io/Docker/Windows/etc.):
HA running in official docker container for Raspberry Pi 3 on Raspbian Stretch

Component/platform:

https://www.home-assistant.io/components/hue

Description of problem:
After upgrading the Hue bridge is not recognized any more. This is not related to the new configuration scheme as mentioned by the 0.66.0 release notes. Traceback is available below. The final error message says: 'Config' object has no attribute 'apiversion'

Problem-relevant configuration.yaml entries and (fill out even if it seems unimportant):

hue:
  bridges:
    - host: 192.168.5.49
      allow_hue_groups: False

Traceback (if applicable):

app_1         | 2018-03-31 09:43:58 ERROR (MainThread) [homeassistant.components.light] Error while setting up platform hue
app_1         | Traceback (most recent call last):
app_1         |   File "/usr/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py", line 82, in async_setup
app_1         |     SLOW_SETUP_MAX_WAIT, loop=hass.loop)
app_1         |   File "/usr/lib/python3.6/asyncio/tasks.py", line 358, in wait_for
app_1         |     return fut.result()
app_1         |   File "/usr/lib/python3.6/site-packages/homeassistant/components/light/hue.py", line 61, in async_setup_platform
app_1         |     int(v) for v in bridge.api.config.apiversion.split('.'))
app_1         | AttributeError: 'Config' object has no attribute 'apiversion'

Additional information:

@m0wlheld
Copy link
Author

I think this error is a related to a required configuration change with 0.66.0. With 0.65.6 the bridge's host-attribute could be a DNS name ("philips-hue" in my case) and that name is also present in file phue.conf . With 0.66.0 only IPv4 addresses are allowed for the host-attribute and obviously (and without discovery enabled) the association to the hue bridge is lost.

@m0wlheld
Copy link
Author

Enabling the discovery component and restarting HA brings back the Hue configuration dialog and linking the bridge creates a new file named "phue-.conf". The IP address is now the primary key in this file and no error is printed any more.

However, no light bulb or other Hue component (motion sensor in my case) is available.

@m0wlheld
Copy link
Author

Restarting HA after linking the bridge to HA using discovery bring's back the error. Traceback:

app_1         | 2018-03-31 10:24:09 ERROR (MainThread) [homeassistant.components.light] Error while setting up platform hue
app_1         | Traceback (most recent call last):
app_1         |   File "/usr/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py", line 82, in async_setup
app_1         |     SLOW_SETUP_MAX_WAIT, loop=hass.loop)
app_1         |   File "/usr/lib/python3.6/asyncio/tasks.py", line 358, in wait_for
app_1         |     return fut.result()
app_1         |   File "/usr/lib/python3.6/site-packages/homeassistant/components/light/hue.py", line 61, in async_setup_platform
app_1         |     int(v) for v in bridge.api.config.apiversion.split('.'))
app_1         | AttributeError: 'Config' object has no attribute 'apiversion'

@m0wlheld
Copy link
Author

Additional info: The bridge is accessible from the HA host / docker container by IP and DNS name. Using the API key present in file phue.conf ("username") to open http://192.168.5.49/api/<API_KEY>/config by cURL returns a JSON document containing apiVersion: "1.24.0"

@m0wlheld
Copy link
Author

Reverting to 0.65.6 while keeping the configuration (using IP address instead of DNS name) brings back the bridge and the associated lights and motion sensors.

If you need any more information, I am willing to help.

@aptonline
Copy link

aptonline commented Mar 31, 2018

I'm getting a similar error,

Error while setting up platform hue
Traceback (most recent call last):
  File "/usr/src/app/homeassistant/helpers/entity_platform.py", line 82, in async_setup
    SLOW_SETUP_MAX_WAIT, loop=hass.loop)
  File "/usr/local/lib/python3.6/asyncio/tasks.py", line 358, in wait_for
    return fut.result()
  File "/usr/src/app/homeassistant/components/light/hue.py", line 56, in async_setup_platform
    bridge = hass.data[hue.DOMAIN][discovery_info['host']]
KeyError: 'host'

My config is as follows:

hue:
  bridges:
    - host: 192.168.1.3
      allow_hue_groups: false

@raoulteeuwen
Copy link
Contributor

I have also lost my hue lights and sensors. I'm trying to downgrade with "sudo pip3 install homeassistant==0.65.6", but i get "[sudo] password for homeassistant" and have no idea what password is needed?

@arsaboo
Copy link
Contributor

arsaboo commented Mar 31, 2018

homeassistant user does not have any password. No need to use sudo if you are homeassistant user.

@dvbit
Copy link

dvbit commented Mar 31, 2018

same behaviour over here.
Tried to modify the conf file manually to have both ip and dns name and matching config file but no way

@zarthan
Copy link

zarthan commented Mar 31, 2018

If you are using the @robmarkcole sensor component you will need to update it. It has been fixed for 0.66

@dvbit
Copy link

dvbit commented Apr 1, 2018

Using standard component. Same symptoms as above. Any solution ?

@balloob
Copy link
Member

balloob commented Apr 1, 2018

You mention "motion sensor" in your description. We do not have a Hue motion sensor integration. This means that you are using a custom component. As written in the release notes, they no longer work.

@m0wlheld
Copy link
Author

m0wlheld commented Apr 1, 2018

binary_sensor:
  - platform: rest
    resource: http://philips-hue/api/f1boUgPa6UH30tNbnqKudTlhM-o8MqcDejmFeHGw/sensors/9
    value_template: '{{ value_json.state.status }}'
    name: hue_sensor_1_movement
    scan_interval: 2

Standard REST.

@m0wlheld
Copy link
Author

m0wlheld commented Apr 1, 2018

Btw: I don't know about Python, but the reported line(s) 61 of file hue.py contains:

api_version = tuple(
    int(v) for v in bridge.api.config.apiversion.split('.'))

I can modify this line and use "api_version = (1,24,0)" but then another line fails (209). Seems that detecting the features of the bridge fails since 0.66 for me and some others.

@balloob
Copy link
Member

balloob commented Apr 1, 2018

So I don't exactly understand how you would not end up with apiversion on the Config object.

  • 0.66.0 Hue requires aiohue==1.3.0 source
  • aiohue 1.3.0 has the property apiversion source

@m0wlheld
Copy link
Author

m0wlheld commented Apr 1, 2018

How can I check that aiohue is present in the proper versions?

@balloob
Copy link
Member

balloob commented Apr 1, 2018

Well the Docker image should install it properly, but you can spin up python3 in your container and run this to see if somehow you're running it from a different location:

>>> import aiohue
>>> aiohue.__file__

@balloob
Copy link
Member

balloob commented Apr 1, 2018

It will print out the location where aiohue is found

image

@m0wlheld
Copy link
Author

m0wlheld commented Apr 1, 2018

Thanks for the instruction. Here's the complete output (the container's name is hassstack_app_1):

$ docker exec -ti hassstack_app_1 python3
Python 3.6.3 (default, Nov 21 2017, 21:28:39)
[GCC 6.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import aiohue
>>> aiohue.__file__
'/usr/lib/python3.6/site-packages/aiohue/__init__.py'

@balloob
Copy link
Member

balloob commented Apr 1, 2018

Can you check to make sure that you definitely do not have any custom component for Hue? Also make sure that your <config dir>/deps does not contain anything hue related in the name.

@m0wlheld
Copy link
Author

m0wlheld commented Apr 1, 2018

I never used any custom component so the custom_component folder does not even exist. But - the deps folder contains some files related to hue, including aiohue 0.3.0 .

Can I remove the deps folder in total and restart the container to download them again?

@balloob
Copy link
Member

balloob commented Apr 1, 2018

yes, that is your problem. delete the folder.

@balloob
Copy link
Member

balloob commented Apr 1, 2018

The container should always contain all dependencies when running under Docker. Only a few dependencies are not installed but aiohue is not one of them.

@aptonline
Copy link

I deleted my deps folder and HA complained couldn’t setup HUE due to lack of dependancies. I’m running in docker also.

@m0wlheld
Copy link
Author

m0wlheld commented Apr 1, 2018

yes, that is your problem. delete the folder.

@balloob Yes, that was the problem at my side. After deleting the deps folder and restarting the container, the Hue component did not complain any longer and all lights and (REST attached) motion sensors are working as expected. Infact, the deps folder was recreated, but stayed empty.

Thanks for the excellent support!

@m0wlheld
Copy link
Author

m0wlheld commented Apr 1, 2018

@aptonline Did you restart the container or did you re-create it (docker rm && docker run)? I did the later and it worked.

@aptonline
Copy link

@m0wlheld I restarted it, I’m using it on a Synology Diskstation docker, I’ll clear the container and try again.

@aptonline
Copy link

@m0wlheld nope same error after clearing the container and restarting.

@aptonline
Copy link

Seems I did have a custom components for HUE switches... removed and now working 👍

@m0wlheld
Copy link
Author

m0wlheld commented Apr 1, 2018

Excellent.

@m0wlheld m0wlheld closed this as completed Apr 1, 2018
@home-assistant home-assistant locked and limited conversation to collaborators Jul 26, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants