Home Home Automation Using IKEA TRADFRI dimmers in NodeRED

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, pair your device 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.

Buy USB Zigbee Stick CC2531

Buy it using these links to support NotEnoughTech.

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.

Project Download

Download project files here. Bear in mind that Patreon supporters have early access to project files and videos.

PayPal

Nothing says "Thank you" better than keeping my coffee jar topped up!

Patreon

Support me on Patreon and get an early access to tutorial files and videos.

image/svg+xml

Bitcoin (BTC)

Use this QR to keep me caffeinated in style with crypto-currency

Smart Ideas with

Automate your space in with these ecosystems and integrate it with other automation services

Learn NodeRED

NodeRED for beginners: 1. Why do you need a NodeRED server?

0
To server or not to server? That's a very silly question!

Best Automation Projects

ESP8266 WIFI lights under $5

0
Your Sonoff device can't do this!

Free wireless doorbell (Amazon Dash button hack)

0
The most terrifying situation I can imagine* is missing a parcel

New Amazon Dash Buttons

0
You can teach new buttons old tricks!

ESP8266 ceiling light – demo

0
Testing the ESP8266 as a WIFI light controller

Try Tasker and Raspberry Pi for your home automation needs!

0
Raspberry Pi can help you with your Tasker profiles

Smart Home

If Edison made smart lights: OEEONE ZigBee lightbulb

0
OEEONE ZigBee lightbulb may look vintage, but packs the latest ZigBee protocol

Zemismart Zigbee switch

0
Zemismart Zigbee switch to control the light and your wall switch!

IFTTT Pro Alternative: Alexa ed.

0
Bypass IFTTT Pro restrictions for Alexa voice actions with this IFTTT Pro Alternative

The answer to almost all Echo needs: Alexa-remote2

0
Alexaremote2 is a Swiss army knife for Amazon Echo devices. Connect, control and listen to all Alexa enabled gadget at home.

This ESP32 is on FIRE! – M5Stack Core

0
This ESP kit is on fire! M5Stack Core merges IoT platform and learning in a very polished stackable module.