connecting IKEA TRÅDFRI to LOXONE using node-red and zigbee2mqtt
As I play a lot with my IoT Devices my daughter came alone asking if she can have a light switch at her bunk bed. As we built our house 3 years ago, I did not know that we get a bunk bed in the kids room. Here i can show you how to connect a IKEA TRÅDFRI On/Off Switch to my LOXONE Smart Home System using node-red and zigbee2mqtt!
Now she can switch on/off all the lights in her room!
So the solution was a cheap and easy one – BOM – Bill of Material:
- IKEA TRÅDFRI on/off Switch
- CC2531 USB Stick Zigbee with zigbee2mqtt Firmware @ Amazon
- Plugged in a Raspberry Pi 2 with Wifi Stick
- zigbee2mqtt
- node-red running somewhere (I have an VM, can also be a Raspberry)
using that Software-Stack:
The Hardware Flow:
The Software Flow – node-red:
Purchase all the things you need:
- Buy all the things from your lovely shop.
- I ordered just the zigbee Stick and drove to IKEA buying the Buttons
Setup your central MQTT Broker and node-red:
- I had already my system up’n’running so I guess you have already that. But you can find a good story here!
Setup the house with LOXONE:
- Puh, that was a long time ago. The main part was done with an electric company doing the setup while building up the house. Later, I started taking over the software configuration, because it was easy to learn and better for me and my life. In short – there not many professional companys doing a good job.
Setup the zigbee2mqtt on a Raspberry Pi:
- That was and easy job, because I found that really good documentation!! So, thanks for the job. I followed the instruction – that’s it.
So, all done – the config:
- Bringing al the new Buttons, Switches and devices I bought from IKEA online was not that difficult. At the Website of zigbee2mqtt is a very good and long list of supported devices and also how to bring them in pairing mode!
- As my zigbee2mqtt Software is still in “allow_join” true, it accepts new devices joining the zigbee network.
- It should look like that:
Mar 01 17:06:47 pi2small npm[455]: zigbee2mqtt:info 2020-03-01 17:06:47: Device '0xec1bbdfffe9ebafc' joined Mar 01 17:06:47 pi2small npm[455]: zigbee2mqtt:info 2020-03-01 17:06:47: MQTT publish: topic 'zigbee2mqtt/bridge/log', payload '{"type":"device_connected","message":{"friendly_name":"0xec1bbdfffe9ebafc"}}' Mar 01 17:06:47 pi2small npm[455]: zigbee2mqtt:info 2020-03-01 17:06:47: Starting interview of '0xec1bbdfffe9ebafc' Mar 01 17:06:47 pi2small npm[455]: zigbee2mqtt:info 2020-03-01 17:06:47: MQTT publish: topic 'zigbee2mqtt/bridge/log', payload '{"type":"pairing","message":"interview_started","meta":{"friendly_name":"0xec1bbdfffe9ebafc"}}' Mar 01 17:07:24 pi2small npm[455]: zigbee2mqtt:info 2020-03-01 17:07:24: Device '0xec1bbdfffe9ebafc' is supported, identified as: IKEA TRADFRI remote control (E1524/E1810) Mar 01 17:07:24 pi2small npm[455]: zigbee2mqtt:info 2020-03-01 17:07:24: MQTT publish: topic 'zigbee2mqtt/bridge/log', payload '{"type":"pairing","message":"interview_successful","meta":{"friendly_name":"0xec1bbdfffe9ebafc","model":"E1524/E1810","vendor":"IKEA","description":"TRADFRI remote control","supported":true}}' Mar 01 17:07:24 pi2small npm[455]: zigbee2mqtt:info 2020-03-01 17:07:24: Configuring '0xec1bbdfffe9ebafc' Mar 01 17:07:30 pi2small npm[455]: zigbee2mqtt:info 2020-03-01 17:07:30: Successfully configured '0xec1bbdfffe9ebafc'
- Now a new device has joined my the zigbee network and you can use it!
Status for now:
- IKEA Switch in online in your zigbee network
- When pressing button ON/OFF or long ON/OFF aka brightness_up/down/stop a new MQTT message gets fired and can be received by my node-red instance.
So, node-red is the missing link:
- We need a MQTT receiver Node listening to zigbee message
- I my case some topic like zigbee2mqtt/0x680ae2fXXXXf40dX
- So, when pressing buttons, it looks like:
- If so, then you just connect the MQTT Messages with some switch statements to route the messages:
- If so, then you just connect the MQTT Messages with some changes to LOXONE.
The reason for the second change statement is: IF you LONG press the buttons, a different message is sent to MQTT: brightness_up when pressing ON, brightness_down when pressing OFF and brightness_stop when releasing the buttons!!
I did not know that and cannot be found in any documentation.
That’s it 😉