Hack: IKEA Trådfri Motion Sensor for presence control

Very interesting…

That’s correct. The reason I hacked the lamp is because I wanted to have a “small” device in my home IT equipment cabinet and not a lamp switching on/off.

The whole solution? It went quite straight forward by just following the instructions in Home Assistant and zigbee2mqtt sites in other words, there is no real added value in publishing my solution because I would just copy&paste what is on those sites/pages.

Thanks. In the meantime I made my own small project inspired by your post. Using node.js and without HA.

I have found that using this approach you can actually control the lamps with an old-school light sensor. We already have an outdoor light sensor that turns an outdoor lamp on and off. Now by adding a Hue bulb (I use a mix of Hue and Trådfri) in the outdoor lamp, my Pi script can monitor the reachable state of the lamp. It is unreachable most of the time, but when the old sensor turns it on, it becomes reachable. I then use the script to control two more lamps. Thus, an old analog sensor controls 3 Hue/Trådfri lamps without any wireless sensor!

I have one question. How often does HA monitor the on state of the hacked lamp? I use three seconds as this delay is no problem, but I wonder how often you can ping the gateway/bridge without problems.

Actually used this approach to steer a Nexa in-wall switch (433MHz) vía rfxcom.

I’m not sure I follow you. To my understanding, rules are state driven that is, switch states are not monitored but when it changes it triggers a rule. On the other hand you may have, for instance a thermometer. If you create a rule to trigger something at certain temperature then this rule is to be triggered every time a new temperature value is received. That’s my understanding.

In a few words, how does CC2531 with zigbee2mqtt work? Can you make it respond to any zigbee remote control or dimmer (eg. Hue and IKEA), and can you see which remote made the request? In other words, does it work as a kind of bridge or gateway so that you can respond to the zigbee commands you grabbed and turn the lights on and off etc?

take a look at this: https://www.zigbee2mqtt.io/information/supported_devices.html
If the device is listed then it can be paired with CC2531. Then you read the state in HA and take actions.

1 Like

I have a CC2531, and a Tradfri motion sensor.
What I did to notify HA on motion activities is this:

Pressing the pair button (in the middle) 4 times in a row. The red light on the front side should flash a few times and the turn off. After a few seconds it turns back on and pulsate. When connected, the light turns off.

I’ve got the Tradfri as “unsupported” in the zigbee2mqtt map… Partial success so far


After that I followed this:

  1. Forced the device removal
  2. Stopped zigbee2mqtt on hass.io
  3. Removed the coordinator usb pen from the raspberry pi
  4. Reattached the coordinator
  5. Restarted zigbee2mqtt
  6. Re-paired the E1743 again

And now it works!


2 Likes

I have connected my ikea motion sensors with zigbee2mqtt instead of using the ikea hub, and I can use the motion sensor standalone in HA. Why all this hard work?

2 Likes

I guess because at that time (2018) this motion sensor was not supported on zigbee2mqtt

2 Likes

I’m using the Tradfri with the DeCONZ Raspbee Gateway. For anyone trying to do this, there is no hacking required anymore =)

1 Like

The hacking is more fun! Lol. I bought 3 Tradfri motion sensors, 1 gateway and 3 GU10 bulbs. The GU10 bulbs are super easy to extract the zigbee module, add a 3.3V DC-DC module and voila…cheap motion sensors. Thanks for this awesome hack!

Post your automatin please ? :slight_smile:

The sensor is connected in HA thru zigbee2mqtt but the sensor state stays at N/A
No movement is detected… I can see the battery level. What am I doing wrong?

1 Like

I like the idea!
Here my solution without soldering: I used the script in the example and added the virtual motion detector. When it detects motion, I immediately turn off the light. In my case I wanted the light on in the evening, so I added a condition that it only turns it off when the sun is set.

same here. What could be done to fix this?

What coordinator are you using, and what firmware version is on it ?

I also am having issues with this. I bought the CC2531 as a “Sonoff stick” but not sure if I need to reflash it. It seems to work fine so far wtih my existing devices, but I cannot get the TRADFRI motion sensor to report anything but the battery level.

I tried resetting the device, tried pairing through a TRADFRI outlet instead of direct to coordinator, I even started a zigbee2mqtt setup from scratch and still, no data.

The motion sensor is on version 20190308, but I don’t know what firmware is my stick running. Do I need to reflash the CC2531 to make this work properly?

You need to reflash the stick with the latest firmware. If it is still on the firmware from Sonoff, that one is too old for the Tradfri devices to pair.

1 Like

I’m using the Tradfri with the DeCONZ Raspbee Gateway. For anyone trying to do this, there is no hacking required anymore =)

Could you please elaborate this?

I am using the motion sensor with the ConBee2-stick but can’t figure out how to make it more responsive.

Do you use the latest firmware? I am using the raspbee, maybe there is a difference, but after updating the fw it just works.