In this article I will add IKEA motion sensor in my Home Assistant using a Zigbee Home Automation or also known as ZHA.
Table of Contents
For what Motion Sensors are used in a Smart Home?
Here is a quick background story:
Motion Sensors are one of the key elements in every Smart Home. They are not only used for security purposes, but for simple yet useful automations like – turning the lights on, when movement is detected and it is dark for example.
IKEA is having a line of Smart Home products called Tradfri, they are having some smart bulb, switches, plugs, and motion sensor. All of the IKEA smart products are using ZigBee network for the wireless communication, which requires you to have a Zigbee hub, or also called gateway or bridge.
This Zigbee bridge will be the middle layer between your Zigbee devices and you, so you will be able to see the status of your devices, to control them, to make automations and so on.
As summary apart from the IKEA Motion Sensor or Smart Bulb or Switch you will also need a Zigbee Gateway. This Zigbee Gateway can be bought:
- From from IKEA, but in this case you will be limited to use only to the IKEA products and that’s it.
- Or you can buy an universal Zigbee bridge and connect every compatible Zigbee device to your Smart Home including IKEA, Philips and many, many more.
I will focus on this latter option, as I think it is far more future proofed and it is not limiting at all. I will share what are the requirements, what I’m currently using and what are the other good choices that you can make, so you can control any Zigbee Device including IKEA motion sensor.
To help you further…
Before I continue to the requirements, I want to give you something for free. I know I said a lot of words that are Smart Home specific until now and I will continue to do so.
However, I want to make the things easier for you, so I created a Smart Home Glossary, which is full of simple, but yet useful explanations of every Smart Home word or acronym that I can think of.
You can download that Smart Home Glossary from my other website – https://automatelike.pro/glossary and again it is completely free.
What is needed to integrate IKEA motion sensor in Home Assistant?
Back to the article, as I promised I will talk about the requirements, or what is needed to make this IKEA Motion sensor project a reality, as well as many others in the future.
The first thing needed is an IKEA Tradfri Motion Sensor – this should be available in any IKEA store.
The next thing that is needed is a Zigbee Gateway. I will try to list the most popular options that are available at the moment.
Currently, I’m using Home Assistant Yellow device that have Integrated Zigbee chip inside and everything is working flawlessly.
There are only two drawbacks of using HA Yellow approach:
- Home Assistant Yellow is not very cheap.
- You have to wait several months to get one.
If you don’t want to buy Yellow or you don’t want to wait I can suggest to get any of the supported devices listed in the Home Assistant Documentation. More specifically in the Home Assistant ZHA page – link
Inside, you can find a lot of known working devices like Conbee usb stick, Sonoff Bridge or Dongle, Nortek and so on and so forth.
I will list some affiliate links to the most popular of these devices, so it will be easier for you if you to check their current prices and to eventually buy something if you like it.
- ConBee II The Universal Zigbee USB Gateway – https://amzn.to/3dpfiO7
- Sonoff Zigbee Bridge – https://amzn.to/3dKbZ4O
- NORTEK Z-Wave/Zigbee Stick – https://amzn.to/3QtQRxS
- Sonoff Zigbee USB Dongle – https://amzn.to/3LKs3jl
The second requirement is to have a Smart Home hub, from where you will be able to create Home Automations and scripts and from where you can orchestrate your smart devices and your home as you wish. Here, I can two hands recommend Home Assistant as the best smart home hub available at the moment.
Home Assistant Yellow is one of the options to get started as it have everything preinstalled and as I said it have an embedded Zigbee support. But there are four other methods that are official and supported and they are virtually free, that is if you have a spare computer or a Raspberry Pi for example.
To help you choose the best method to get Home Assistant, I’m inviting you on my Webinar, where I’m talking about the pros and cons of all of the 4 official Home Assistant installation types + 1 secret and stupid easy way to start experimenting with Home Assistant in under 5 minutes.
This webinar is completely free and you can register right now on my other website –https://automatelike.pro/webinar
As summary, to add IKEA Motion Sensor or any other Zigbee Sensor to your Smart Home you will need two things:
- Compatible Zigbee gateway.
- Working Home Assistant.
Having these two things will allow you to add not only the IKEA motion sensor, but thousands more devices and sensors, so you can make one real and useful Smart Home.
Adding Zigbee Home Automation (ZHA) in Home Assistant
Now is the best time to begin the actual implementation, starting with adding the Zigbee Home Automation or for short ZHA integration in Home Assistant.
Here are the steps that I did:
- Inside Home Assistant, I pressed the “c” button to invoke the search bar and I start typing “integrations“, then I selected Navigate Integrations.
- Depending of the model of the Zigbee Hub (also called Bridge or Gateway), Home Assistant may auto detect that and offer to configure the Zigbee Home Automation (ZHA) integration.
- If ZHA is not auto discovered by Home Assistant, then executing some additional steps might be required to make that ZigBee hub working. The best guide here is the ZHA page in Home Assistant documentation.
- In some cases, the ZHA integration might need to be added manually. This can be done by clicking on Add Integration button (lower right corner) and searching for Zigbee Home Automation. Alternatively, clicking on the My Home Assistant Link below will do the same as above.
- After I clicked Configure, Submit and probably some other buttons (the process was really straightforward) I finally see the “Success” window.
The above window means, that from now on I can use the ZHA (Zigbee Home Automation) integration to add Zigbee devices and sensors to my Home Assistant, which is exactly what I wanted.
Adding Zigbee Devices in Home Assistant using ZHA
After I have the ZHA in Home Assistant I can now start adding Zigbee devices by just putting them in Pairing mode and start scanning from ZHA. This is how I added the IKEA Tradfri motion sensor in my Home Assistant.
- I opened the back lid of the Tradfri Motion sensor and I pressed the pairing button 4 times very quickly. That was needed to put the Motion sensor in pairing mode.
- As result, the red LED located in the front of the Motion Sensor flashed few times.
- Then I opened my Home Assistant Integrations and I pressed the Configure button under the Zigbee Home Automation integration.
- Then I clicked the Add Device button located in the lower right corner and scanning for new ZigBee devices started immediately.
- Soon after new device was found, the ZHA automatically start interviewing it, then configuring it and finally I was able to use my IKEA Motion Sensor in my Home Assistant as new device. This new device was having two very interesting and useful entities: Battery & Motion Sensor 😉
Creating a Home Assistant Automation using IKEA Motion Sensor
When motion is detected turn the lights on is a simple, but yet useful Home Automation and this is how I managed to do it inside Home Assistant using the IKEA Motion Sensor.
Below is the YAML code of the automation that I used. You can copy/paste it inside your Home Assistant to test it in your setup. Of course, you will need to change the device_id
, and both entity_id
records in the YAML to make that automation working for you.
alias: Turn on the Kitchen Lights when there is Motion
description: ""
trigger:
- type: motion
platform: device
device_id: 3c452f2044c51cedffbbf01a73daeec8 #CHANGE TO YOURS
entity_id: binary_sensor.ikea_of_sweden_tradfri_motion_sensor_motion #CHANGE TO YOURS
domain: binary_sensor
condition: []
action:
- service: light.turn_on
data: {}
target:
entity_id: light.kitchen_lights #CHANGE TO YOURS
mode: single
If you prefer the visual automation editor you can check my video about this topic – https://youtu.be/AxZy19IOw4k
Inside the above video I’m creating the automation from start to finish step-by-step.
Outro
If you want to receive new articles like this on a weekly basis, subscribe for my newsletter.
I’m Kiril and I’m done writing. Bye!