Using IKEA TRADFRI dimmers in NodeRED

Let's dim EVERYTHING!

Some time ago, I purchased a set of IKEA smart things. I wanted to use nice looking remotes with my Xiaomi MiHome ecosystem, but it turns out only IKEA lightbulbs were supported and I ended up not using IKEA stuff much due to its limitations. Thanks to your recommendations I got the CC2531 USB Zigbee sniffer and now I can use the IKEA Zigbee bulbs and remotes with anything I want.

IKEA TRADFRI dimmers in NodeRED

Before you can actually use any of the IKEA products, you will have to purchase the CC2531 USB Zigbee sniffer and flash it. Don’t worry, all you need is a Raspberry Pi a couple of wires and 3 min of your time. It’s worth the time and effort. Once this is done, install Zigbee2MQTT and you are ready to play!

In this article, I will show you how to use the IKEA TRADFRI dimmer in NodeRED to dim a light or a group of lights. The script is very simple.

Replicating the dimmer in NodeRED

When IKEA TRADFRI dimmer is turned, it produces MQTT payload. This payload contains more information, but for the purpose of this tutorial I only need the value of "brightness". The IKEA TRADFRI dimmer updates frequently, which is also something we have to deal with.

IKEA TRADFRI dimmer in NodeRED reports back to MQTT IN node under the topic: zigbee2mqtt/dimmer1 (Zigbee2MQTT default topic/device_name). Each time the movement is detected a new MQTT message is sent. These messages can reach higher than ideal posting rate without changing any values. This will clog the system and frankly speaking, we don’t need that much resolution to create a responsive controller.

Zigbee 3.0 Smart RGBW Downlight
Support NotEnoughTech
Buy Zigbee 3.0 Smart RGBW Downlight
Very bright RGB LED light with strong colours!

To prevent the overflow I used 2 nodes RBE and Delay (set in rate limit mode). RBE blocks duplicated values from posting, while the rate limit, sends 2 messages per second. It works well.

IKEA TRADFRI dimmer sends a string, which once translated to JSON, stores the information we need in msg.payload.brightness. I can use a function node to submit a correct payload back via MQTT OUT to zigbee2mqtt/spotlight1/set :

var brightness = msg.payload.brightness;
 msg.payload = {
     "brightness": brightness
 }
 return msg;

I could submit the payload directly, but I have noticed that my Zemismart Downlight was more responsive if one value was submitted.

Conclusion

Using IKEA TRADFRI dimmers in NodeRED is very easy. If you change the colour using a smart assistant, you will be able to dim the lights of that colour. If you would like to override that – with each payload add the colour value to use the IKEA TRADFRI dimmer to revert the colour back and then adjust the brightness. If you have any questions, just leave it in this Reddit thread.

Support NotEnoughTech
A lot of time and effort goes into keeping NotEnoughTech alive! If my work helped you out, consider buying me a coffee or check out exclusive rewards available to Patreon supporters.
SHARE