Upgrade to 0.55.0 Ikea Tradfri not working anymore

If I try this, might this mess up later Home Assistant updates when it is actually fixed in a newer release?
Or is it safe enough to run this manual commands and installations?

Sorry, maybe I’m the wrong person to be asked about this. I can’t imagine this would cause any harm, because you’re just installing some packages, but on the other hand maybe I’m wrong about this…

This worked for me, thanks a lot :slight_smile:

with the latest hassbian image?

Mine is a stand alone install on Raspbian

Thanks to @Daigo i got it working finally.

five caveats:

  1. you have to stop home assistant before upgrading
  2. you need a recent python version. Update to stretch (link)
  3. if you are in a virtual python env, be sure to activate that
  4. execute the steps from Upgrade to 0.55.0 Ikea Tradfri not working anymore from the /tmp directory
  5. pip3 install cython takes 15-20 minutes on my pi3. And there is no progress bar…

After installing there are nice new features:

You can pass a transition time and simulate a wakeup light:
image

5 Likes

So, is there an easy way to fix this when running HA in a docker container on a Synology nas?
Justr bought new bulbs today and can’t automate them :wink:
I need my automating fix going!
But dem lights no work! :frowning:

Thanks to @rubyan and @Daigo.
With your tips it now works perfectly again for me :slight_smile:

My HA is running on Openmediavault (Debian Jessie) with manually installed Python 3.6.3.

1 Like

I have been trying all the step recommended here and it says that I have the a the right things installed.
But when starting HA AIO again I get ImportError:No module named ‘aiocoap’

when doing autoreconf I get
aclocal: warning: autoconf input should be named ‘configure.ac’, not ‘configure.in’

The installation instructions are in the process of being updated: https://github.com/home-assistant/home-assistant.github.io/pull/3558

I got it working by re-making my home-assistant virtual-env (note that aiocoap needs python >= 3.4.4, and virtual environments may package the python binary inside them too), and followed the upstream pytradfri async installation scripts, in addition to installing cython with pip (again inside the venv), Note that, as some comments in the PR above states, you need to install autoconf to build too…

Thanks to @rubyan and @Daigo got it working also, new snapshot of the envr, coming up!

I’ve tried this several times now, but still not getting it to work…

I’m fairly confident I’m on the right versions of TinyDTLS and AioCoap, but still my log looks like this:

2017-10-10 09:07:04 ERROR (MainThread) [homeassistant.core] Error doing job: Exception in callback _SelectorDatagramTransport._read_ready()
Traceback (most recent call last):
  File "/usr/lib/python3.5/asyncio/events.py", line 126, in _run
    self._callback(*self._args)
  File "/usr/lib/python3.5/asyncio/selector_events.py", line 1077, in _read_ready
    self._protocol.datagram_received(data, addr)
  File "/home/pi/.homeassistant/deps/lib/python3.5/site-packages/pytradfri/api/aiocoap_api.py", line 30, in _patched_datagram_received
    self.parent._dtls_socket.handleMessage(self.parent._connection, data, 0)
  File "DTLSSocket/dtls.pyx", line 258, in DTLSSocket.dtls.DTLS.handleMessage
TypeError: handleMessage() takes exactly 2 positional arguments (3 given)
2017-10-10 09:07:20 ERROR (MainThread) [homeassistant.core] Error doing job: Exception in callback _SelectorDatagramTransport._read_ready()
Traceback (most recent call last):
  File "/usr/lib/python3.5/asyncio/events.py", line 126, in _run
    self._callback(*self._args)
  File "/usr/lib/python3.5/asyncio/selector_events.py", line 1077, in _read_ready
    self._protocol.datagram_received(data, addr)
  File "/home/pi/.homeassistant/deps/lib/python3.5/site-packages/pytradfri/api/aiocoap_api.py", line 30, in _patched_datagram_received
    self.parent._dtls_socket.handleMessage(self.parent._connection, data, 0)
  File "DTLSSocket/dtls.pyx", line 258, in DTLSSocket.dtls.DTLS.handleMessage
TypeError: handleMessage() takes exactly 2 positional arguments (3 given)
2017-10-10 09:07:53 ERROR (MainThread) [homeassistant.core] Error doing job: Exception in callback _SelectorDatagramTransport._read_ready()
Traceback (most recent call last):
  File "/usr/lib/python3.5/asyncio/events.py", line 126, in _run
    self._callback(*self._args)
  File "/usr/lib/python3.5/asyncio/selector_events.py", line 1077, in _read_ready
    self._protocol.datagram_received(data, addr)
  File "/home/pi/.homeassistant/deps/lib/python3.5/site-packages/pytradfri/api/aiocoap_api.py", line 30, in _patched_datagram_received
    self.parent._dtls_socket.handleMessage(self.parent._connection, data, 0)
  File "DTLSSocket/dtls.pyx", line 258, in DTLSSocket.dtls.DTLS.handleMessage
TypeError: handleMessage() takes exactly 2 positional arguments (3 given)
2017-10-10 09:08:20 ERROR (MainThread) [coap] Exception CancelledError() can not be represented as errno, setting -1.
2017-10-10 09:08:20 ERROR (MainThread) [homeassistant.components.tradfri] Tradfri setup failed.
Traceback (most recent call last):
  File "/home/pi/.homeassistant/deps/lib/python3.5/site-packages/pytradfri/api/aiocoap_api.py", line 77, in _get_response
    r = yield from pr.response
  File "/usr/lib/python3.5/asyncio/futures.py", line 380, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.5/asyncio/tasks.py", line 304, in _wakeup
    future.result()
  File "/usr/lib/python3.5/asyncio/futures.py", line 293, in result
    raise self._exception
  File "/usr/local/lib/python3.5/dist-packages/aiocoap/protocol.py", line 814, in _run_outer
    yield from cls._run(app_request, response, weak_observation, protocol, log, exchange_monitor_factory)
  File "/usr/local/lib/python3.5/dist-packages/aiocoap/protocol.py", line 863, in _run
    blockresponse = yield from blockrequest.response
  File "/usr/lib/python3.5/asyncio/futures.py", line 380, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.5/asyncio/tasks.py", line 304, in _wakeup
    future.result()
  File "/usr/lib/python3.5/asyncio/futures.py", line 293, in result
    raise self._exception
aiocoap.error.RequestTimedOut

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/homeassistant/components/tradfri.py", line 121, in _setup_gateway
    api = yield from api_factory(host, key, loop=hass.loop)
  File "/home/pi/.homeassistant/deps/lib/python3.5/site-packages/pytradfri/api/aiocoap_api.py", line 160, in api_factory
    yield from request(Command('get', ['status']))
  File "/home/pi/.homeassistant/deps/lib/python3.5/site-packages/pytradfri/api/aiocoap_api.py", line 125, in request
    result = yield from _execute(api_commands[0])
  File "/home/pi/.homeassistant/deps/lib/python3.5/site-packages/pytradfri/api/aiocoap_api.py", line 115, in _execute
    _, res = yield from _get_response(msg)
  File "/home/pi/.homeassistant/deps/lib/python3.5/site-packages/pytradfri/api/aiocoap_api.py", line 83, in _get_response
    raise RequestTimeout('Request timed out.', e)
pytradfri.error.RequestTimeout: ('Request timed out.', RequestTimedOut())
2017-10-10 09:08:20 ERROR (MainThread) [homeassistant.setup] Setup failed for tradfri: Component failed to initialize.
2017-10-10 09:08:21 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/aiocoap/transports/tinydtls.py", line 157, in _run
    yield from self._connecting
  File "/usr/lib/python3.5/asyncio/futures.py", line 380, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.5/asyncio/tasks.py", line 304, in _wakeup
    future.result()
  File "/usr/lib/python3.5/asyncio/futures.py", line 285, in result
    raise CancelledError
concurrent.futures._base.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.5/asyncio/tasks.py", line 241, in _step
    result = coro.throw(exc)
  File "/usr/local/lib/python3.5/dist-packages/aiocoap/transports/tinydtls.py", line 169, in _run
    self.coaptransport.new_error_callback(-1, self)
  File "/usr/local/lib/python3.5/dist-packages/aiocoap/protocol.py", line 203, in _dispatch_error
    for key, (monitor, cancellable_timeout) in self._active_exchanges.items():
AttributeError: 'NoneType' object has no attribute 'items'

Does anyone have any tips?

This is great!
Although: I tried this, but only got it to work for brightness…

To simulate a “sunrise” it would be nice to be able to have a transition for colour in parallel (from very warm to very cold light). But simply adding “color_temp” to your call did not work.
Did I do it wrong or has this not been implemented yet?

I tried this also but it looks like it is not implemented yet. There is a lot of development going on as seen on github, so I expect this to become available in future releases.

I think I’ll just wait for an official fix through a new subrelease of Home Assistant.
Seeing so many people struggle…

2 Likes

What about Hass.io. Is it working there?

I would like to know as well… Running Hass.io 0.54 and i would really like to transition my tradfri lights… :slight_smile:

Hi,

have completely rebuild my virtual environment, so, delete the old one and did a fresh home assistant installation and did the steps from @rubyan and @Daigo post.

Now everything works fine with tradfri again. Very nice new features :slight_smile:

1 Like

I can confirm that there is no problem with tradfri lights after upgrading hass.io to v 0.55.

So in Hass.io 0.55 it works, but in Hassbian 0.55 it doesn’t?