ikea-tradfri-assortiment

Ikea TRÅDFRI for Domoticz

Step-by-step how-to guide install the Ikea Tradfri plugin on a Raspberry Pi, with the latest Raspberry Pi OS image and Domoticz.

Thank you everyone for the feedback!

This how-to is part of a bigger series of Domoticz how-to’s on sancla.com

This tutorial has been updated on March 5h, 2021
However, it’s theoretical and has not been verified in real world…
Based on previous tests with older version,
I assume this should work for you…

Prerequisites Ikea TRÅDFRI plugin

Previously tested with

  • Raspberry Pi 4 (2GB model with 16GB sd-card)
  • Raspberry Pi OS Lite 4.19 (release date 2020-05-27)
  • Domoticz Stable 2020.2 (compile date Apr 27 2020)
  • Ikea tradfri plugin v0.9.2

1. Install packages and requirements

Connect to your running Raspberry Pi with Raspbian with SSH.
Then execute these command (it’s easier to copy-paste them into your SSH session if your SSH client supports this -> PUTTY!):

sudo systemctl stop domoticz.service
sudo apt update -y && sudo apt upgrade -y
sudo apt install golang python3 python3-dev python3-pip -y
cd /home/pi/domoticz/plugins/
rm -rf IKEA-Tradfri/
git clone https://github.com/moroen/IKEA-Tradfri-plugin.git IKEA-Tradfri
cd IKEA-Tradfri
sudo -H pip3 install --upgrade pip
sudo -H pip3 install --upgrade setuptools
sudo -H pip3 install --upgrade py3coap
sudo -H pip3 install --upgrade tradfricoap
sudo systemctl start domoticz.service

2. Configure and test Tradfri COAP:

python3 plugin.py config IP KEY
python3 plugin.py list 
  • IP is the address of the gateway.
    A very easy way to find the IP address of your Ikea Tradfri gateway is to use the “Fing” app on your phone.
    Fing app for Android (LINK)
    Fing app for Apple iPhone (LINK)
    See the image below for an example result on the app.
  • Ikea Tradfri Security Key
    KEY is the security-key located on the bottom of the gateway
    (displayed at the orange bar in the picture below).
    WITHOUT THE “-” DASHES !
  • For example:
    python3 plugin.py config gw 192.168.0.123 gB2pK1YUFi5A2hMN
    or
    python3 plugin.py config gw 10.1.2.14 gB2pK1YUFi5A2hMN
  • For reference, this command was recently changed.
    With the old plugin, you needed to run this command:
    python3 tradfricoap.py config 10.1.2.14 gB2pK1YUFi5A2hMN
    This does not work anymore, please use previous mentioned command:
    python3 plugin.py config gw 10.1.2.14 gB2pK1YUFi5A2hMN

3. Restart Domoticz

sudo systemctl restart domoticz.service

4. Enable IKEA-Tradfri in Domoticz

Go to your Domoticz webinterface and then to hardware, to enable the new Ikea hardware device. Fill in the hardware configuration as follows (the screenshot is for indication and has other values!):

  • Enabled: Enabled
  • Name: IKEA Tradfri
  • Type: IKEA Tradfri Plugin – pycoap version
  • Data Timeout: Disabled
  • Add groups as devices: Yes (screenshot deviates!)
  • Observe changes: Yes
  • Polling interval (seconds): 30 (screenshot deviates!)
  • Transition time (tenth of a second): 10
  • Debug: False
Configure the hardware device in Domoticz
Configure the hardware device in Domoticz

Regarding the polling interval seconds:
To observe changes when switched using another method than domoticz (for an Ikea remote for example), enable “Observe changes” and specify a poll interval in seconds. The plugin uses this value to poll the state from the gateway. Thus it can take this amount of time for Domoticz to update the state of the Domoticz switches when you use the regular Ikea remotes.

The minimum poll interval is 5, and the interval should be a multiple of 5 seconds. Using a too short interval tends to freeze the Ikea gateway, requiring cycling the power of the gateway to restore communication. A polling interval of 30 seconds or greater seems to be fine and reduce the occurrence of freezes. Configuring this value lower could make Domoticz start to ‘hammer’ the Ikea Tradfri gateway asking it for the latest states…

If you use Domoticz to change the states of the Ikea devices, and not for example with the Ikea remotes, you can also consider to switch this off (set Observe changes to “No”).

5. Enable devices

If everything is correctly installed and configured, you should now see a list of Ikea devices:

Example of Ikea devices in Domoticz
Example of Ikea devices in Domoticz

Sources & credits

Loading comments...