New plugin for IKEA Tradfri

I created a new plugin to control IKEA Tradfri light bulbs and outlets using an IKEA Tradfri Gateway. You can:

  • Switch light bulbs on and off
  • Set the dimming level
  • Set the color temperature for lights that support it
  • Switch outlets on and off

To a limited extend, it also updates the status of Tradfri devices.
It unfortunately does not use Veras Zigbee interface, but requires an IKEA Tradfri Gateway. In contrary to ALTHue, it does not work with nor support Philips Hue.

I posted this plugin in the openLuup category, because this plugin for now only works on a Linux system running openLuup. The reason is that Tradfi Gateway communication is based on CoAP. The plugin requires luacoap. Iā€™m working on getting this to work on Vera as well, but that is rather difficult because its Linux distribution and openssl in particular is very outdated.

The easiest way is to use one of my openLuup on Docker (Hub) images (vwout/openluup).
The IKEA Tradfri plugin for Vera can be found at:

Installation instructions (as available in the Github repo):

  • Copy or upload D_TradfriGW.json , D_TradfriGW.xml , I_TradfriGW.xml and L_TradfriGW.lua.
  • Get D_DimmableLight1.xml , D_DimmableRGBLight1.xml and D_BinaryLight1.xml files plus the .json variants from your Vera and copy or upload these when you use openLuup .
  • Add a new device by clicking Create on the Devices page. Use D_TradfriGW.xml as the definition filename and I_TradfriGW.xml as the implementation filename.
  • Wait for the new device to appear.
  • Configure the IP of your Tradfri Gateway in the ip attribute.
  • Lookup the SecurityCode on the bottom for your Tradfri Gateway and enter the code in the corresponding variable of the created device
  • Restart Luup and your devices should appear after a short while. The SecurityCode attribute will be cleared after successful authentication to the gateway.

You will only see light bulbs and outlets. Other devices, such as remotes or motion sensors can be detected by the plugin, but due to limitations (or design decisions) by IKEA, it is not possible to get state notifications from these devices. It therefore has no use to add them as device in Vera or openLuup.

Device that are not supported (I might add support in the future):

  • Multicolor bulbs
  • Curtains (Fyrtur or Kadrilj)
  • Wifi speakers (Symfolisk series - if possible)
5 Likes

Hi @vwout

Itā€™s been a while! Thanks for that contribution. I must say that I know nothing about COaP. This sounds like an alternative to, say, MQTT, in the HA context. I struggle to see why they chose this rather than plain HTTP (albeit the protocol is lighter-weight.)

Nice!!! The only thing missing (actually the only thing of ikea Iā€™m interested in) is the Fyrtur .
Would be nice if the could be the next in line!

Keep up the good work!
/Mattias

1 Like

It is what it is, but CoAP has some advantages. Itā€™s server is probably more lightweight than MQTT. It supports observer patterns (would also be possible with WebSockets). And it uses UDP. CoAP wouldnā€™t be that much of an issue if only the Vera toolchain was a bit less ancient. Thatā€™s where my main struggle is.

Main reason for not adding support yet, is that I donā€™t own Ikea smart blinds. Iā€™ll keep this in mind.
Do you volunteer for testing?

Ah, Iā€™m a big fan of UDP for intranets. DataYours uses this between components, as does the openLuup Data Historian.

I donā€™t own any eitherā€¦ Iā€™m not so familiar with openluup and programming eitherā€¦ The Fyrtur is on my future list so if I buy them I defenently will PM youā€¦ Maybe someone in The Swedish FB vera forum hasā€¦ I can give it a tryā€¦

@vwout nice work!! Will try it when/if you can get it to work on a Vera device :wink:

Symfonisk is controlled by the SONOS pluginsā€¦ I have one.

I am thinking more broadly of using a unified zigbee network instead of two (one on vera, one on the philibs hue hub) which would mean that it would have to support both the LL and HA stacks. It seems like Home Assistant is capable of doing just that with the zha component or zigbee2mqtt. Not sure if it could be ported to openluup.

@rafale77 there is actually a smal ā€œTrĆ„dfriā€ remote that can be used for controlling the SONOS speakers through the TrĆ„dfri GW. It can control any sonos speaker.

https://images.app.goo.gl/qeKqioYtymsxHuJFA

Very cool! Thanks. I didnā€™t know that one. I control my sonos volume through Alexa using the habridge at the momentā€¦

I asked to include your package on the repo. Maybe we could get it in the coming weeks. I want to buy their blinds as well, so a native integration is interesting to me as well.

3 Likes

I updated the plugin on Github:

  • Due to a bug, commissioning mode was not activated when started from the plugin
  • Support for blinds has been added (experimental; not tested yet, due to lack of physical devices)

The luacoap library was also updated with some stability fixes. So update the openluup image when running on Docker.

Hi @vwout,

Have you had time to investigate further if your plugin can be made to run on a ā€œVeraā€ device?

Br,
Tomas

tldr; Nope.

I had a cross compilation setup prepared for a configuration that was probably similar to 7.0.29 firmware. In the latest firmware (7.0.31) multiple things have been updated, which is great. Drawback is that I can start all over again.

Besides that, several bugs were discovered in both the plugin and the required library (thanks to some users that are trying to use the plugin on openLuup). Development and specifically debugging is significantly easier or a ā€˜regularā€™ pc-based linux installation.

Multiple enhancements have been added to the plugin since my first post, such as (experimental) support for blinds, storing device names used in openLuup on Tradfri as well and multiple small fixes. But unfortunately you can still only use it on openLuup and it is not stable yet.

2 Likes

Thanks for the update @vwout , no pressure from my side. This plugin would be nice to have but it is not something I canā€™t live without.

I have bought 5 Fyrtur Blinds so when its ready for testing Iā€™m on itā€¦

I already wrote a blind (phun intented) implementation for the Fyrtur devices. A recent version of the plugin should detect the blinds. Iā€™m curious to see the results of that lucky shot.

ahaā€¦ I canā€™t se any blinds coming up, I guess I have connection with the trĆ„dfri gateway when ring is black

You have an old version of the plugin. Be sure to get the latest files from Github.
You should see a ā€˜Debuggingā€™ (switch it on!) and ā€˜Update devicesā€™ (set to ā€˜pollā€™) switch.
afbeelding