Ikea "TRÅDFRI" Gateway and smart lights series for ZigBee Light Link (ZLL) lighting

Xiaomi, Ikea TRÅDFRI, Philips Hue and more.

Moderator: leecollings

Hedda
Posts: 49
Joined: Wednesday 06 July 2016 13:16
Target OS: Linux
Domoticz version:
Contact:

Re: Ikea "TRÅDFRI" smart lights series uses ZigBee Light Link (ZLL)

Post by Hedda »

FYI, some developers in the Home Assistant community have started analyzing the traffic between the Ikea Trådfri app (on Android/iOS) and the Ikea Trådfri Gateway:

https://community.home-assistant.io/t/i ... ee/14788/8

So far they have determened that application looks to communicate over UDP with Ikea Trådfri Gateway encrypted using DTLS v1.2 (Datagram Transport Layer Security).
Hedda
Posts: 49
Joined: Wednesday 06 July 2016 13:16
Target OS: Linux
Domoticz version:
Contact:

Re: Ikea "TRÅDFRI" smart lights series uses ZigBee Light Link (ZLL)

Post by Hedda »

Someone now looks to have figured out how exactly Android/iOS communicates with the Ikea Trådfri Gateway - Turns out it communicates using OMA LwM2M (Lightweight machine-to-machine) security model for IoT device management based on CoAP (Constrained Application Protocol) encrypted with DTLS (Datagram Transport Layer Security) using the PSK (Pre-Shared Key) written on under the physicial Ikea Trådfri Gateway box.

https://bitsex.net/software/2017/coap-e ... a-tradfri/

https://bitsex.net/software/2017/ikea-t ... ee-lights/

This Norwegian guy as linked in two blog posts above have already figured out how monitor and send control commands to the Ikea Trådfri Gateway using standard CoAP to send and recieve commands to its end devices (using DTLS based encrypted communication to the Ikea Trådfri Gateway over network).

https://tools.ietf.org/html/rfc7252

Ikea Trådfri Android application appears to be using multicast (224.0.0.1) to find the Ikea Trådfri Gateway, and then communicates using encrypted CoAP (coaps). Also, it does not look like the Trådfri Gateway attempts to talk to the Internet (as the device looks to have has no outgoing connections). The default Ikea Trådfri Android app is fairly basic, where it currently only let you create schedules for turning on and off, and you can control lights and create zones, and control zones.

Looks like Ikea might have conformed with OMA LightweightM2M (LwM2M) Object IDs and Resource Registry ID as unique identifier
http://www.openmobilealliance.org/wp/OM ... istry.html
Examples:
5750 Application Type
5850 On/Off
5851 Dimmer
5706 Colour

IPSO (IP for Smart Objects) Smart Object Guidelines provide a common design pattern:
https://github.com/IPSO-Alliance/pub/bl ... /README.md
https://github.com/IPSO-Alliance/pub/tr ... er/reg/xml
https://github.com/IPSO-Alliance/pub
IPSO provide common object model for interoperability of IoT Devices and Applications.

OMA LightweightM2M (LWM2M) standard:
http://openmobilealliance.org/iot/
http://openmobilealliance.org/iot/light ... m2m-lwm2m/
http://www.openmobilealliance.org/wp/Ov ... rview.html
http://www.openmobilealliance.org/wp/OM ... istry.html
http://www.openmobilealliance.org/tech/profiles/
https://github.com/OpenMobileAlliance/O ... opers/wiki
http://devtoolkit.openmobilealliance.or ... ck=Default
http://www.openmobilealliance.org/wp/comments.html
https://github.com/OpenMobileAlliance/O ... ers/issues
http://openmobilealliance.hs-sites.com/keep_updated

Intestingly is that CoAP (Constrained Application Protocol) is the protocol which the OCF (Open Connectivity Foundation) backed by most industry gians is promoting to become the standard for IoT. As reference in IoTivity and AllJoyn projects which guidelines one can suspect that Ikea have followed when they choose to go with standard CoAP in the Ikea Trådfri Gateway and its apps.

https://en.wikipedia.org/wiki/Constrain ... n_Protocol

OCF (Open Connectivity Foundation) which is lead by all the indistry giants recently made a merger between IoTivity and AllJoyn happen as lead by the Linux Foundation.

https://en.wikipedia.org/wiki/Open_Conn ... Foundation

CoAP (Constrained Application Protocol) is the protocol which the OCF (Open Connectivity Foundation) is promoting to become the standard for IoT.
Last edited by Hedda on Wednesday 12 April 2017 8:42, edited 1 time in total.
Hedda
Posts: 49
Joined: Wednesday 06 July 2016 13:16
Target OS: Linux
Domoticz version:
Contact:

Re: Ikea "TRÅDFRI" smart lights series uses ZigBee Light Link (ZLL)

Post by Hedda »

Sound as Ikea have choosen to base their implementation on OMA (Open Mobile Alliance) and Eclipse 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."

[*] http://openmobilealliance.org/data-mode ... of-things/
[*] https://connect2.io/open-mobile-allianc ... oma-lwm2m/
[*] http://openmobilealliance.org/constrain ... -protocol/
[*] http://openmobilealliance.org/data-mode ... of-things/
[*] https://connect2.io/open-mobile-allianc ... oma-lwm2m/
[*] https://iot.eclipse.org/standards/
[*] https://eclipse.org/community/eclipse_n ... ticle2.php
[*] https://www.eclipsecon.org/na2014/sites ... %20(1).pdf

The Wakaama project (from Eclipse) 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.

[*] http://www.eclipse.org/wakaama/


You can also build the "dtls" branch of libcoap from:

[*] https://github.com/obgm/libcoap/tree/dtls

And then enter examples and do stuff like:

Code: Select all

echo '{ "3311" : [{ "5851" : 255 }] }' | ./coap-client -u "Client_identity" -k "YOUR_KEY" -v 10 -m put "coaps://192.169..0.3:5684/15001/65538" -f -
You can set the dimmer to something between 0-255.

You can also query all the available endpoints:

Code: Select all

./coap-client -u "Client_identity" -k "YOUR_KEY" -v 10 -m get "coaps://192.168.0.3:5684/.well-known/core"
Last edited by Hedda on Thursday 06 April 2017 8:53, edited 1 time in total.
Hedda
Posts: 49
Joined: Wednesday 06 July 2016 13:16
Target OS: Linux
Domoticz version:
Contact:

Re: Ikea "TRÅDFRI" smart lights series uses ZigBee Light Link (ZLL)

Post by Hedda »

pautomate from the Home Assistant community put together a very simple implementation for his Raspberry Pi.

https://community.home-assistant.io/t/i ... n/14788/19

"Taking no credit of all the hard work others have put in and just put my code here if you want to play around":

First installed the libcoap-library as such:

apt-get install libtool

git clone --recursive https://github.com/obgm/libcoap.git
cd libcoap
git checkout dtls
git submodule update --init --recursive
./autogen.sh
./configure --disable-documentation --disable-shared
make
sudo make install

pautomate put together a very simple Python-script that execute by running shell_commands:

https://github.com/ggravlingen/home-ass ... de/ikea.py

You then run the code by invoking:

python ikea.py "65537" "100" "Yellow"

Or, from within Home assistant as a shell command:

ikealight_off: '/usr/bin/python3 /home/homeassistant/.homeassistant/extraconfig/python_code/ikea.py "65537" "0" "Yellow"'
Hedda
Posts: 49
Joined: Wednesday 06 July 2016 13:16
Target OS: Linux
Domoticz version:
Contact:

Re: Ikea "TRÅDFRI" smart lights series uses ZigBee Light Link (ZLL)

Post by Hedda »

FYI, looks like ha-bridge issue 570 have become a collective point for links and notes about protocols used as well as some code implementations.

https://github.com/bwssytems/ha-bridge/issues/570


Communication between Android/iOS app and the Gateway deffinitly takes place via OMA Lightweight M2M (LwM2M) wrapped in CoAP with DTLS.

Libraries listed under https://en.wikipedia.org/wiki/OMA_LWM2M#Implementations may be best approach instead of writing a new LwM2M library from scratch just for te Ikea Trådfri Gateway.

Such as:

Anjay - C implementation of the client-side OMA LwM2M protocol have very good documentation:

https://avsystem.github.io/Anjay-doc/
https://github.com/AVSystem/Anjay
https://avsystem.github.io/Anjay-doc/


FYI, Ikea is a customer of AVSystem who developed the LwM2M library Anjay (which is dual-licensed, bot as free and open source software and under a commercial license).

https://www.avsystem.com/news/avsystem- ... ts-lwm2m1/
https://www.avsystem.com/products/anjay/
https://avsystem.github.io/Anjay-doc/Co ... pport.html

While they don't say so outright one could suspect that Ikea uses commercially licensed Anjay and/or AVSystem Coiote for the Ikea Trådfri Gateway and its apps.

AVSystem Coiote it is a complete end-to-end solution for empowering IoT applications, which I understand relies on Anjay too.

https://www.avsystem.com/products/coiote/


Again, also see the official LwM2M and the CoAP (Constrained Application Protocol) documentation from IETF here:

http://www.openmobilealliance.org/wp/OM ... istry.html

https://tools.ietf.org/html/rfc7252


Today the Ikea Trådfri Gateway only uses a small subset of the OMA Lightweight M2M (LwM2M) protocol, but who knows, it is likley that Ikea will extend the use of LwM2M in future firmware updates for Ikea Trådfri Gateway, either for enhancements or new features.
Last edited by Hedda on Friday 07 April 2017 9:10, edited 2 times in total.
tontze
Posts: 317
Joined: Thursday 12 January 2017 15:30
Target OS: Linux
Domoticz version: Beta Ch
Location: Finland
Contact:

Re: Ikea "TRÅDFRI" Gateway and smart lights series for ZigBee Light Link (ZLL) lighting

Post by tontze »

Seems to be stores in Finland too :)
-----------------------------------------
Smartthings
zigbee2mqtt
RFLink 433mhz / Nrf 2.4Ghz
Mi Light
esp8266MiLight Hub
OpenHab/HomeAssistant/Domoticz
HP T610 & Debian 5.10.19-1 x86_64[/b]
Ericv
Posts: 38
Joined: Saturday 28 January 2017 12:09
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.9700
Location: Netherlands
Contact:

Re: Ikea "TRÅDFRI" Gateway and smart lights series for ZigBee Light Link (ZLL) lighting

Post by Ericv »

Now also for sale in Holland.
Raspberry Pi3; Razberry V2; RFlink; PIco UPS HV3.0
deennoo
Posts: 784
Joined: Wednesday 10 December 2014 13:06
Target OS: Linux
Domoticz version: beta
Location: Bordeaux France
Contact:

Re: Ikea "TRÅDFRI" Gateway and smart lights series for ZigBee Light Link (ZLL) lighting

Post by deennoo »

End of April for France
Domoticz stable 3.5877 for real & Domoticz beta for test
Rfxtrxe / RFLink / Milight / Yeelight / Tasmota / MQTT / BLE / Zigate
http://domo-attitude.fr
Ericv
Posts: 38
Joined: Saturday 28 January 2017 12:09
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.9700
Location: Netherlands
Contact:

Re: Ikea "TRÅDFRI" Gateway and smart lights series for ZigBee Light Link (ZLL) lighting

Post by Ericv »

Lights are not recognised by my Hue bridge.
Raspberry Pi3; Razberry V2; RFlink; PIco UPS HV3.0
Hedda
Posts: 49
Joined: Wednesday 06 July 2016 13:16
Target OS: Linux
Domoticz version:
Contact:

Re: Ikea "TRÅDFRI" Gateway and smart lights series for ZigBee Light Link (ZLL) lighting

Post by Hedda »

Home-Assistant developers looks to be making great stides with their initial development of Ikea Trådfri Gateway hub support:

https://community.home-assistant.io/t/i ... tion/14788

And again so are Homebridge and ha-developers:

https://github.com/bwssytems/ha-bridge/issues/570

https://github.com/stenehall/homebridge-ikea
Ericv wrote:Lights are not recognised by my Hue bridge.
@Ericv, that is known; Philips have on-purpose removed any accidental compatibility they had in their previous firmware. You can not expect that Philips (or Ikea) will ever activly work to make their hubs compatible with each other endpoint devices. If their endpoint devices just happen to work with each others hubs then it will only be a happy chance due to both of them being ZigBee based. Philips (or Ikea) have no intention of on-purpose making their hubs working with other manufacturers lightbulbs, that would just mean supporting endpoint devices that they they are not getting paid for, which is crazy to do for a commercial company unless you are specifically selling a hub/gateway that is specifically meant to work with third-party endpoint devices, such as Samsung SmartThings Hub, Vera, or Wink Hub.
Last edited by Hedda on Monday 10 April 2017 9:35, edited 1 time in total.
Ericv
Posts: 38
Joined: Saturday 28 January 2017 12:09
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.9700
Location: Netherlands
Contact:

Re: Ikea "TRÅDFRI" Gateway and smart lights series for ZigBee Light Link (ZLL) lighting

Post by Ericv »

I did not really expect it to work. Just wanted to let you know that i tried; with no success obviously :D

It would be nice to have a Domoticz plugin.
I tried to do a portscan on the Trådfri hub. Again no success, no ports found.
Raspberry Pi3; Razberry V2; RFlink; PIco UPS HV3.0
Hedda
Posts: 49
Joined: Wednesday 06 July 2016 13:16
Target OS: Linux
Domoticz version:
Contact:

Re: Ikea "TRÅDFRI" Gateway and smart lights series for ZigBee Light Link (ZLL) lighting

Post by Hedda »

Home Assistant developers ( ggravlingen / pautomate, balloob & turbokongen ) looks to be making great progress with their collaberation on a Python class to communicate with the Ikea Trådfri Gateway, and also extracted that code from the platform into a standalone Python library

https://github.com/ggravlingen/python-openikeatradfri

More discussion on that in the Home Assistant Community forum

https://community.home-assistant.io/t/i ... ion/14788/
Hedda
Posts: 49
Joined: Wednesday 06 July 2016 13:16
Target OS: Linux
Domoticz version:
Contact:

Re: Ikea "TRÅDFRI" Gateway and smart lights series for ZigBee Light Link (ZLL) lighting

Post by Hedda »

Ericv wrote:I tried to do a portscan on the Trådfri hub. Again no success, no ports found.
You shouldn't on any TCP port, it only listens to two UDP ports, read this security analysis of Ikea Trådfri Gateway:

https://mjg59.dreamwidth.org/47803.html

Again also read all the collected information here (which among many other things includes that information too):

https://github.com/bwssytems/ha-bridge/issues/570
Hedda
Posts: 49
Joined: Wednesday 06 July 2016 13:16
Target OS: Linux
Domoticz version:
Contact:

Re: Ikea "TRÅDFRI" Gateway and smart lights series for ZigBee Light Link (ZLL) lighting

Post by Hedda »

Jaime Jiménez (from the company Ericsson) who is an active member of the IPSO Alliance’s working group, especially the Semantic WG that published the IPSO Smart Object Guidelines, posted this great teardown of the Ikea Trådfri implementation:

http://jaimejim.github.io/tradfri/

He also shared a couple of links to related articles he posted earlier:

http://jaimejim.github.io/lwm2m-yang/

http://jaimejim.github.io/coap-functionality-lwm2m/

Also checkout the IoTSI Workshop as a reference:

https://www.iab.org/activities/workshops/iotsi/

Interestingly enough Michael Koster (who is the main author of these IPSO Objects) posted a comment to Jaime's post staying: "Great move on IKEA's part here. Too bad we hadn't published the IPSO lighting objects yet. Maybe we can talk them into registering the new identifiers with OMNA.".

He referenses another that good framework written by Michael Koster (the main author of the data models and IPSO Objects that Ikea Trådfri uses):

https://github.com/connectIOT/iottoolkit/
Schuko80
Posts: 8
Joined: Sunday 23 April 2017 10:07
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Ikea "TRÅDFRI" Gateway and smart lights series for ZigBee Light Link (ZLL) lighting

Post by Schuko80 »

Hi there, yesterday I give the the ikea lamps a try and I can say, it works really fine with domoticz. :D

I'm able to switch them on/off and make a dim - colour changing from warm to cold white doesn't work at the moment, i'm not sure, witch command I have to use

I think working on the ikea Gateway is a good idea, but for me i think it is better to work with a real Zigbee Gateway, so I can control all Zigbee Items and not only Ikea ones.

To get it work, I use Raspbee on a Raspberry Pi (intern Version - you can get a USB Version, too) - the Software use the Philips Hue Rest API, so you can connect Domotics by the Philips Hue Plug in.

I think maybe some of you are interested in this

This was my first post here and I'm sorry for my bad English, it's a long time ago I have to write it down
tontze
Posts: 317
Joined: Thursday 12 January 2017 15:30
Target OS: Linux
Domoticz version: Beta Ch
Location: Finland
Contact:

Re: Ikea "TRÅDFRI" Gateway and smart lights series for ZigBee Light Link (ZLL) lighting

Post by tontze »

Schuko80 wrote:Hi there, yesterday I give the the ikea lamps a try and I can say, it works really fine with domoticz. :D

I'm able to switch them on/off and make a dim - colour changing from warm to cold white doesn't work at the moment, i'm not sure, witch command I have to use

I think working on the ikea Gateway is a good idea, but for me i think it is better to work with a real Zigbee Gateway, so I can control all Zigbee Items and not only Ikea ones.

To get it work, I use Raspbee on a Raspberry Pi (intern Version - you can get a USB Version, too) - the Software use the Philips Hue Rest API, so you can connect Domotics by the Philips Hue Plug in.

I think maybe some of you are interested in this

This was my first post here and I'm sorry for my bad English, it's a long time ago I have to write it down
Definitely interested on this !
-----------------------------------------
Smartthings
zigbee2mqtt
RFLink 433mhz / Nrf 2.4Ghz
Mi Light
esp8266MiLight Hub
OpenHab/HomeAssistant/Domoticz
HP T610 & Debian 5.10.19-1 x86_64[/b]
Hedda
Posts: 49
Joined: Wednesday 06 July 2016 13:16
Target OS: Linux
Domoticz version:
Contact:

Re: Ikea "TRÅDFRI" Gateway and smart lights series for ZigBee Light Link (ZLL) lighting

Post by Hedda »

Schuko80 wrote:Hi there, yesterday I give the the ikea lamps a try and I can say, it works really fine with domoticz. :D

I'm able to switch them on/off and make a dim - colour changing from warm to cold white doesn't work at the moment, i'm not sure, witch command I have to use

I think working on the ikea Gateway is a good idea, but for me i think it is better to work with a real Zigbee Gateway, so I can control all Zigbee Items and not only Ikea ones.

To get it work, I use Raspbee on a Raspberry Pi (intern Version - you can get a USB Version, too) - the Software use the Philips Hue Rest API, so you can connect Domotics by the Philips Hue Plug in.

I think maybe some of you are interested in this.

This was my first post here and I'm sorry for my bad English, it's a long time ago I have to write it down
So kind of like BWS Systems HA-Bridge (Home Automation Bridge) but talking directly to ZigBee devices with a ZigBee USB dongle or serial (GPIO) adapter ? HA-Bridge also offer the Philips Hue Rest API:

https://github.com/bwssytems/ha-bridge

I'm diffinitly interested in this regardless. Ikea is not the only company that offer cheap ZigBee devices; Xiaomi is another https://www.domoticz.com/forum/viewtopi ... 17&t=11520

I also posted a thread about it here:

https://www.domoticz.com/forum/viewtopi ... 9&p=123809

And someone else posted this:

https://www.domoticz.com/forum/viewtopi ... 0&p=128357

Problem as a I understand it with being compatible with ZigBee devices from different vendors is that most ZigBee devices do not follow the exact same standard, and currently there is no common library like there is for Z-Wave, as there we have OpenZWave https://github.com/openzwave/

I guess what we need then a project that offer a "OpenZigBee" library that would be an open source and free library that talks to ZigBee devices from different vendors via a dongle and the ZigBee serial API?
Schuko80
Posts: 8
Joined: Sunday 23 April 2017 10:07
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Ikea "TRÅDFRI" Gateway and smart lights series for ZigBee Light Link (ZLL) lighting

Post by Schuko80 »

Ok, i See you Post... you want this:


*Specifically I would like one that supports ZigBee Home Automation, ZigBee Light Link, ZigBee Smart Energy, as well as ZigBee PRO*


Take a look here, the instruction Book is english and zigbee pro works too

https://www.dresden-elektronik.de/funkt ... ibilitaet/


Yesterday i try the ikea clear bulb 950lm e27. This was a bit tricky, when i Open the network, the bulb has to switch on and off by Power switch - about. 3 to 4 Times. Don't Know the Problem, but after that it works fine, too.

The ha bridge i süße for alexa - the raspbee Software is called deconz.
moroen
Posts: 408
Joined: Sunday 15 January 2017 11:06
Target OS: Linux
Domoticz version: beta
Location: Norway
Contact:

Re: Ikea "TRÅDFRI" Gateway and smart lights series for ZigBee Light Link (ZLL) lighting

Post by moroen »

A general ZigBee gateway would definitely be nice, but in the meantime, it's quite easy to get support for the Ikea Trådløs gateway from domotics, using a python module created by ggravlingen as part of the home-assistant project, available here:

https://github.com/ggravlingen/pytradfri

I bought the "starter kit" a couple of days ago, consisting of the gateway, a remote and two bulbs and had the bulbs controllable from domoticz with less effort than I'd imagined. The main caveat is adding the bulbs to the gateway, for that I needed the iOS app, but once added, on/off, dim-level and white-color temperature works using ggravlingens module and a python-script called from on and off-actions of virtual switches.

https://github.com/moroen/ikea-tradfri

Guess creating a module for the python plugins system currently under development is the next logical step...

M
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 1 guest