Skip to content

Instantly share code, notes, and snippets.

Last active February 10, 2021 19:54
What would you like to do?
Notes on IKEA TRÅDFRI Smart Lighting
Basic MQTT bridge can be found here:
Bridge adds a mDNS entry for a COAP sever:
Service Type: _coap._udp
Service Name: gw:b0-72-bf-25-bf-59
Domain Name: local
Interface: wlan0 IPv4
Address: gw\058b0-72-bf-25-bf-59.local/
TXT version = 1.0.0008
Wireshark trace shows evidence of DTSL setup for the matching port:
3 8.838970 DTLSv1.2 111 Client Hello
Internet Protocol Version 4, Src: (, Dst: (
User Datagram Protocol, Src Port: 36237 (36237), Dst Port: coaps (5684)
nodejs node
Stuggling to get this to connect.
Looks like CoAP can be self describing, which is nice...
{"9001":"Living Room Light","3":{"0":"IKEA of Sweden","1":"TRADFRI bulb E27 opal 1000lm","2":"","3":"","6":1},"9002":1491158817,"9020":1491327551,"9003":65537,"9054":1,"5750":2,"9019":1,"3311":[{"5850":1,"5851":5,"9003":0}]}
{"9001":"Living Room Dimmer","3":{"0":"IKEA of Sweden","1":"TRADFRI wireless dimmer","2":"","3":"","6":3,"9":16},"9002":1491156042,"9020":1491331077,"9003":65536,"9054":0,"5750":0,"9019":1,"15009":[{"9003":0}]}
{"9001":"Living Room","9002":1491158740,"9003":138191,"5850":1,"5851":0,"9039":215546,"9018":{"15002":{"9003":[65536,65537]}}}
java -jar cf-client-1.1.0-SNAPSHOT.jar -psk GET coaps://
{"9001":"Living Room Light","9002":1491158817,"5750":2,"9020":1491232251,"3":{"0":"IKEA of Sweden","1":"TRADFRI bulb E27 opal 1000lm","3":"","2":"","6":1},"9054":0,"9003":65537,"9019":1,"3311":[{"5850":0,"5851":1,"9003":0}]}
java -jar cf-client-1.1.0-SNAPSHOT.jar -psk PUT coaps:// '{"9001":"Living Room Light","9002":1491158817,"5750":2,"9020":1491232251,"3":{"0":"IKEA of Sweden","1":"TRADFRI bulb E27 opal 1000lm","3":"","2":"","6":1},"9054":0,"9003":65537,"9019":1,"3311":[{"5850":1,"5851":1,"9003":0}]}'
Turned on the light
Copy link

taspts commented Apr 2, 2017

Copy link

Hedda commented Apr 5, 2017


Sound as Ikea have choosen to base their implementation on OMA (Open Mobile Alliance) recommended standard of those three logical components; CoAP, and DTLS layers of the LWM2M (Lightweight M2M) protocol stack.

"Lightweight M2M (LWM2M) is a system standard in the Open Mobile Alliance. It includes DTLS, CoAP, Block, Observe, SenML and Resource Directory and weaves them into a device-server interface along with an Object structure."

OMA LightweightM2M (LWM2M) standard:

The Wakaama project covers the LWM2M Protocol, CoAP, and DTLS layers of the LwM2M protocol stack for all three logical components. Wakaama is not a library but files to be built with an application. The Eclipse Wakaama project provides a C portable framework for building LWM2M clients and/or servers. The source code of Wakaama is available from the project webpage. It is written in C and designed to be portable on POSIX compliant systems.

The Eclipse Leshan project provides a Java implementation of LwM2M, allowing to build LwM2M servers and clients. The source code of Leshan is available from the project webpage.

Another option from Eclipse is Californium CoAP client programmed in Java which also supports DTLS

Copy link

hardillb commented Apr 5, 2017

Yeah, I'm really looking for a working nodejs dtls/coap client but I've not found one that actually works yet.

It looks like native DTLS may be on it's way to NodeJS

Copy link

fasmide commented Apr 5, 2017

Hi there

You mentioned wireshark - the traffic is really easy to decrypt just by entering the preshared key in Preferences -> Protocol -> DTLS -> preshared key (must be entered as hex)

Also, i think it is required with a somewhat new build of wireshark - im using wireshark 2.3.0~rc0 where it decrypts perfectly just by entering the preshared key from the box

Edit: i also think you need to have the entire conversation captured in wireshark at least from the start where the ssl/dtls handshaking takes place... :)

Copy link

hardillb commented Apr 6, 2017

@fasmide my version of wireshark (on Ubuntu 14.04) is too old for DTSL decoding, I need to upgrade at some point, but I'm doing ok with out it.

Copy link

Hedda commented Apr 7, 2017

FYI, looks like ha-bridge issue 570 have become a collective point for links and notes about progress around different integrations and implementations


Some of the new links to code implementations in different programming languages include:

r41d found an intersting class in the Android App, after decompliling with apktool, it is located in


Here's his upload:

Copy link

hardillb commented Apr 7, 2017

DTLS-CoAP wireshark dissector ->

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment