SOLVED: Please add support for blinds activated in the IKEA integration

Now that @ggravlingen with the help of a few testers made the pytradfri integration work with blinds, could you add support for this in the IKEA integration?

As @ggravlingen is the author of the Ikea tradfri integration, it should happen at some time.

1 Like

I’ve suggested changes to the Home Assistant code base implementing basic support for the cover. Need testers to verify it works before the code can be merged and support added:
https://github.com/home-assistant/home-assistant/pull/26659

2 Likes

@ggravlingen how can I help you with that part? :slight_smile:

One way is to clone my branch and run HA standalone. That’s what I would have done. There might be other ways now that HA is run in dockers, but I’m afraid I don’t know how.

1 Like

Ok, I do have the Pi3B+ which is not currently in use (it’s getting ready for a magicmirror), so I guess I could clone your branch to that. Do you know what will happen with the IKEA gateway if I have two HA’s talking to it at the same time?

It should be fine, I would say. Compare it to being in a house with two people having the IKEA app running at the same time on two separate devices.

1 Like

@ggravlingen I got your fork installed, and it is up and running, but when I try to enter the code from the gateway I get an ‘unknown error’. It is of course already installed on my existing ha.

Good work getting it up and running! I haven’t made any changes to linking the gateway, only that the blinds are controllable. No errors in the logs?

1 Like

Thinking about it, you probably don’t have all the requirements of pytradfri. These requirements are normally handled by the Home Assistant docker file. If you can get pytradfri to run stand-alone then you should be able to add a link to the gateway.

1 Like

I notice there is a docker file in the base dir of hass. Maybe if you run it, you will get into an environment with all that’s needed installed?

1 Like

Yes, a lot of errors, not sure how to decipher them…
It looks like it complains about the credentials, but I’m positive they are correct.

 File "/home/homeassistant/homeassistant/components/http/real_ip.py", line 40, in real_ip_middleware
    return await handler(request)
  File "/home/homeassistant/homeassistant/components/http/ban.py", line 73, in ban_middleware
    return await handler(request)
  File "/home/homeassistant/homeassistant/components/http/auth.py", line 231, in auth_middleware
    return await handler(request)
  File "/home/homeassistant/homeassistant/components/http/view.py", line 128, in handle
    result = await result
  File "/home/homeassistant/homeassistant/components/config/config_entries.py", line 164, in post
    return await super().post(request, flow_id)
  File "/home/homeassistant/homeassistant/components/http/data_validator.py", line 48, in wrapper
    result = await method(view, request, *args, **kwargs)
  File "/home/homeassistant/homeassistant/helpers/data_entry_flow.py", line 90, in post
    result = await self._flow_mgr.async_configure(flow_id, data)
  File "/home/homeassistant/homeassistant/data_entry_flow.py", line 89, in async_configure
    result = await self._async_handle_step(flow, cur_step["step_id"], user_input)
  File "/home/homeassistant/homeassistant/data_entry_flow.py", line 132, in _async_handle_step
    result: Dict = await getattr(flow, method)(user_input)
  File "/home/homeassistant/homeassistant/components/tradfri/config_flow.py", line 55, in async_step_auth
    self.hass, host, user_input[KEY_SECURITY_CODE]
  File "/home/homeassistant/homeassistant/components/tradfri/config_flow.py", line 164, in authenticate
    key = await api_factory.generate_psk(security_code)
  File "/home/pi/.homeassistant/deps/lib/python3.7/site-packages/pytradfri/api/aiocoap_api.py", line 195, in generate_psk
    self._psk = await self.request(command)
  File "/home/pi/.homeassistant/deps/lib/python3.7/site-packages/pytradfri/api/aiocoap_api.py", line 155, in request
    result = await self._execute(api_commands)
  File "/home/pi/.homeassistant/deps/lib/python3.7/site-packages/pytradfri/api/aiocoap_api.py", line 146, in _execute
    _, res = await self._get_response(msg)
  File "/home/pi/.homeassistant/deps/lib/python3.7/site-packages/pytradfri/api/aiocoap_api.py", line 95, in _get_response
    r = await pr.response
  File "/home/pi/.homeassistant/deps/lib/python3.7/site-packages/aiocoap/protocol.py", line 720, in _run_outer
    await cls._run(app_request, response, weak_observation, protocol, log)
  File "/home/pi/.homeassistant/deps/lib/python3.7/site-packages/aiocoap/protocol.py", line 745, in _run
    await protocol.find_remote_and_interface(app_request)
  File "/home/pi/.homeassistant/deps/lib/python3.7/site-packages/aiocoap/protocol.py", line 295, in find_remote_and_interface
    if await ri.fill_or_recognize_remote(message):
  File "/home/pi/.homeassistant/deps/lib/python3.7/site-packages/aiocoap/tokenmanager.py", line 179, in fill_or_recognize_remote
    return await self.token_interface.fill_or_recognize_remote(message)
  File "/home/pi/.homeassistant/deps/lib/python3.7/site-packages/aiocoap/messagemanager.py", line 327, in fill_or_recognize_remote
    remote = await self.message_interface.determine_remote(message)
  File "/home/pi/.homeassistant/deps/lib/python3.7/site-packages/aiocoap/transports/tinydtls.py", line 328, in determine_remote
    dtlsparams = self.ctx.client_credentials.credentials_from_request(request)
  File "/home/pi/.homeassistant/deps/lib/python3.7/site-packages/aiocoap/credentials.py", line 285, in credentials_from_request
    raise CredentialsMissingError("No suitable credentials for %s" % uri)
aiocoap.credentials.CredentialsMissingError: No suitable credentials for coaps://10.11.12.30:5684/15011/9063
2019-09-15 19:20:44 ERROR (MainThread) [coap] Connection loss was not expected.

Could be unrelated, but I see in the #beta channel on discord that folks have had issues with connecting to tradfri after the latest firmware update (1.9.0)

1 Like

@ludeeus looks like the same error. Thanks for the heads-up!

@fribse: this might require a fix in pytradfri, something might have changed in the gateway.m firmware.

1 Like

Yes, I figured as much ::wink:
I did et the docker built, but no change.
So now I at least have an idea on how to test this, I’ll look forward to the next iteration.

Testing has progressed: the cover shows up and it’s state can be changed. There are a few kinks to fix before we’re all done though.

1 Like

@ggravlingen That sounds great, is the ‘enrollment’ problem solved so I should test again?

Unfortunately not and I’m getting conflicting reports of it working/not working on 1.9.

There’s an issue here:
https://github.com/home-assistant/home-assistant/issues/26673

1 Like

Can you please pull my branch again? It’s important that you also update pytradfri to 6.3.1 (pip install pytradfri==6.3.1)

I’ve made an update to pytradfri that hopefully provides a fix to the authentication problem.

1 Like

There are reports of tradfri not working in 0.99.

1 Like