Looking for examples to use node-red-contrib-ikea-tradfri

I'm quite new to node red, but have managed to send values to my Tradfri light via function node to tradfri-light-control node with

msg.topic = 1;
msg.payload.colorTemperature = myColorTemperature;   // from 0=warm to 100=cold
msg.payload.brightness = myBrightness;   // from 0=dark to 100=bright

I like the way that I can select the specific light bulb directly from the node via drop-downs, so I don't have to deal with instanceIDs on the lower level. However I haven't managed to get the values FROM the device. With a tradfri-monitor node I can see events and it would be possible to search for objects that match on a "low-level" way, but is there a better way? The tradfri-state node needs to have the instanceID as an input, so I'm wondering wow this node should be used.

Has anybody got an example how to use this?

according to the readme, that is what you'd use to get state.

Where you say "search for objects" i think if you use a switch node to filter the messages coming out of the monitor node you can then direct them to a different path(flow). You can then use a change node to move the value of interest into msg.payload as the incoming msg should will always be the same format. I.E. No need to "search".


I always recommend watching this playlist: Node-RED Essentials. The videos are done by the developers of node-red. They're nice & short and to the point. You will understand a whole lot more in about 1 hour. A small investment for a lot of gain.

Hi Steve-Mcl,

thank you for your comments! I've followed you suggestion to watch the videos - and learned a lot! With a switch node I was able to filter messages from the tradfri-monitor node based on the internal instanceIDs of the light bulb, so thank you for pointing me in the right direction. Now I can use the Tradfri remote control, buttons or the IKEA app to change the light and forward that change to my Loxone home automation system and vice versa.

I still don't understand the usage of the tradfri-state node, but maybe I have to get deeper into node red first.

With the current approach I have to sniffer the instanceIDs via debug node that is connected to the tradfri-monitor node and add the specific ID of my light bulb to the switch node. The final output is a tradfi-light-control node where the specific light bulb (having that specific instanceID) is selected by a comfortable drop down menu and the user friendly name. Maybe that's due to the fact that the library is in an early development state? Maybe the IKEA tradfri gateway is able to send any changes to a "hook" that is implemented by the tradfri-monitor node (without polling)?

I'm also for more documentation about the way the IKEA tradfri gateway communicates withe the app. I found some good starting point at GitHub - glenndehaan/ikea-tradfri-coap-docs: How can you communicate to your ikea tradfri gateway/hub through coap-client with the coap-client to read stuff from the gateway, but I'm not sure if polling is the only way. At least the tradfri-monitor is sending any changes from IKEA remote controls quite fast.

I'm also progressing in node-red to use different nodes instead of a single function node that does everything in Javascript in an "old-school" way ;-).

Still I'm wondering if there are any people out there who use the IKEA Tradfri gateway instead of a zigbee gateway (either Philips Hue bridge or USB-Stick like conBee)? I've found a lot of examples for the others, but no examples for this library or the @fetchbot/node-red-contrib-ikea-home-smart library.

I like the IKEA tradfri gateway, the secure coap communication and the "local only" approach. This fits perfectly to my Loxone home automation system. It's a bit sad that IKEA has not published an official documentation about the API they use, but it looks that all important facts have been discovered already.

Cheers, Jan

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.