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

READ MORE
domoticz

Install Domoticz 2020 on Raspberry Pi OS

Step-by-step how-to guide install Domoticz on Raspberry Pi with the latest Raspberry image. With the new Raspberry Pi OS (previously know as Raspbian) this guide has been updated to reflect the latest changes.

Please do not use the Raspberry imager, is still rather buggy at the moment.
Working with Win32 Disk Imager gives better results and is proven to be a reliable way to image your Micro SD card…

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

This tutorial has been verified with the latest Domoticz 2020.2

Prerequisites

  • Raspberry Pi 4 with 2GB or 4GB of memory
    – 32GB Micro SD card (16GB works just fine to!)
    Class 10 from a good brand, such as Kingston, Transcend or Samsung.
    Pay attention to the Read/Write speeds…
    – Original or equivalent USB-C Power supply
    – Active or passive cooling
    Try the Flirc passive cooling case, you won’t be disappointed!
  • Network cable
  • Micro-SD card reader
  • Windows 10 installation with win32 disk imager
  • Free IP address in your network

Tested with

  • Raspberry Pi 4 (4GB 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)
  • Windows 10 ver 1909
  • Win32 Disk Imager

Step 1 – Prepare your Micro SD card

Assuming you work with Windows 10, let’s start by downloading everything we need:

To be sure the SD card is in perfect shape, format the SD 
card before you begin (source: raspberrypi.org):
- Download SD Formatter for Windows
- Follow the instructions and install
- Format your card with SD Formatter

Load the Raspbian image with WIn32 Disk Imager:
– Start Win32 Disk Imager (assuming your already have this application installed)
– Select the Raspbian image file (*.img, unpack the *.zip file first if you have to already done so)
– Select the drive letter of the SD card
– Click on “write” to start imaging your SD card

To enable SSH for a headless configuration you have to add a file named “ssh” to the “boot” partition/disk of the SD card. Make sure you add this file without any extension!!!

Once all these steps have bee taken, put the SD card into your Raspberry Pi, connect power and let it boot for a couple of minutes.

Step 2 – Find the IP adres of your Raspberry Pi

To be able to connect to the Raspberry Pi we need to know the IP adres that has been supplied by your router. Please be aware that we assume your connect your pi with a network cable. You can connect your pi wirelessly but this is not part of this how-to…

There are a couple of ways we can do this and the raspberrypi.org website published a great article about how to do this:
https://www.raspberrypi.org/documentation/remote-access/ip-address.md
For most home environments I believe the easiest way to do this is by installing the Find app on your phone:

Getting the IP address of a Pi using your smartphone

The Fing app is a free network scanner for smartphones. It is available for Android and iOS.

Your phone and your Raspberry Pi have to be on the same network, so connect your phone to the correct wireless network.

When you open the Fing app, touch the refresh button in the upper right-hand corner of the screen. After a few seconds you will get a list with all the devices connected to your network. Scroll down to the entry with the manufacturer “Raspberry Pi”. You will see the IP address in the bottom left-hand corner, and the MAC address in the bottom right-hand corner of the entry.

Source: https://www.raspberrypi.org/documentation/remote-access/ip-address.md

Step 3 – Connect with SSH

Once you have found the IP adres of your Raspberry Pi, connect to it with a tool called Putty. It is a standalone SSH tool and by far an industry standard application for SSH on Windows.

Start the Putty application, fill in the IP address and press Enter. You get a warning “Putty Security Alert” about the host key which you can safely ignore, continue and connect to the Raspberry Pi.
The default username and password are pi and raspberry.

Should you receive an error instead such as “Network error: Connection refused”, you probably did not correctly configure the SSH file on your SD card, most times caused by using a extension with the SSH file, such as SSH.txt for example.
Follow this YouTube video for more help on this matter:
https://www.youtube.com/watch?v=Q1jWk_nu3Ds

Step 4 – raspi-config

Once connected we start with setting up your Raspberry Pi. We can do so by connecting to the Raspberry pi with SSH/putty and running the following command:

sudo raspi-config

raspi-config

2 steps are important here:
– Setting the “Localisation Options”, so the time zone and date are correctly configured
– Setting a fixed IP address with “Network Options”, so we can always find back the Raspberry Pi in our network.

To do so, check the Raspberry Pi documentation, there are also plenty of YouTube video’s that can assist you with this step.
https://www.raspberrypi.org/documentation/configuration/raspi-config.md

Step 5 – Update, upgrade and reboot

To make sure we have the latest software versions, run the following command on your Raspberry Pi:

sudo apt update -y && sudo apt upgrade -y && sudo reboot

Your Raspberry pi will start updating and upgrading automatically.
Once done it will reboot your Raspberry Pi, your SSH connection terminates during reboot so you know when it’s finished. Rebooting can take a 1-2 minutes is my experience.

Step 6 – Install Domoticz

Once the Raspbian setup and preperation has been completed, it’s finally time to install Domoticz on your Raspberry Pi 4! Connect to your Raspberry with SSH/Putty if you have not already done so and execute the following command to automatically install Domoticz for you:

curl -L https://install.domoticz.com | bash

Source: https://www.domoticz.com/wiki/Raspberry_Pi

During installation you are able to configure the HTTP port, by default configured on port 8080.

You could change this to port 80, the default port for HTTP traffic. This way, you do not need to write “:8080” every time to connect to your Domoticz installation. However, should you wish to install Dashticz later on, port 80 could become conflicted.
My advise, stick to the default port 8080!

After this, you are all done and Domoticz should be up and running!

READ MORE

The N.I.E.S. Project

And so it begins, the “N.I.E.S.” project!

For some time now, I want to know a bit more about the air and comfort quality in my house. Also, as it is subject more spoken of these days, I want to know more about the subject. At first it was more about air quality, but as I recently moved to a new house I also wanted to see if I can measure comfort in my home.

I already measured things like temperature and humidity before, but I want to know more. Partly because others around me started to ask me questions like ‘Have you been breathing the same air as me?’ and most famously ‘What the hell have you been smoking?’, but that is a different story…

And so, a new project is born…
Dubbed “N.I.E.S.”, stands for “NodeMCU Indoor Environment Sensor”.

In the end my goal would be to have a working sensor in place in my living room that measures some important environment factors related to my health and well-being with an indicator of some sort that warns me to ventilate or take other actions. It also should be ecstatically pleasing but I guess that is something that will probably be kicked down the road once or twice during the project.

Ow, and it should work together with my home domotica platform, currently Domoticz.

Ow again, i really want to use a NodeMCU for this project. Not only because this leads to a really, really cool project name (‘nies’ is a Dutch word for sneezing and a common first name for a female in my country) but also because I like the filthy-cheap board from China with the ESP8266 SOC slapped on it. It’s in reach for everybody and it supports ESPEasy out of the box, what more do we want!

I hope to keep the project under the € 100,– if possible…
(Men can have dreams right?)

So with a bit of groundwork I chopped the project up into a few different phases:

  1. Introduction
  2. What is air quality and comfort?
  3. What are the main risks of poor indoor air quality?
  4. What to measure for and how to interpret the results, based on the main risks?
  5. What do other product on the market offer and for what price?
  6. Settings the rules for N.I.E.S.
  7. Theoretical concept, drawings and kitlist
  8. Proof of Concept
  9. First results
  10. Making it available for everybody…

READ MORE
  • 1
  • 2