#145 IKEA Trådfri Hack with Gateway, Raspberry connection

In video #140 we hacked the new IKEA Trådfri Smart lighting system using the remote control as a basis. It worked, but had some major disadvantages.
Today, we will use an IKEA gateway and do it right!
– We will eliminate the problems of the current hack
– We will install and pair the gateway with two different bulbs
– We will learn how the system communicates
– We will switch the lights using Node-Red on our Raspberry Pi. Like that, we can use MQTT or many other tools to switch the lights
– We will switch the lights with a normal Linux command
– We will install a Python wrapper. You can use this wrapper as a basis for your own programs
– We will see the CoAP protocol , which was introduced in the last video, in action
– At the end, as promised, I will reveal a “hot” secret about the IKEA bulbs.

We also will use AdvancedIP Scanner to find the IP address of our Gateway

Supporting Material and Blog Page:

Zigbee info:

If you want to support the channel and buy from Banggood use this link to start your shopping: (no additional charges for you)

44 Replies to “#145 IKEA Trådfri Hack with Gateway, Raspberry connection”

  1. Andreas Spiess

    ATTENTION: The FLIR measurements are not correct (probably because o the material or because of the radiation of the LED).They are too high. But still, the whole lamp gets pretty warm.

  2. rumblfmp

    I love the Swiss accent – maybe you could do some videos in Schweizerdeutsch also.
    Thanks for this nice video with a quick overview of the possibilities. In the end I will be linking my Trådfri gateway to a smart home system (openHAB) but it's good to play around with this first to know the ins and outs of the system.

  3. Federico Granata

    I'm wondering if it's possible to hack my whole system so that my orginal switches doesn't power off the bulbs but just send an mqtt message to node-red. This way I could keep using also my original switches. Do you think it can be practical?

  4. Gábor Nyers

    Great series! One question though: if I understand correctly, the same bulb can be operated both with the remote switch and the gateway. I'm curious if it's possible to receive remote switch events through the gateway? That is: if I switch on/off or dim the bulb with the remote control, would I be able to receive these events through the gateway with a computer? Thx!

  5. Silou S

    Hallo Andreas,
    Weil sind wir im gleiches Land (aber bin ich im West, mein Deutsch ist nicht sehr gut), habe ich ein Wunsch. Haben Sie schon ein FB von swisscom versucht zu Hack (es ist nicht IR aber Radio bluetooth oder ???) ?
    Gruss aus Genf

  6. MrOneWorld123

    I have one more use case. How to implement that one? I can't change the electrical installation in my rented apartment. So, many tradfri bulbs are connected to old fashioned physical light switches. However, I still want to implement a night mode. Meaning the bulbs must have 2200k light temperature during night. E.g. can I get an event once a bulb is turned on in order to switch its light color?

  7. MrOneWorld123

    Excellent explanation about the protocols that tradfri uses! I'm interested in "hacking" a tradfri remote control. I want to use the left and right button to switch between scenes despite of switching between light temperature. My goal is to switch between 100% brightness on 2700k and 30% brightness and 5% brightness on 2200k. Just like the non smart Phillips scenes switch bulbs. Right now I need several commands from the tradfri remote to do that.

  8. herrminni

    Just wanted to add, that there is a node-red module ("node-red-contrib-alexa-local") to add a virtual device to Amazon Echo, that can then be used to switch the ikea bulbs.
    P.S.: Thank you Andreas for your videos and excellent explanation

  9. Steve Carter

    The flow won't import for me which suggests a parsing error. Could it be it needs updating since the tradfri node was updated with the new username authentication in the latest tradfri firmware update?

  10. klassich D

    Thanks for the motivation to deal with IKEA Trådfri. So, I bought a bulb and a gateway to give it a try. Because using ioBroker in my home automation anyway, I now use the ioBroker adapter for IKEA Trådfri and it works like a charm. I hope that more light sources other than just bulbs will be available in the future.

  11. overw0rld

    Hi Andreas, thanks a lot for your effort, much appreciated. After connecting the Tradfri Gateway to Node-RED, I'm wondering whether there's a way to receive events, for example from the remote control. Maybe you could point me to the right direction, I'd happily implement an Input Node for node-red-contrib-tradfri. Thanks in advance.

  12. Andrea Prunić

    I'm sorry to rain on your parade, but besides the glorification of NodeRed and Scargill's scipt, where is an actual explanation how to use MQTT?
    DragnDrop a box in NodeRed is not a solution for somebody who has a fully working MQTT server/setup with a bunch of nodes that send a bunch of metrics and is not really into playing with stuff in one's browser – so we need a real explanation how to use existing infrastucture to control Tradfri equipment.

    That explanation should give some suggestions and examples of:
    – how to install/configure an MQTT server/broker of choice (Mosquitto for example)
    – how to install/configure a COAP server of choice (from libcoap for example)
    – how to send and receive COAP messages to/from Tradfri gateway
    – how to recode them into MQTT messages and send/receive them to/from a certain MQTT topic
    – how to use this new or existing MQTT server/broker with the rest of services

    If I need to write my own message translator from COAP to MQTT and back, I'd rather do it in Python and have them run on dedicated hardware then use half of it's memory on silly NodeRed JavaScript interpreter which has no place outside of test lab…and for that, we need a better explanation of the whole setup than a picture of a bunch of interconnected colorful boxes in a browser.

    So, can you digest this whole setup to a more basic/generic setup so that everyone can use any piece of software that does the job instead of relying on a specific one (like, libcoap vs raspbian coap client, whatever it is…)

    Sorry if I sound harsh, but I'm really sick of insisting on Raspberry and NodeRed, as if nothing else exists and there's no other way to do simple stuff…

    Thanks, Andrea

  13. stijniman

    Hey Andreas, I really like your video's. I fell in love with the LoRa series. Would be really interesting if you did a tutorial on GPS tracking through a lora node. It would be a really go alternative to mobile network for embedded tracker use cases

  14. Richard Stott

    I see that the TRADFRI node has the same problem as the Hue ones, the bulb (or function) is fixed by the setting in the node. If this is similar to the Hue node it can be very useful to pass the bulb identity into the node through the 'topic' functionality. This allows the node to operate for multiple bulbs (using the split node) and then to use a database to store scenes. It was quite easy to modify the Hue node for this (but a whole lot harder to get the change adopted into the original node).

  15. Panos S

    you can also try to sniff your zigbee network with something like this

    and Ubiqua Protocol Analyzer which is free for 30days. Just try to leave a device from the zigbee network and join it again, you will catch the zigbee key with this process.

    i dont know if it's usefull in this phase of your project beacause you already find a way to interact with your devices.


    good work btw!

  16. Chuxxsss B

    Don't forget the Pete Scargill script has HA bridge in it for Node-red too. Now all I need is an Alex dot. Anyone got a spare not being used? By the way Andreas I have to go that 17 km trip Tuesday, which you may me laugh with the last episode you did.

  17. zapro_dk

    Wow, that's some hot bulbs! Did you adjust for emissivity on the white surface of the bulbs or check with a thermocouple to check readings of the temperature were correct?

  18. Marko Mrvelj

    Very interesting video. I like IKEA concept a lot, providing affordable system that is using standard protocol. I hope they will improve on that heat problem because it could caus them problems in future.
    In my opinion, one thing that is missing in Trådfri product range is some kind of generic power switch that you can plug in power outlet and then control output. I am thinking to build something like that by getting a Zigbee module and then build something like "Zigbee Sonoff" with it, that is capable of pretending to be an IKEA light bulb.

  19. Emil Wesselink

    nice project again. I did the same with the Philips HUE. I am curious what the get returns with tradfri when the lamp is switch off from main. Is it the same on/off parameter?

  20. René André

    Someone stated (comments of the make article) that the used electrolyte condensators have a lifetime of 10000 hours at 105°C. Am I wrong if I assume that the bulb is likely to die within 1.5 years?

Leave a Reply

Your email address will not be published. Required fields are marked *