Core: Tradfri broken in 0.67 w/ Docker

Created on 14 Apr 2018  Â·  23Comments  Â·  Source: home-assistant/core

Home Assistant release with the issue:
0.67.0

Last working Home Assistant release (if known):
0.66.1

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

Component/platform:
https://www.home-assistant.io/components/tradfri/

Description of problem:
Tradfri is not functioning properly in 0.67

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

tradfri:
  host: xxx.xxx.xxx.xxx
  allow_tradfri_groups: false

Traceback (if applicable):

Sat Apr 14 2018 10:21:13 GMT+0200 (CEST)

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/app/homeassistant/helpers/entity_platform.py", line 161, in async_add_entities
    for entity in new_entities]
  File "/usr/src/app/homeassistant/helpers/entity_platform.py", line 159, in <listcomp>
    self._async_add_entity(entity, update_before_add,
  File "/usr/src/app/homeassistant/components/light/tradfri.py", line 46, in <genexpr>
    TradfriLight(light, api, gateway_id) for light in lights)
  File "/usr/src/app/homeassistant/components/light/tradfri.py", line 167, in __init__
    self._refresh(light)
  File "/usr/src/app/homeassistant/components/light/tradfri.py", line 327, in _refresh
    if light.light_control.can_set_temp:
AttributeError: 'LightControl' object has no attribute 'can_set_temp'


Sat Apr 14 2018 10:13:31 GMT+0200 (CEST)

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/app/homeassistant/helpers/entity_platform.py", line 258, in _async_add_entity
    await entity.async_added_to_hass()
  File "/usr/src/app/homeassistant/components/sensor/tradfri.py", line 52, in async_added_to_hass
    self._async_start_observe()
  File "/usr/src/app/homeassistant/components/sensor/tradfri.py", line 92, in _async_start_observe
    from pytradfri.error import PytradfriError
ImportError: cannot import name 'PytradfriError'

Additional information:
My setup consists of

  • RGB bulb(s)
  • Spectrum bulb(s)
  • White bulb(s)
  • Dimmer(s)
  • Full controller(s)

Most helpful comment

Make sure that if you run Docker or Hass.io, that your <config>/deps folder is empty.

All 23 comments

Having exactly the same issues, home assistant 0.67 in docker, 0.66.1 was running fine.

My config does not have the allow_tradfri_groups config set.

Doing some debugging now and the issue seems to be related to docker setup, as the config and 0.67 work fine in a test setup on my laptop

Looping in @lwis as this appears to be related to changes in https://github.com/home-assistant/home-assistant/pull/11187

Can confirm errors with docker (0.67.0). I also notice that only the tradfri groups (switches) are imported, but no actual lights are found.

Not sure what could cause this given that the dependency looks correct, your error indicates that the _wrong_ version is installed...

@lwis wrong version of what? Thx

Here's output of pip show pytradfri in the docker container:

root@xxx:/usr/src/app# pip show pytradfri
Name: pytradfri
Version: 5.4.2
Summary: IKEA Trådfri/Tradfri API. Control and observe your lights from Python.
Home-page: https://github.com/ggravlingen/pytradfri
Author: balloob, lwis, ggravlingen
Author-email: [email protected]
License: MIT
Location: /usr/local/lib/python3.6/site-packages
Requires:

The version of pytradfri.

On Sat, 14 Apr 2018, 3:17 pm dewgenenny, notifications@github.com wrote:

@lwis https://github.com/lwis wrong version of what? Thx

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/home-assistant/home-assistant/issues/13869#issuecomment-381332236,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AA1TO5sJygiy06poBmudZ15QhEzi5hlIks5togTsgaJpZM4TU-vR
.

Also SSHed into the container (as @dewgenenny did in the edit of his post) and its also showing 5.4.2, i.e. the latest version - so this is likely not the cause?!

Will see if I can take a closer look back the laptop tomorrow

Just checked the dependencies listed for pytradfri as well, seems all to be OK:

root@xxx:/usr/src/app# pip show aiocoap
Name: aiocoap
Version: 0.4a1
Summary: Python CoAP library
Home-page: https://github.com/chrysn/aiocoap
Author: Maciej Wasilak, Christian Amsüss
Author-email: c.[email protected]
License: UNKNOWN
Location: /usr/local/lib/python3.6/site-packages
Requires:

root@xxx:/usr/src/app# pip show DTLSSocket
Name: DTLSSocket
Version: 0.1.7
Summary: DTLSSocket is a cython wrapper for tinydtls with a Socket like interface
Home-page: https://git.fslab.de/jkonra2m/tinydtls-cython
Author: Jannis Konrad
Author-email: Jannis.[email protected]
License: UNKNOWN
Location: /usr/local/lib/python3.6/site-packages
Requires: Cython

root@xxx:/usr/src/app# pip show cython
Name: Cython
Version: 0.28.2
Summary: The Cython compiler for writing C extensions for the Python language.
Home-page: http://cython.org/
Author: Robert Bradshaw, Stefan Behnel, Dag Seljebotn, Greg Ewing, et al.
Author-email: [email protected]
License: Apache
Location: /usr/local/lib/python3.6/site-packages
Requires:

root@xxx:/usr/src/app# pip show pytradfri
Name: pytradfri
Version: 5.4.2
Summary: IKEA Trådfri/Tradfri API. Control and observe your lights from Python.
Home-page: https://github.com/ggravlingen/pytradfri
Author: balloob, lwis, ggravlingen
Author-email: [email protected]
License: MIT
Location: /usr/local/lib/python3.6/site-packages
Requires:

If I can check anything more let me know - I don't have a local deployment without Docker so can't compare.

Edit: Looks like pytradfri states DTLSSocket 0.1.4 as the requirement, not 0.1.7. Will check and see if this has an impact a bit later

Workaround:
Run a patched Dockerfile with following content:

FROM homeassistant/home-assistant:0.67.0
RUN pip3 install pytradfri==5.4.1

Looks like the 5.4.2 version is broken somehow (i am not a python expert)

Workaround works for me too - I just pip uninstalled 5.4.2 and installed 5.4.1 inside the existing docker

Indeed, workaround with pytradfri==5.4.1 instead of 5.4.2 works as expected (at least at first glance).

This seems to break in every other version of HA. I switched to deCONZ instead, works great in Docker (https://hub.docker.com/r/marthoc/deconz/).

The difference between 5.4.1 and 5.4.2 should be very minor. @ggravlingen maybe an issue with PyPi?

Make sure that if you run Docker or Hass.io, that your <config>/deps folder is empty.

@lwis looks like I've made a mistake when publishing. Pypi is on 5.4.0? Can you publish please, I'm unable to for at least a week. Sorry about this. 😔

But wait, I upgraded hass.io this morning and was able to turn a bulb on remotely. At least it was reported as on in the GUI. Maybe it's not pypi?

As @balloob suggested, clearing the deps folder solved the problem for me.

Because I was using watchtower to upgrade my docker instance, this didnt get done automatically.

At least all releases are on pypi. Don't know the integrity of them.
https://pypi.org/project/pytradfri/#history

clearing the deps folder worked for me, too. thanks @balloob

+1 on cleaning the deps folder. Worked great for me.

+1 for emptying deps folder

I'm closing this as it's a non issue. Thanks @balloob.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bdraco picture bdraco  Â·  3Comments

neonandu picture neonandu  Â·  3Comments

arangates picture arangates  Â·  3Comments

sh0rez picture sh0rez  Â·  3Comments

moskovskiy82 picture moskovskiy82  Â·  3Comments