Integrate with Ikea Trådfri Gateway as bridge to communicate and control connected Ikea's ZigBee based smart lights, switches, and sensors #570

Open
Hedda opened this Issue Mar 27, 2017 · 155 comments

Comments

Projects
None yet
@Hedda

Hedda commented Mar 27, 2017

Ikea have just released a new app-controlled network-attached home automation hub which will serve as a Gateway to control its new "Trådfri" series of affordable smart lights / lightbulbs, switches / remotes, and sensors, which in turn so far all uses ZigBee based protocols. These products are set to be released on the 31st of March 2017 in selected countries around the world.

https://www.cnet.com/news/ikeas-rolling-out-a-brand-new-smart-home-lineup/

http://www.ikea.com/ms/sv_SE/customer-service/about-our-products/smart-lighting/index.html

"Trådfri" means 'wireless' in Swedish, and Ikea have so far announced this very aggresivly low-priced network-attached (Ethernet) "Ikea Trådfri Gateway" home automation hub in their "Tradfri" series, as well as a wireless Motion Sensor Kit (that have integrated light sensor too), a wireless Dimmer Remote (which is accelerator-based), a wireless multi-switch remote, and several smart light bulbs of different formats and even a few unique panel lights. All these products will then be released in most other contries worldwide too as Ikea steps up manufacturing (and irons our the initial software bugs I guess).

Ikea had already leaked news about this upcoming gateway/hub more than 6-months ago, during the summer or 2016, and at that time they also revealved that they will use ZigBee and keep validated access to the gateway/hub as open as possible, including providing an open API for this network-attached home automation hub.

Ikea in Sweden are first to post this news about the network-connected Home Automation Gateway / Hub, but again these products will become available worldwide. Here is link to the Swedish links:

http://www.ikea.com/se/sv/catalog/categories/departments/living_room/36812/
http://www.ikea.com/se/sv/catalog/products/40337806/
http://www.ikea.com/se/sv/catalog/products/80338960/
http://www.ikea.com/se/sv/catalog/products/80338941/
http://www.ikea.com/se/sv/catalog/products/80349888/

Link are in Swedish for Ikea Sweden site, but the PDF manuals on each page are available in English and many more languages, however they don't say much other than mounting instructions.

http://www.ikea.com/ms/en_US/img/buying_guides/fy17/april/Home_Smart_lighting_Buying_guide_APRIL1.pdf

Reason why I think that this news being interested is Ikea's aggresive pricing might them the first to make two-way communication home automation really affordable for almost everyone while still following all the electrical safety and wireless communications regulations in all countries, as they are today well known to have very low prices yet good manufacturing quality items.

UPDATE 1: Sound as Ikea Trådfri Gateway software uses the Cypress WICED IoT platform SDK (formerly Broadcom WICED IoT platform before acquired by Cypress http://www.cypress.com/internet-things-iot ) and have choosen to base their implementation on OMA (Open Mobile Alliance) and Eclipse recommended IoT protocol standards of those three logical components; CoAP (coaps) and DTLS layers of the LwM2M (Lightweight machine-to-machine) security model for IoT device management and protocol stack, using IPSO (IP for Smart Objects) Smart Object Guidelines provide a common design pattern. That is, looks as if the communication between Android/iOS app and the Gateway takes place via OMA Lightweight M2M (LwM2M) wrapped in CoAP with DTLS.

http://openmobilealliance.org/data-models-for-the-internet-of-things/

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

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

For those who don’t know, LWM2M is a protocol built around CoAP and use for managing devices. So things like firmware upgrades, error reports, etc. Apart form the management interfaces, LWM2M also adds a very simple Object Model for managing those devices. IPSO expands that set of Objects so that you can have application information too (e.g. sensor readings, commands, etc). IPSO defines objects and resources that map to device properties.

Particular pay attention to the IPSO Light Control objects:

https://github.com/IPSO-Alliance/pub/blob/master/reg/xml/3311.xml

If you want to know more about the wealth of data models out there you can check the IoTSI Workshop as a reference.

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

LwM2M (Lightweight machine-to-machine) meanwhile 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 Objects structure based on IPSO Smart Object Guidelines.

https://connect2.io/open-mobile-alliance-lightweightm2m-oma-lwm2m/
https://www.eclipsecon.org/na2014/sites/default/files/slides/Eclipsecon%20NA14%20-%20One%20protocol%20to%20rule%20them%20all-%20(1).pdf
http://openmobilealliance.org/constrained-application-protocol-coap-is-iots-modern-protocol/

IPSO provide common object model for interoperability of IoT Devices and Applications.

https://github.com/IPSO-Alliance/pub/blob/master/reg/README.md
https://github.com/IPSO-Alliance/pub/tree/master/reg/xml
https://github.com/IPSO-Alliance/pub/blob/master/reg/xml/3311.xml
https://github.com/IPSO-Alliance/pub

@Hedda Hedda changed the title from Communicate with Ikea Trådfri/Tradfri Gateway to control connected smart lights and sensors to Integrate with Ikea Trådfri/Tradfri Gateway to communicate and control connected Ikea smart lights and sensors Mar 27, 2017

@bwssytems

This comment has been minimized.

Show comment
Hide comment
@bwssytems

bwssytems Mar 27, 2017

Owner

@Hedda Those are really affordable! Pretty much $17 USD for each item.

So, Ikea would need to publish an API that can be called for the ha-bridge to connect. We will need to keep looking into that.

Owner

bwssytems commented Mar 27, 2017

@Hedda Those are really affordable! Pretty much $17 USD for each item.

So, Ikea would need to publish an API that can be called for the ha-bridge to connect. We will need to keep looking into that.

@bwssytems bwssytems added the question label Mar 27, 2017

@emiliosic

This comment has been minimized.

Show comment
Hide comment
@emiliosic

emiliosic Mar 27, 2017

From this link:
http://www.ikea.com/ms/sv_SE/customer-service/about-our-products/smart-lighting/index.html

Zigbee lights should also work with other bridges like Philips Hue, Osram Lightify or Vera Plus

From this link:
http://www.ikea.com/ms/sv_SE/customer-service/about-our-products/smart-lighting/index.html

Zigbee lights should also work with other bridges like Philips Hue, Osram Lightify or Vera Plus

@michaelhinchey

This comment has been minimized.

Show comment
Hide comment
@michaelhinchey

michaelhinchey Mar 27, 2017

Cool. The more companies building smart home items the more it should drive down competition. I do wish these were zwa e but I have a very plus so zigbee will be just fine for now.

Cool. The more companies building smart home items the more it should drive down competition. I do wish these were zwa e but I have a very plus so zigbee will be just fine for now.

@Hedda

This comment has been minimized.

Show comment
Hide comment
@Hedda

Hedda Mar 28, 2017

While it is cool that Ikea have released a gateway/hub on their own I would personally much rather skip buying the Ikea Trådfri Gateway and instead buy and install an ZigBee USB-adapter in my mini-PC that I currently use for as my DIY home automation hub with Linux to control each Ikea Tråd Lightbulb and Lightpanel directly.

Problem with that simplter concept is that right now I don't know of which if any ZigBee USB-adapters and software libraries available that will work the ZLL (ZigBee Light Link) protocol which the Ikea Trådfri Lightbulbs and Lightpanels. Anyone here got some advice there?

Hedda commented Mar 28, 2017

While it is cool that Ikea have released a gateway/hub on their own I would personally much rather skip buying the Ikea Trådfri Gateway and instead buy and install an ZigBee USB-adapter in my mini-PC that I currently use for as my DIY home automation hub with Linux to control each Ikea Tråd Lightbulb and Lightpanel directly.

Problem with that simplter concept is that right now I don't know of which if any ZigBee USB-adapters and software libraries available that will work the ZLL (ZigBee Light Link) protocol which the Ikea Trådfri Lightbulbs and Lightpanels. Anyone here got some advice there?

@Matt8119

This comment has been minimized.

Show comment
Hide comment
@Matt8119

Matt8119 Mar 28, 2017

There's a user on the hue developers forum that said it works with the old hub 1.0.
https://developers.meethue.com/content/philips-hue-and-ikea-trådfri

There's a user on the hue developers forum that said it works with the old hub 1.0.
https://developers.meethue.com/content/philips-hue-and-ikea-trådfri

@Hedda

This comment has been minimized.

Show comment
Hide comment
@Hedda

Hedda Mar 28, 2017

@emiliosic, Ikea Trådfri sensors and devices uses ZLL (ZigBee Light Link) protocol so will probably be made to work sooner or alter with hubs such as Samsung SmartThings Hub and Vera Plus. That is because those hubs are made by companies who made it the main concept for those hubs as commercial products to work with as many third-party devices as possible. That is, their goal is to make the hubs compatible with third-party sensors and devices. Samsung and Vera does officially support third-party devices.

But that is not the goal of the Philips Hue and Osram Lightify hubs. Thier goal is only for those hubs to work with their own devices, which means that they do not do compatibility testing with third-party ZigBee devices connected to their hubs. So while some third-party sensors and devices might work because they too use the ZLL (ZigBee Light Link) protocol, is not the goal of Philips or Osram to make third-party devices work stable with their hubs, as that is not in their interest. Philips and Osram want people to buy their own devices, so officially they only support their own devices connected to their hubs.

Hedda commented Mar 28, 2017

@emiliosic, Ikea Trådfri sensors and devices uses ZLL (ZigBee Light Link) protocol so will probably be made to work sooner or alter with hubs such as Samsung SmartThings Hub and Vera Plus. That is because those hubs are made by companies who made it the main concept for those hubs as commercial products to work with as many third-party devices as possible. That is, their goal is to make the hubs compatible with third-party sensors and devices. Samsung and Vera does officially support third-party devices.

But that is not the goal of the Philips Hue and Osram Lightify hubs. Thier goal is only for those hubs to work with their own devices, which means that they do not do compatibility testing with third-party ZigBee devices connected to their hubs. So while some third-party sensors and devices might work because they too use the ZLL (ZigBee Light Link) protocol, is not the goal of Philips or Osram to make third-party devices work stable with their hubs, as that is not in their interest. Philips and Osram want people to buy their own devices, so officially they only support their own devices connected to their hubs.

@emiliosic

This comment has been minimized.

Show comment
Hide comment
@emiliosic

emiliosic Mar 28, 2017

If the lights follow the standard there shouldn't be any development needed. Same goes for many Z-Wave devices which just work as generic.
http://www.zigbee.org/zigbee-for-developers/applicationstandards/zigbee-light-link/
I mentioned the lightify bridge because I noticed that HomeSeer seems to have decided to use a lightly bridge instead of developing their own:
http://www.homeseer.com/zigbee.html
But agree, if you have a Vera, SmartThings or Wink, it would probably work either at launch or soon enough.

If the lights follow the standard there shouldn't be any development needed. Same goes for many Z-Wave devices which just work as generic.
http://www.zigbee.org/zigbee-for-developers/applicationstandards/zigbee-light-link/
I mentioned the lightify bridge because I noticed that HomeSeer seems to have decided to use a lightly bridge instead of developing their own:
http://www.homeseer.com/zigbee.html
But agree, if you have a Vera, SmartThings or Wink, it would probably work either at launch or soon enough.

@bwssytems

This comment has been minimized.

Show comment
Hide comment
@bwssytems

bwssytems Mar 28, 2017

Owner

I believe what the OP intended is, will the ha-bridge support the Tradfri Gateway. This is a specific hub and will need an API to talk to. This Gateway would be on the level of the vera, wink hub or smartthings hub.

Owner

bwssytems commented Mar 28, 2017

I believe what the OP intended is, will the ha-bridge support the Tradfri Gateway. This is a specific hub and will need an API to talk to. This Gateway would be on the level of the vera, wink hub or smartthings hub.

@Hedda

This comment has been minimized.

Show comment
Hide comment
@Hedda

Hedda Mar 29, 2017

@bwssytems That is exactly what I mean. Idea is that ha-bridge should be bridge to Ikea Trådfri Gateway. I did not mean that ha-bridge should communicate using ZigBee directly to the devices.

Amazon Echo => ha-bridge => Ikea Trådfri Gateway => Ikea Trådfri Lightbulbs/Lightpanels.

Google Home => ha-bridge => Ikea Trådfri Gateway => Ikea Trådfri Lightbulbs/Lightpanels.

Harmony Hub => ha-bridge => Ikea Trådfri Gateway => Ikea Trådfri Lightbulbs/Lightpanels.

Main problem with this is that we don't know if the Ikea Trådfri Gateway will offer a (documented) open API on the day-one of release. However I an interview with Ikea smart home development team from 6-months ago where they first leaked the news of plans to release Ikea Trådfri Gateway and in that article the Ikea developers specifically said that they do plan for the Ikea Trådfri Gateway to have an open API.

So if it an open API not available in the initial firmware pre-installed day-one of release, they might release an over-the-air update for the firmware sooner or later which will offer an open API. And even if they might not officially offer support to third-parties that uses that API once available, the Ikea developers of this product have at least stated they do want interoperability with third-party smart home solutions.

One possible option if the Ikea Trådfri Gateway does not offer an open API in the initial firmware pre-installed day-one of release is to hack the network communication between Ikea Trådfri Android/iOS application and the Ikea Trådfri Gateway, and then make library for ha-bridge software that can emulate an Ikea Trådfri Android/iOS app, similar to how ha-bridge software today emulate a Philips Hue Hub. That would of course be much more difficult and might not something that the developers of ha-bridge have any personal interest to dvelve into, but with the Ikea Trådfri series gateway and devices being so cheap and sold worldwide it will surley not be long before some other hacker hacks the communication between the Ikea Trådfri Android/iOS apps and the Ikea Trådfri Gateway and then publish that information or even code/library publicly for how to achieve exactly this. At it is several hackers usually have more insentive to hack stuff like this when a company does not offer an open API. Again, just look at the ha-bridge software and the Philips Hue Hub API.

Here are some more decriptive diagrams with paths to put these concepts in perspective of ha-bridge:

Amazon Echo => Hue API in ha-bridge => API by Ikea Trådfri Gateway => Ikea Trådfri device to control

Google Home => Hue API in ha-bridge => API by Ikea Trådfri Gateway => Ikea Trådfri device to control

Harmony Hub => Hue API in ha-bridge => API by Ikea Trådfri Gateway => Ikea Trådfri device to control

Hedda commented Mar 29, 2017

@bwssytems That is exactly what I mean. Idea is that ha-bridge should be bridge to Ikea Trådfri Gateway. I did not mean that ha-bridge should communicate using ZigBee directly to the devices.

Amazon Echo => ha-bridge => Ikea Trådfri Gateway => Ikea Trådfri Lightbulbs/Lightpanels.

Google Home => ha-bridge => Ikea Trådfri Gateway => Ikea Trådfri Lightbulbs/Lightpanels.

Harmony Hub => ha-bridge => Ikea Trådfri Gateway => Ikea Trådfri Lightbulbs/Lightpanels.

Main problem with this is that we don't know if the Ikea Trådfri Gateway will offer a (documented) open API on the day-one of release. However I an interview with Ikea smart home development team from 6-months ago where they first leaked the news of plans to release Ikea Trådfri Gateway and in that article the Ikea developers specifically said that they do plan for the Ikea Trådfri Gateway to have an open API.

So if it an open API not available in the initial firmware pre-installed day-one of release, they might release an over-the-air update for the firmware sooner or later which will offer an open API. And even if they might not officially offer support to third-parties that uses that API once available, the Ikea developers of this product have at least stated they do want interoperability with third-party smart home solutions.

One possible option if the Ikea Trådfri Gateway does not offer an open API in the initial firmware pre-installed day-one of release is to hack the network communication between Ikea Trådfri Android/iOS application and the Ikea Trådfri Gateway, and then make library for ha-bridge software that can emulate an Ikea Trådfri Android/iOS app, similar to how ha-bridge software today emulate a Philips Hue Hub. That would of course be much more difficult and might not something that the developers of ha-bridge have any personal interest to dvelve into, but with the Ikea Trådfri series gateway and devices being so cheap and sold worldwide it will surley not be long before some other hacker hacks the communication between the Ikea Trådfri Android/iOS apps and the Ikea Trådfri Gateway and then publish that information or even code/library publicly for how to achieve exactly this. At it is several hackers usually have more insentive to hack stuff like this when a company does not offer an open API. Again, just look at the ha-bridge software and the Philips Hue Hub API.

Here are some more decriptive diagrams with paths to put these concepts in perspective of ha-bridge:

Amazon Echo => Hue API in ha-bridge => API by Ikea Trådfri Gateway => Ikea Trådfri device to control

Google Home => Hue API in ha-bridge => API by Ikea Trådfri Gateway => Ikea Trådfri device to control

Harmony Hub => Hue API in ha-bridge => API by Ikea Trådfri Gateway => Ikea Trådfri device to control

@Hedda Hedda changed the title from Integrate with Ikea Trådfri/Tradfri Gateway to communicate and control connected Ikea smart lights and sensors to Integrate with Ikea Trådfri/Tradfri Gateway as bridge to communicate and control connected Ikea's ZLL based smart lights and sensors Mar 29, 2017

@AnderssonPeter

This comment has been minimized.

Show comment
Hide comment
@AnderssonPeter

AnderssonPeter Mar 30, 2017

The app is now downloadable on the google play store and apple app store , in case anyone wants to analyse it.
https://play.google.com/store/apps/details?id=com.ikea.tradfri.lighting
https://appsto.re/gb/NkWrhb.i

I have tried to start it in a virtual machine but it just complains that im not connected to wifi, then i tried to start it in arc welder, i came a little bit farther but then it just crashed.

The app is now downloadable on the google play store and apple app store , in case anyone wants to analyse it.
https://play.google.com/store/apps/details?id=com.ikea.tradfri.lighting
https://appsto.re/gb/NkWrhb.i

I have tried to start it in a virtual machine but it just complains that im not connected to wifi, then i tried to start it in arc welder, i came a little bit farther but then it just crashed.

@AnderssonPeter

This comment has been minimized.

Show comment
Hide comment
@AnderssonPeter

AnderssonPeter Mar 31, 2017

Has any one tried to dump the network packets leaving the trådfri app? (i don't have access to a physical android phone)

Has any one tried to dump the network packets leaving the trådfri app? (i don't have access to a physical android phone)

@peterhoffren

This comment has been minimized.

Show comment
Hide comment
@peterhoffren

peterhoffren Apr 1, 2017

@AnderssonPeter Tried to capture the packages from the app on my Android but tPacketCapture did not allow the Trrådfri app to work so I need another way to capture packages.. Also neither the iOS or Android app use any connection over HTTP what I could see when trying to capture req/resp.

@AnderssonPeter Tried to capture the packages from the app on my Android but tPacketCapture did not allow the Trrådfri app to work so I need another way to capture packages.. Also neither the iOS or Android app use any connection over HTTP what I could see when trying to capture req/resp.

@Hedda

This comment has been minimized.

Show comment
Hide comment
@Hedda

Hedda Apr 3, 2017

@AnderssonPeter maybe try loading Ikea Trådfri app in the Android Emulator?

https://developer.android.com/studio/run/emulator.html

You of course need to have to have a physical Ikea Trådfri Gateway pre-installed.

But not sure if can enable WiFi in Android Emulator to local network though?

https://www.techwalla.com/articles/how-to-enable-wifi-on-an-android-emulator

If that works then should be able to use Wireshark to capture all IP packages

https://www.wireshark.org

That would perhaps be simplest, but again don't know if WiFi works in emulator.

Hedda commented Apr 3, 2017

@AnderssonPeter maybe try loading Ikea Trådfri app in the Android Emulator?

https://developer.android.com/studio/run/emulator.html

You of course need to have to have a physical Ikea Trådfri Gateway pre-installed.

But not sure if can enable WiFi in Android Emulator to local network though?

https://www.techwalla.com/articles/how-to-enable-wifi-on-an-android-emulator

If that works then should be able to use Wireshark to capture all IP packages

https://www.wireshark.org

That would perhaps be simplest, but again don't know if WiFi works in emulator.

@AnderssonPeter

This comment has been minimized.

Show comment
Hide comment
@AnderssonPeter

AnderssonPeter Apr 3, 2017

@Hedda i don't have the official android emulator installed as that requires java and i don't want all those nagging java update popups.

I have tried with the visual studio android emulator, but none of the package capturing apps seem to work there sadly.
And running wireshark on the host did nothing..

I have also tried android x86, but there i ran into the wifi problem and when i tried a solution to add wifi or fake wifi the emulator got stuck in a reboot loop..

AnderssonPeter commented Apr 3, 2017

@Hedda i don't have the official android emulator installed as that requires java and i don't want all those nagging java update popups.

I have tried with the visual studio android emulator, but none of the package capturing apps seem to work there sadly.
And running wireshark on the host did nothing..

I have also tried android x86, but there i ran into the wifi problem and when i tried a solution to add wifi or fake wifi the emulator got stuck in a reboot loop..

@Hedda

This comment has been minimized.

Show comment
Hide comment
@AnderssonPeter

This comment has been minimized.

Show comment
Hide comment
@AnderssonPeter

AnderssonPeter Apr 3, 2017

@Hedda i had it up and running on hyper-v and it worked until i managed to brick it when trying to fake the WIFI. But ill try with VirtualBox as i have that installed on one of my PC's.

AnderssonPeter commented Apr 3, 2017

@Hedda i had it up and running on hyper-v and it worked until i managed to brick it when trying to fake the WIFI. But ill try with VirtualBox as i have that installed on one of my PC's.

@nox-uk

This comment has been minimized.

Show comment
Hide comment
@nox-uk

nox-uk Apr 3, 2017

Think you'll find Tradfri uses ZHA not ZLL. when IKEA stated they were Zigbee compliant they were, just using 'the other' protocol. Most of the other hubs (like the hue hub 2.0) use ZLL though i think home hub 1 can use ZHA with an old firmware. All it really means is don't rush out and buy some bulbs and expect them to work with your hue hub 2.0. (yet)

there is a big post on the hue developers forum about it here:

https://developers.meethue.com/content/philips-hue-and-ikea-tr%C3%A5dfri

On the plus side, it sounds like IKEA are aware of this (post #45) and will remedy at some future point.

nox-uk commented Apr 3, 2017

Think you'll find Tradfri uses ZHA not ZLL. when IKEA stated they were Zigbee compliant they were, just using 'the other' protocol. Most of the other hubs (like the hue hub 2.0) use ZLL though i think home hub 1 can use ZHA with an old firmware. All it really means is don't rush out and buy some bulbs and expect them to work with your hue hub 2.0. (yet)

there is a big post on the hue developers forum about it here:

https://developers.meethue.com/content/philips-hue-and-ikea-tr%C3%A5dfri

On the plus side, it sounds like IKEA are aware of this (post #45) and will remedy at some future point.

@stenehall

This comment has been minimized.

Show comment
Hide comment
@stenehall

stenehall Apr 3, 2017

From what I could see (proxy:ing the app traffic) it's using DTLS v1.2. I can see a "Hello" from the client and then an encryption request. After that all data is encrypted. If I understand it all correctly it's using a PSK. I.e. we'd need to extract that to be able to talk to the gateway. I'm in no way good at network communication so I might be completely wrong on this.

From what I could see (proxy:ing the app traffic) it's using DTLS v1.2. I can see a "Hello" from the client and then an encryption request. After that all data is encrypted. If I understand it all correctly it's using a PSK. I.e. we'd need to extract that to be able to talk to the gateway. I'm in no way good at network communication so I might be completely wrong on this.

@AnderssonPeter

This comment has been minimized.

Show comment
Hide comment

AnderssonPeter commented Apr 3, 2017

@stenehall you are correct it is using DTLS, some analysis has started here: https://community.home-assistant.io/t/ikea-tradfri-gateway-zigbee/14788/8

@Hedda

This comment has been minimized.

Show comment
Hide comment
@Hedda

Hedda Apr 4, 2017

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-endpoints-on-ikea-tradfri/

https://bitsex.net/software/2017/ikea-tradfri-zigbee-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/OMNA/LwM2M/LwM2MRegistry.html
Examples:
5750 Application Type
5850 On/Off
5851 Dimmer
5706 Colour

For those who don’t know, LWM2M is a protocol built around CoAP and use for managing devices. So things like firmware upgrades, error reports, etc. Apart form the management interfaces, LWM2M also adds a very simple Object Model for managing those devices. IPSO expands that set of Objects so that you can have application information too (e.g. sensor readings, commands, etc). IPSO defines objects and resources that map to device properties.

Particular pay attenton to the IPSO Light Control objects:

https://github.com/IPSO-Alliance/pub/blob/master/reg/xml/3311.xml

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

If you want to know more about the wealth of data models out there you can check the IoTSI Workshop as a reference.

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

OMA LightweightM2M (LWM2M) standard:
http://openmobilealliance.org/iot/
http://openmobilealliance.org/iot/lightweight-m2m-lwm2m/
http://www.openmobilealliance.org/wp/Overviews/lightweightm2m_overview.html
http://www.openmobilealliance.org/wp/OMNA/LwM2M/LwM2MRegistry.html
http://www.openmobilealliance.org/tech/profiles/
https://github.com/OpenMobileAlliance/OMA_LwM2M_for_Developers/wiki
http://devtoolkit.openmobilealliance.org/OEditor/Legal?back=Default
http://www.openmobilealliance.org/wp/comments.html
https://github.com/OpenMobileAlliance/OMA_LwM2M_for_Developers/issues
http://openmobilealliance.hs-sites.com/keep_updated

Interestingly 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.

Hedda commented Apr 4, 2017

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-endpoints-on-ikea-tradfri/

https://bitsex.net/software/2017/ikea-tradfri-zigbee-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/OMNA/LwM2M/LwM2MRegistry.html
Examples:
5750 Application Type
5850 On/Off
5851 Dimmer
5706 Colour

For those who don’t know, LWM2M is a protocol built around CoAP and use for managing devices. So things like firmware upgrades, error reports, etc. Apart form the management interfaces, LWM2M also adds a very simple Object Model for managing those devices. IPSO expands that set of Objects so that you can have application information too (e.g. sensor readings, commands, etc). IPSO defines objects and resources that map to device properties.

Particular pay attenton to the IPSO Light Control objects:

https://github.com/IPSO-Alliance/pub/blob/master/reg/xml/3311.xml

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

If you want to know more about the wealth of data models out there you can check the IoTSI Workshop as a reference.

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

OMA LightweightM2M (LWM2M) standard:
http://openmobilealliance.org/iot/
http://openmobilealliance.org/iot/lightweight-m2m-lwm2m/
http://www.openmobilealliance.org/wp/Overviews/lightweightm2m_overview.html
http://www.openmobilealliance.org/wp/OMNA/LwM2M/LwM2MRegistry.html
http://www.openmobilealliance.org/tech/profiles/
https://github.com/OpenMobileAlliance/OMA_LwM2M_for_Developers/wiki
http://devtoolkit.openmobilealliance.org/OEditor/Legal?back=Default
http://www.openmobilealliance.org/wp/comments.html
https://github.com/OpenMobileAlliance/OMA_LwM2M_for_Developers/issues
http://openmobilealliance.hs-sites.com/keep_updated

Interestingly 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.

@vidarlo

This comment has been minimized.

Show comment
Hide comment
@vidarlo

vidarlo Apr 4, 2017

I'm that norwegian guy. I was not aware of the standard, and I'm happy that you brought it to my attention.

I was not aware of ha-bridge either, but it seems interesting. So far I've been a bit stumped by that zero of the COAP libraries for python supports dTLS, and I don't want to go the java route... I got a couple more bulbs today, and confirm that they add the same place as the previous.

If I can be of any assistance, I'm happy to. If wanted I can provide a linux box with access to the gateway for anyone wanting to play.

The key that is used for communication is printed beneath the gateway, so there's no need for any cracking; it's perfectly open, albeit using a not-yet-so-common protocol.

vidarlo commented Apr 4, 2017

I'm that norwegian guy. I was not aware of the standard, and I'm happy that you brought it to my attention.

I was not aware of ha-bridge either, but it seems interesting. So far I've been a bit stumped by that zero of the COAP libraries for python supports dTLS, and I don't want to go the java route... I got a couple more bulbs today, and confirm that they add the same place as the previous.

If I can be of any assistance, I'm happy to. If wanted I can provide a linux box with access to the gateway for anyone wanting to play.

The key that is used for communication is printed beneath the gateway, so there's no need for any cracking; it's perfectly open, albeit using a not-yet-so-common protocol.

@arturo182

This comment has been minimized.

Show comment
Hide comment
@arturo182

arturo182 Apr 4, 2017

Hi guys,

You can easily talk to the gateway if you build the "dtls" branch of https://github.com/obgm/libcoap

And then enter examples and do stuff like:

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:

./coap-client -u "Client_identity" -k "YOUR_KEY" -v 10 -m get "coaps://192.168.0.3:5684/.well-known/core"

Hi guys,

You can easily talk to the gateway if you build the "dtls" branch of https://github.com/obgm/libcoap

And then enter examples and do stuff like:

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:

./coap-client -u "Client_identity" -k "YOUR_KEY" -v 10 -m get "coaps://192.168.0.3:5684/.well-known/core"

@Hedda

This comment has been minimized.

Show comment
Hide comment
@Hedda

Hedda Apr 5, 2017

@vidarlo Sound as Ikea have choosen to base their implementation on OMA (Open Mobile Alliance) and Eclipse recommended IoT protocol standards of those three logical components; CoAP, and DTLS layers of the LwM2M (Lightweight M2M) protocol stack. That is, looks as if the communication between Android/iOS app and the Gateway takes place via OMA Lightweight M2M (LwM2M) wrapped in CoAP with DTLS.

"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-models-for-the-internet-of-things/

https://connect2.io/open-mobile-alliance-lightweightm2m-oma-lwm2m/

http://openmobilealliance.org/constrained-application-protocol-coap-is-iots-modern-protocol/

http://openmobilealliance.org/data-models-for-the-internet-of-things/

https://connect2.io/open-mobile-alliance-lightweightm2m-oma-lwm2m/

https://iot.eclipse.org/standards/

https://eclipse.org/community/eclipse_newsletter/2014/february/article2.php

https://www.eclipsecon.org/na2014/sites/default/files/slides/Eclipsecon%20NA14%20-%20One%20protocol%20to%20rule%20them%20all-%20(1).pdf

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.

http://www.eclipse.org/wakaama/

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

https://github.com/obgm/libcoap/tree/dtls

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/

Californium is another CoAP client from Eclipse (programmed in Java) which also supports DTLS

https://eclipse.org/californium/
https://github.com/cetic/6lbr/wiki/Example-:-Dtls-Coap-Server
https://people.inf.ethz.ch/mkovatsc/resources/californium/cf-dtls-thesis.pdf

And 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.

http://www.eclipse.org/leshan/

Hedda commented Apr 5, 2017

@vidarlo Sound as Ikea have choosen to base their implementation on OMA (Open Mobile Alliance) and Eclipse recommended IoT protocol standards of those three logical components; CoAP, and DTLS layers of the LwM2M (Lightweight M2M) protocol stack. That is, looks as if the communication between Android/iOS app and the Gateway takes place via OMA Lightweight M2M (LwM2M) wrapped in CoAP with DTLS.

"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-models-for-the-internet-of-things/

https://connect2.io/open-mobile-alliance-lightweightm2m-oma-lwm2m/

http://openmobilealliance.org/constrained-application-protocol-coap-is-iots-modern-protocol/

http://openmobilealliance.org/data-models-for-the-internet-of-things/

https://connect2.io/open-mobile-alliance-lightweightm2m-oma-lwm2m/

https://iot.eclipse.org/standards/

https://eclipse.org/community/eclipse_newsletter/2014/february/article2.php

https://www.eclipsecon.org/na2014/sites/default/files/slides/Eclipsecon%20NA14%20-%20One%20protocol%20to%20rule%20them%20all-%20(1).pdf

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.

http://www.eclipse.org/wakaama/

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

https://github.com/obgm/libcoap/tree/dtls

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/

Californium is another CoAP client from Eclipse (programmed in Java) which also supports DTLS

https://eclipse.org/californium/
https://github.com/cetic/6lbr/wiki/Example-:-Dtls-Coap-Server
https://people.inf.ethz.ch/mkovatsc/resources/californium/cf-dtls-thesis.pdf

And 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.

http://www.eclipse.org/leshan/

@Hedda

This comment has been minimized.

Show comment
Hide comment
@Hedda

Hedda Apr 5, 2017

@arturo182 tinydtls-coap is another attempt to integrate the libcoap and tinydtls client-server

https://github.com/thecodemaiden/tinydtls-coap

You are then missing implementation of the LWM2M standard an top of CoAP.

Hedda commented Apr 5, 2017

@arturo182 tinydtls-coap is another attempt to integrate the libcoap and tinydtls client-server

https://github.com/thecodemaiden/tinydtls-coap

You are then missing implementation of the LWM2M standard an top of CoAP.

@arturo182

This comment has been minimized.

Show comment
Hide comment
@arturo182

arturo182 Apr 5, 2017

@Hedda, yes I have tried that one, it has the psk hardcoded and even when I changed that I still couldn't get a DTLS handshake, the dtls branch of libcoap works very well.

@Hedda, yes I have tried that one, it has the psk hardcoded and even when I changed that I still couldn't get a DTLS handshake, the dtls branch of libcoap works very well.

@r41d

This comment has been minimized.

Show comment
Hide comment
@r41d

r41d Apr 6, 2017

Bought my Trådfri starter kit today (in Germany where it was launched shortly ago) and have been following this thread attentively, nice insights so far :)
The advice from @arturo182 was worth gold, but building libcoap was a little troublesome, so I summarized the installation in the following, might save others some time when experimenting:

#!/bin/bash
git clone https://github.com/obgm/libcoap.git
cd libcoap
git checkout origin/dtls
git checkout -b dtls
git submodule update --init ext/tinydtls
cd ext/tinydtls
autoreconf
./configure
cd ../../
./autogen.sh
./configure --disable-shared
make

I would recommend doing:

export GATEWAY_IP="192.168.XXX.YYY"
export GATEWAY_KEY="<gateway key from underside label>"

Then you can get available endpoints (from @arturo182):

./coap-client -u "Client_identity" -k "${GATEWAY_KEY}" "coaps://${GATEWAY_IP}:5684/.well-known/core"

or use dimming:

echo '{ "3311" : [{ "5851" : 255 }] }' | ./coap-client -m put -u "Client_identity" -k "${GATEWAY_KEY}" "coaps://${GATEWAY_IP}:5684/15001/65537" -f -

this dims one of my two bulbs (they are in different groups).
3311 is an ext-label for dimming, 5851 stands for a dimmer (0-100%), but the value after that seems to be 0-255.
UDP 5684 is the port used by CoAP. 15001 seems to be the number of the endpoint used by the bridge and 65538 is the identifier for an actual bulb. My bulbs had the numbers 65537 and 65538 and there's something with the number 65536, this may be the remote that was used to pair the bulbs.
Device number seem to start at 65536. Client_identity seems to be the default username for DTLS communication.

Procotol

I think the communication takes place via OMA Lightweight M2M wrapped in CoAP with DTLS.
Most valuable resources so far:

A library listed under https://en.wikipedia.org/wiki/OMA_LWM2M#Implementations may be a better approach than writing LwM2M by hand, I'm currently looking into that...

r41d commented Apr 6, 2017

Bought my Trådfri starter kit today (in Germany where it was launched shortly ago) and have been following this thread attentively, nice insights so far :)
The advice from @arturo182 was worth gold, but building libcoap was a little troublesome, so I summarized the installation in the following, might save others some time when experimenting:

#!/bin/bash
git clone https://github.com/obgm/libcoap.git
cd libcoap
git checkout origin/dtls
git checkout -b dtls
git submodule update --init ext/tinydtls
cd ext/tinydtls
autoreconf
./configure
cd ../../
./autogen.sh
./configure --disable-shared
make

I would recommend doing:

export GATEWAY_IP="192.168.XXX.YYY"
export GATEWAY_KEY="<gateway key from underside label>"

Then you can get available endpoints (from @arturo182):

./coap-client -u "Client_identity" -k "${GATEWAY_KEY}" "coaps://${GATEWAY_IP}:5684/.well-known/core"

or use dimming:

echo '{ "3311" : [{ "5851" : 255 }] }' | ./coap-client -m put -u "Client_identity" -k "${GATEWAY_KEY}" "coaps://${GATEWAY_IP}:5684/15001/65537" -f -

this dims one of my two bulbs (they are in different groups).
3311 is an ext-label for dimming, 5851 stands for a dimmer (0-100%), but the value after that seems to be 0-255.
UDP 5684 is the port used by CoAP. 15001 seems to be the number of the endpoint used by the bridge and 65538 is the identifier for an actual bulb. My bulbs had the numbers 65537 and 65538 and there's something with the number 65536, this may be the remote that was used to pair the bulbs.
Device number seem to start at 65536. Client_identity seems to be the default username for DTLS communication.

Procotol

I think the communication takes place via OMA Lightweight M2M wrapped in CoAP with DTLS.
Most valuable resources so far:

A library listed under https://en.wikipedia.org/wiki/OMA_LWM2M#Implementations may be a better approach than writing LwM2M by hand, I'm currently looking into that...

@r41d

This comment has been minimized.

Show comment
Hide comment
@r41d

r41d Apr 6, 2017

OK, I now played a bit around with the Anjay LwM2M library and I would recommend it to anyone doing LwM2M, the documentation is just awesome.
Link: https://github.com/AVSystem/Anjay
Compilation is easy and is explained in the README.

Here's what I tried so far:

As a preparation I would suggest again:

export GATEWAY_IP="192.168.XXX.YYY"
export GATEWAY_KEY="<gateway key from underside label>"

Then, use the demo binary that was created during compilation.
Connecting to a coaps-DTLS server requires quite some parameters,
Identity and Key need to be supplied "hexlified", which xxd -p poes.

./output/bin/demo \
    --server-uri "coaps://${GATEWAY_IP}:5684" \
    --security-mode psk \
    --identity `echo -n "Client_identity" | xxd -p` \
    --key `echo -n $GATEWAY_KEY | xxd -p`

This prints a lot of successfully registered object and then manufacturer: 0023C7; serial number: 000001, that doesn't look bad, but I haven't gotten any further yet, but the above command should serve as a good starting point.

r41d commented Apr 6, 2017

OK, I now played a bit around with the Anjay LwM2M library and I would recommend it to anyone doing LwM2M, the documentation is just awesome.
Link: https://github.com/AVSystem/Anjay
Compilation is easy and is explained in the README.

Here's what I tried so far:

As a preparation I would suggest again:

export GATEWAY_IP="192.168.XXX.YYY"
export GATEWAY_KEY="<gateway key from underside label>"

Then, use the demo binary that was created during compilation.
Connecting to a coaps-DTLS server requires quite some parameters,
Identity and Key need to be supplied "hexlified", which xxd -p poes.

./output/bin/demo \
    --server-uri "coaps://${GATEWAY_IP}:5684" \
    --security-mode psk \
    --identity `echo -n "Client_identity" | xxd -p` \
    --key `echo -n $GATEWAY_KEY | xxd -p`

This prints a lot of successfully registered object and then manufacturer: 0023C7; serial number: 000001, that doesn't look bad, but I haven't gotten any further yet, but the above command should serve as a good starting point.

@Hedda

This comment has been minimized.

Show comment
Hide comment
@Hedda

Hedda Apr 6, 2017

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

https://community.home-assistant.io/t/ikea-tradfri-gateway-zigbee-very-basic-working-implementation/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-assistant/blob/master/extraconfig/python_code/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 commented Apr 6, 2017

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

https://community.home-assistant.io/t/ikea-tradfri-gateway-zigbee-very-basic-working-implementation/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-assistant/blob/master/extraconfig/python_code/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

This comment has been minimized.

Show comment
Hide comment
@Hedda

Hedda Apr 6, 2017

@r41d 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-anjay-supports-lwm2m1/

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

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/

https://avsystem.github.io/Anjay-doc/Commercial_support.html

Hedda commented Apr 6, 2017

@r41d 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-anjay-supports-lwm2m1/

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

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/

https://avsystem.github.io/Anjay-doc/Commercial_support.html

@r41d

This comment has been minimized.

Show comment
Hide comment
@r41d

r41d Apr 6, 2017

@Hedda Hm, wasn't aware of that, but if they use it and if it's also open source then it should be a good choice. Have been digging a bit more into the Anjay and it contains nothing from the LwM2M Registry (http://www.openmobilealliance.org/wp/OMNA/LwM2M/LwM2MRegistry.html), this stuff needs to be coded by hand.
But I found an intersting class in the Android App, after decompliling with apktool, it is located in com/ikea/tradfri/lighting/ipso/IPSOObjects.java.
Here's an upload: http://sprunge.us/CCQF
This lists a lot of constants that one can see when talking to the bridge (with this (https://bitsex.net/software/2017/coap-endpoints-on-ikea-tradfri/) in mind).

r41d commented Apr 6, 2017

@Hedda Hm, wasn't aware of that, but if they use it and if it's also open source then it should be a good choice. Have been digging a bit more into the Anjay and it contains nothing from the LwM2M Registry (http://www.openmobilealliance.org/wp/OMNA/LwM2M/LwM2MRegistry.html), this stuff needs to be coded by hand.
But I found an intersting class in the Android App, after decompliling with apktool, it is located in com/ikea/tradfri/lighting/ipso/IPSOObjects.java.
Here's an upload: http://sprunge.us/CCQF
This lists a lot of constants that one can see when talking to the bridge (with this (https://bitsex.net/software/2017/coap-endpoints-on-ikea-tradfri/) in mind).

@r41d

This comment has been minimized.

Show comment
Hide comment
@r41d

r41d Apr 6, 2017

I just wrote a minimal web interface for controlling the brightness of Trådfri bulbs.
It's absolutely dirty code, but I just wanted an working example to start with for now.
You need to install libcoap with dtls like I described here: #570 (comment)
You also need to have Flask installed.
Then you can download the server https://gist.github.com/r41d/65be2c7a111ac6c32f24d762ba38612c
Place it one the same level in the file system as the libcoap folder and heed the instructions in the file.
The interface is ugly as hell, but it's a first step.
Have fun.

I also posted the instructions here: https://community.home-assistant.io/t/ikea-tradfri-gateway-zigbee-very-basic-working-implementation/14788/20 which seems to be a discussion with similar goals as here.

r41d commented Apr 6, 2017

I just wrote a minimal web interface for controlling the brightness of Trådfri bulbs.
It's absolutely dirty code, but I just wanted an working example to start with for now.
You need to install libcoap with dtls like I described here: #570 (comment)
You also need to have Flask installed.
Then you can download the server https://gist.github.com/r41d/65be2c7a111ac6c32f24d762ba38612c
Place it one the same level in the file system as the libcoap folder and heed the instructions in the file.
The interface is ugly as hell, but it's a first step.
Have fun.

I also posted the instructions here: https://community.home-assistant.io/t/ikea-tradfri-gateway-zigbee-very-basic-working-implementation/14788/20 which seems to be a discussion with similar goals as here.

@hvanderlaan

This comment has been minimized.

Show comment
Hide comment
@hvanderlaan

hvanderlaan Apr 6, 2017

If also create a simple python script for reading the status of the lightbulbs that are paired with the hub. Still working on a framework that can get the status and put new state(s) to the lightbulbs.

Code is not up to my spec, but will post it soon.

script for reading lightbulb state: https://gist.github.com/hvanderlaan/3d8e11869f86ba94d9d6df1c815af3aa

small update:
https://github.com/hvanderlaan/ikea-smartlight

light and group functions now working

hvanderlaan commented Apr 6, 2017

If also create a simple python script for reading the status of the lightbulbs that are paired with the hub. Still working on a framework that can get the status and put new state(s) to the lightbulbs.

Code is not up to my spec, but will post it soon.

script for reading lightbulb state: https://gist.github.com/hvanderlaan/3d8e11869f86ba94d9d6df1c815af3aa

small update:
https://github.com/hvanderlaan/ikea-smartlight

light and group functions now working

@stenehall

This comment has been minimized.

Show comment
Hide comment
@stenehall

stenehall Apr 6, 2017

I spent some time writing a small homebridge plugin for this. https://github.com/stenehall/homebridge-ikea it works with some kinks.

I spent some time writing a small homebridge plugin for this. https://github.com/stenehall/homebridge-ikea it works with some kinks.

@Hedda

This comment has been minimized.

Show comment
Hide comment
@Hedda

Hedda Apr 7, 2017

@stenehall nice but unfortutante that ha-bridge can not yet connect to Homebridge as a HomeKit bridge.

That is however a frequently asked feature request for ha-bridge:

https://github.com/bwssytems/ha-bridge/wiki/HA-Bridge-FAQs#Hb_Hk

For that related feature request can checkout discussions in #366 and #159

If it could then ha-bridge could indirectly take advantage of all the plugins that Homebridge supports:

https://www.npmjs.com/browse/keyword/homebridge-plugin

Amazon Echo => ha-bridge => Homebridge => Homebridge plugins for Ikea Trådfri Gateway & others

Google Home => ha-bridge => Homebridge => Homebridge plugins for Ikea Trådfri Gateway & others

Harmony Hub => ha-bridge => Homebridge => Homebridge plugins for Ikea Trådfri Gateway & others

Hedda commented Apr 7, 2017

@stenehall nice but unfortutante that ha-bridge can not yet connect to Homebridge as a HomeKit bridge.

That is however a frequently asked feature request for ha-bridge:

https://github.com/bwssytems/ha-bridge/wiki/HA-Bridge-FAQs#Hb_Hk

For that related feature request can checkout discussions in #366 and #159

If it could then ha-bridge could indirectly take advantage of all the plugins that Homebridge supports:

https://www.npmjs.com/browse/keyword/homebridge-plugin

Amazon Echo => ha-bridge => Homebridge => Homebridge plugins for Ikea Trådfri Gateway & others

Google Home => ha-bridge => Homebridge => Homebridge plugins for Ikea Trådfri Gateway & others

Harmony Hub => ha-bridge => Homebridge => Homebridge plugins for Ikea Trådfri Gateway & others

@bwssytems

This comment has been minimized.

Show comment
Hide comment
@bwssytems

bwssytems Apr 7, 2017

Owner

I have been working on reverse engineering the HAP so that the ha-bridge can talk to homebridge or any other HAP device. The only thing is being the client side, there are no libraries and I am working with the server side. Currently, I am not getting consistent handshake results with the encryption.

Owner

bwssytems commented Apr 7, 2017

I have been working on reverse engineering the HAP so that the ha-bridge can talk to homebridge or any other HAP device. The only thing is being the client side, there are no libraries and I am working with the server side. Currently, I am not getting consistent handshake results with the encryption.

@stenehall

This comment has been minimized.

Show comment
Hide comment
@stenehall

stenehall Apr 7, 2017

@Hedda I'm actually not using ha-bridge, only using homebridge atm. But since I'd followed this issue and commented in it I figured I'd provide what I had in terms of code :)

@Hedda I'm actually not using ha-bridge, only using homebridge atm. But since I'd followed this issue and commented in it I figured I'd provide what I had in terms of code :)

@r41d r41d referenced this issue in ggravlingen/pytradfri Aug 21, 2017

Closed

Add RGB support #50

@matemaciek

This comment has been minimized.

Show comment
Hide comment
@matemaciek

matemaciek Aug 21, 2017

As soon as I get RGB bulb I'll be able to add support to pytradfri. @r41d , do you have IKEA product number (8 digits)? I'll check when they'll be available in Poland.

As soon as I get RGB bulb I'll be able to add support to pytradfri. @r41d , do you have IKEA product number (8 digits)? I'll check when they'll be available in Poland.

@emigrating

This comment has been minimized.

Show comment
Hide comment
@emigrating

emigrating Aug 21, 2017

@r41d, what was the price of the RGB bulb compared to the 980lm white ones?

@r41d, what was the price of the RGB bulb compared to the 980lm white ones?

@davetaz

This comment has been minimized.

Show comment
Hide comment
@davetaz

davetaz Aug 22, 2017

I've been having issues with my gateway and now cannot connect to it using coap-client. It was running firmware 1.1.0012 (i think) when i could connect but this lost connection to all the bulbs, which made it useless. I reset it and now it is running fireware version 1.0.008 according to the app. Bulbs are all connected however coap-client won't. Clicking check for updates says there are no updates. Any one had similar issues and know how to force it to update to 1.1.0015 from http://fw.ota.homesmart.ikea.net/feed/version_info.json?

davetaz commented Aug 22, 2017

I've been having issues with my gateway and now cannot connect to it using coap-client. It was running firmware 1.1.0012 (i think) when i could connect but this lost connection to all the bulbs, which made it useless. I reset it and now it is running fireware version 1.0.008 according to the app. Bulbs are all connected however coap-client won't. Clicking check for updates says there are no updates. Any one had similar issues and know how to force it to update to 1.1.0015 from http://fw.ota.homesmart.ikea.net/feed/version_info.json?

@r41d

This comment has been minimized.

Show comment
Hide comment
@r41d

r41d Aug 22, 2017

@matemaciek: on the back of the box it says 703.389.51
@emigrating: It cost 35€ for an RGB bulb with a remote (10€ more than a regular white spectrum bulb with remote) Sadly it wasn't possible to buy one without a remote... but I just had to get one ^^
@davetaz: also recently got problems with the coap-client connection to my gateway, damn, maybe they changed something.

r41d commented Aug 22, 2017

@matemaciek: on the back of the box it says 703.389.51
@emigrating: It cost 35€ for an RGB bulb with a remote (10€ more than a regular white spectrum bulb with remote) Sadly it wasn't possible to buy one without a remote... but I just had to get one ^^
@davetaz: also recently got problems with the coap-client connection to my gateway, damn, maybe they changed something.

@davetaz

This comment has been minimized.

Show comment
Hide comment
@davetaz

davetaz Aug 22, 2017

@r41d I'm fairly confident my gateway has an issue at the moment as it won't upgrade. Will keep you posted.

davetaz commented Aug 22, 2017

@r41d I'm fairly confident my gateway has an issue at the moment as it won't upgrade. Will keep you posted.

@matemaciek matemaciek referenced this issue in ggravlingen/pytradfri Aug 23, 2017

Merged

Add sRGB to xyY conversion #51

@matemaciek

This comment has been minimized.

Show comment
Hide comment
@matemaciek

matemaciek Aug 23, 2017

If anyone wants to try most recent pytradfri with home-assistant, here it is home-assistant/home-assistant@dev...matemaciek:dev

It includes full white spectrum support, so you can use flux now (-:

matemaciek commented Aug 23, 2017

If anyone wants to try most recent pytradfri with home-assistant, here it is home-assistant/home-assistant@dev...matemaciek:dev

It includes full white spectrum support, so you can use flux now (-:

@pere5

This comment has been minimized.

Show comment
Hide comment
@pere5

pere5 Sep 7, 2017

I made an attempt to document the Lwm2m+IKEA JSON format that TRÅDFRI communicates with. It is derived from these sources:

And by querying my own Trådfri system with my own python script.
The format of the JSON structure below is my own invention so hopefully you can make sense of it...

  "15001": {
    "name": "DEVICES",
    "description": "Device ids for lights and remotes.",
    "example": [
      65536,
      65537,
      65538
    ],
    "15001/reset": {

    },
    "15001/{DeviceId}": [
      {
        "9019": {
          "name": "REACHABILITY_STATE",
          "example": 1
        },
        "3": {
          "name": "DEVICE_INFO",
          "example": {
            "1": "TRADFRI bulb E27 CWS opal 600lm",
            "0": "IKEA of Sweden",
            "3": "1.3.002",
            "2": "",
            "6": 1
          }
        },
        "5750": {
          "name": "APPLICATION_TYPE",
          "example": 2
        },
        "9003": {
          "name": "INSTANCE_ID",
          "example": 65538
        },
        "9002": {
          "name": "CREATED_AT",
          "example": 1504616889
        },
        "9001": {
          "name": "NAME",
          "example": "Badass bulb"
        },
        "3311": {
          "name": "LIGHT_CONTROL",
          "example": [
            {
              "5708": 0,
              "5709": {
                "name": "LIGHT_COLOR_X",
                "example": 30140
              },
              "5710": {
                "name": "LIGHT_COLOR_Y",
                "example": 26909
              },
              "5706": {
                "name": "LIGHT_COLOR",
                "example": "f1e0b5"
              },
              "5707": 0,
              "5711": 0,
              "5712": {
                "name": "TRANSITION_TIME",
                "description": "Specified in seconds/10.",
                "example": 100
              },
              "5850": {
                "name": "ON/OFF",
                "example": 1
              },
              "5851": {
                "name": "LIGHT_DIMMER",
                "example": 160
              },
              "9003": {
                "name": "INSTANCE_ID",
                "example": 0
              }
            }
          ]
        },
        "9054": {
          "name": "OTA_UPDATE_STATE",
          "example": 0
        },
        "9020": {
          "name": "LAST_SEEN",
          "example": 1504769379
        }
      },
      {
        "9019": {
          "name": "REACHABILITY_STATE",
          "example": 1
        },
        "3": {
          "name": "DEVICE_INFO",
          "example": {
            "1": "TRADFRI remote control",
            "0": "IKEA of Sweden",
            "3": "1.2.214",
            "2": "",
            "6": 3,
            "9": 87
          }
        },
        "5750": {
          "name": "APPLICATION_TYPE",
          "example": 0
        },
        "9003": {
          "name": "INSTANCE_ID",
          "example": 65536
        },
        "9002": {
          "name": "CREATED_AT",
          "example": 1504610844
        },
        "9001": {
          "name": "NAME",
          "example": "TRADFRI remote control"
        },
        "9054": {
          "name": "OTA_UPDATE_STATE",
          "example": 0
        },
        "9020": {
          "name": "LAST_SEEN",
          "example": 1504706016
        },
        "15009": {
          "name": "SWITCH",
          "description": "No references to this anywhere",
          "example": [{
            "9003": {
              "name": "INSTANCE_ID",
              "example": 0
            }
          }]
        }
      }
    ]
  },
  "15004": {
    "name": "GROUPS",
    "description": "Groups of devices.",
    "example": [
      154580
    ],
    "15004/add": {

    },
    "15004/remove": {

    },
    "15004/{GroupId}": {
      "5850": {
        "name": "ON/OFF",
        "example": 1
      },
      "9002": {
        "name": "CREATED_AT",
        "example": 1504610855
      },
      "9001": {
        "name": "NAME",
        "example": "My phat group name"
      },
      "9003": {
        "name": "INSTANCE_ID",
        "example": 154580
      },
      "9039": {
        "name": "SCENE_ID",
        "example": 205512
      },
      "9018": {
        "name": "HS_ACCESSORY_LINK",
        "example": {
          "15002": {
            "name": "HS_LINK",
            "example": {
              "9003": {
                "name": "INSTANCE_ID",
                "description": "DeviceIds reached by: 15001/DeviceId",
                "example": [
                  65536,
                  65537,
                  65538
                ]
              }
            }
          }
        }
      },
      "5851": {
        "name": "LIGHT_DIMMER",
        "example": 0
      }
    }
  },
  "15005": {
    "name": "SCENES_TOP",
    "description": "Some kind of top scene structure",
    "example": [
      154580
    ],
    "15005/{SceneTopId}": {
      "name": "SCENES",
      "description": "List of all scenes",
      "example": [
        217404,
        228154,
        203200,
        205512
      ],
      "15005/{SceneTopId}/{SceneId}": {
        "9068": {
          "name": "IKEA_MOODS",
          "example": 1
        },
        "15013": {
          "name": "LIGHT_SETTING",
          "description": "Interesting that two LIGHT_CONTROL's are specified here.",
          "example": [
            {
              "5708": 0,
              "5709": {
                "name": "LIGHT_COLOR_X",
                "example": 30140
              },
              "5710": {
                "name": "LIGHT_COLOR_Y",
                "example": 26909
              },
              "5706": {
                "name": "LIGHT_COLOR",
                "example": "f1e0b5"
              },
              "5707": 0,
              "5711": 0,
              "5850": {
                "name": "ON/OFF",
                "example": 1
              },
              "5851": {
                "name": "LIGHT_DIMMER",
                "example": 203
              },
              "9003": {
                "name": "INSTANCE_ID",
                "example": 65537
              }
            },
            {
              "5708": 0,
              "5709": {
                "name": "LIGHT_COLOR_X",
                "example": 30140
              },
              "5710": {
                "name": "LIGHT_COLOR_Y",
                "example": 26909
              },
              "5706": {
                "name": "LIGHT_COLOR",
                "example": "f1e0b5"
              },
              "5707": 0,
              "5711": 0,
              "5850": {
                "name": "ON/OFF",
                "example": 1
              },
              "5851": {
                "name": "LIGHT_DIMMER",
                "example": 203
              },
              "9003": {
                "name": "INSTANCE_ID",
                "example": 65538
              }
            }
          ]
        },
        "9003": {
          "name": "INSTANCE_ID",
          "example": 217404
        },
        "9002": {
          "name": "CREATED_AT",
          "example": 1504610855
        },
        "9001": {
          "name": "NAME",
          "example": "EVERYDAY"
        },
        "9057": {
          "name": "SCENE_INDEX",
          "example": 0
        }
      }
    }
  },
  "15006": {
    "name": "",
    "example": [{
      "9014": {
        "name": "NOTIFICATION_STATE",
        "example": 0
      },
      "9015": {
        "name": "NOTIFICATION_EVENT",
        "example": 5001
      },
      "9002": {
        "name": "CREATED_AT",
        "example": 1504794867
      }
    }]
  },
  "15010": {
    "name": "SMART_TASKS",
    "example": []
  },
  "15011": {
    "name": "GATEWAY",
    "description": "Operations on the gateway",
    "15011/15012": {
      "name": "GATEWAY_DETAILS"
    },
    "15011/9034": {
      "name": "UPDATE_FIRMWARE"
    },
    "15011/9030": {
      "name": "REBOOT"
    },
    "15011/9031": {
      "name": "RESET"
    },
    "15011/9063": {
      "name": "AUTH_PATH"
    },
    "15011/9033": {
      "name": "SESSION_ID"
    }
  },
  "status": {
    "name": "",
    "example": {}
  }
}

pere5 commented Sep 7, 2017

I made an attempt to document the Lwm2m+IKEA JSON format that TRÅDFRI communicates with. It is derived from these sources:

And by querying my own Trådfri system with my own python script.
The format of the JSON structure below is my own invention so hopefully you can make sense of it...

  "15001": {
    "name": "DEVICES",
    "description": "Device ids for lights and remotes.",
    "example": [
      65536,
      65537,
      65538
    ],
    "15001/reset": {

    },
    "15001/{DeviceId}": [
      {
        "9019": {
          "name": "REACHABILITY_STATE",
          "example": 1
        },
        "3": {
          "name": "DEVICE_INFO",
          "example": {
            "1": "TRADFRI bulb E27 CWS opal 600lm",
            "0": "IKEA of Sweden",
            "3": "1.3.002",
            "2": "",
            "6": 1
          }
        },
        "5750": {
          "name": "APPLICATION_TYPE",
          "example": 2
        },
        "9003": {
          "name": "INSTANCE_ID",
          "example": 65538
        },
        "9002": {
          "name": "CREATED_AT",
          "example": 1504616889
        },
        "9001": {
          "name": "NAME",
          "example": "Badass bulb"
        },
        "3311": {
          "name": "LIGHT_CONTROL",
          "example": [
            {
              "5708": 0,
              "5709": {
                "name": "LIGHT_COLOR_X",
                "example": 30140
              },
              "5710": {
                "name": "LIGHT_COLOR_Y",
                "example": 26909
              },
              "5706": {
                "name": "LIGHT_COLOR",
                "example": "f1e0b5"
              },
              "5707": 0,
              "5711": 0,
              "5712": {
                "name": "TRANSITION_TIME",
                "description": "Specified in seconds/10.",
                "example": 100
              },
              "5850": {
                "name": "ON/OFF",
                "example": 1
              },
              "5851": {
                "name": "LIGHT_DIMMER",
                "example": 160
              },
              "9003": {
                "name": "INSTANCE_ID",
                "example": 0
              }
            }
          ]
        },
        "9054": {
          "name": "OTA_UPDATE_STATE",
          "example": 0
        },
        "9020": {
          "name": "LAST_SEEN",
          "example": 1504769379
        }
      },
      {
        "9019": {
          "name": "REACHABILITY_STATE",
          "example": 1
        },
        "3": {
          "name": "DEVICE_INFO",
          "example": {
            "1": "TRADFRI remote control",
            "0": "IKEA of Sweden",
            "3": "1.2.214",
            "2": "",
            "6": 3,
            "9": 87
          }
        },
        "5750": {
          "name": "APPLICATION_TYPE",
          "example": 0
        },
        "9003": {
          "name": "INSTANCE_ID",
          "example": 65536
        },
        "9002": {
          "name": "CREATED_AT",
          "example": 1504610844
        },
        "9001": {
          "name": "NAME",
          "example": "TRADFRI remote control"
        },
        "9054": {
          "name": "OTA_UPDATE_STATE",
          "example": 0
        },
        "9020": {
          "name": "LAST_SEEN",
          "example": 1504706016
        },
        "15009": {
          "name": "SWITCH",
          "description": "No references to this anywhere",
          "example": [{
            "9003": {
              "name": "INSTANCE_ID",
              "example": 0
            }
          }]
        }
      }
    ]
  },
  "15004": {
    "name": "GROUPS",
    "description": "Groups of devices.",
    "example": [
      154580
    ],
    "15004/add": {

    },
    "15004/remove": {

    },
    "15004/{GroupId}": {
      "5850": {
        "name": "ON/OFF",
        "example": 1
      },
      "9002": {
        "name": "CREATED_AT",
        "example": 1504610855
      },
      "9001": {
        "name": "NAME",
        "example": "My phat group name"
      },
      "9003": {
        "name": "INSTANCE_ID",
        "example": 154580
      },
      "9039": {
        "name": "SCENE_ID",
        "example": 205512
      },
      "9018": {
        "name": "HS_ACCESSORY_LINK",
        "example": {
          "15002": {
            "name": "HS_LINK",
            "example": {
              "9003": {
                "name": "INSTANCE_ID",
                "description": "DeviceIds reached by: 15001/DeviceId",
                "example": [
                  65536,
                  65537,
                  65538
                ]
              }
            }
          }
        }
      },
      "5851": {
        "name": "LIGHT_DIMMER",
        "example": 0
      }
    }
  },
  "15005": {
    "name": "SCENES_TOP",
    "description": "Some kind of top scene structure",
    "example": [
      154580
    ],
    "15005/{SceneTopId}": {
      "name": "SCENES",
      "description": "List of all scenes",
      "example": [
        217404,
        228154,
        203200,
        205512
      ],
      "15005/{SceneTopId}/{SceneId}": {
        "9068": {
          "name": "IKEA_MOODS",
          "example": 1
        },
        "15013": {
          "name": "LIGHT_SETTING",
          "description": "Interesting that two LIGHT_CONTROL's are specified here.",
          "example": [
            {
              "5708": 0,
              "5709": {
                "name": "LIGHT_COLOR_X",
                "example": 30140
              },
              "5710": {
                "name": "LIGHT_COLOR_Y",
                "example": 26909
              },
              "5706": {
                "name": "LIGHT_COLOR",
                "example": "f1e0b5"
              },
              "5707": 0,
              "5711": 0,
              "5850": {
                "name": "ON/OFF",
                "example": 1
              },
              "5851": {
                "name": "LIGHT_DIMMER",
                "example": 203
              },
              "9003": {
                "name": "INSTANCE_ID",
                "example": 65537
              }
            },
            {
              "5708": 0,
              "5709": {
                "name": "LIGHT_COLOR_X",
                "example": 30140
              },
              "5710": {
                "name": "LIGHT_COLOR_Y",
                "example": 26909
              },
              "5706": {
                "name": "LIGHT_COLOR",
                "example": "f1e0b5"
              },
              "5707": 0,
              "5711": 0,
              "5850": {
                "name": "ON/OFF",
                "example": 1
              },
              "5851": {
                "name": "LIGHT_DIMMER",
                "example": 203
              },
              "9003": {
                "name": "INSTANCE_ID",
                "example": 65538
              }
            }
          ]
        },
        "9003": {
          "name": "INSTANCE_ID",
          "example": 217404
        },
        "9002": {
          "name": "CREATED_AT",
          "example": 1504610855
        },
        "9001": {
          "name": "NAME",
          "example": "EVERYDAY"
        },
        "9057": {
          "name": "SCENE_INDEX",
          "example": 0
        }
      }
    }
  },
  "15006": {
    "name": "",
    "example": [{
      "9014": {
        "name": "NOTIFICATION_STATE",
        "example": 0
      },
      "9015": {
        "name": "NOTIFICATION_EVENT",
        "example": 5001
      },
      "9002": {
        "name": "CREATED_AT",
        "example": 1504794867
      }
    }]
  },
  "15010": {
    "name": "SMART_TASKS",
    "example": []
  },
  "15011": {
    "name": "GATEWAY",
    "description": "Operations on the gateway",
    "15011/15012": {
      "name": "GATEWAY_DETAILS"
    },
    "15011/9034": {
      "name": "UPDATE_FIRMWARE"
    },
    "15011/9030": {
      "name": "REBOOT"
    },
    "15011/9031": {
      "name": "RESET"
    },
    "15011/9063": {
      "name": "AUTH_PATH"
    },
    "15011/9033": {
      "name": "SESSION_ID"
    }
  },
  "status": {
    "name": "",
    "example": {}
  }
}
@davetaz

This comment has been minimized.

Show comment
Hide comment
@davetaz

davetaz Sep 10, 2017

@r41d managed to get my gateway working. It would seem that the gateway might hold two firmware images and each time you reset the gateway it boots either the factory default or the latest one it has. So I had my gateway running 1.1.0015 but it was corrupt, so I reset and the gateway booted 1.0.008 and it remembered the devices. Although the gateway was running 1.0.0008 the updates screen said the gateway was up to date. This is because it was, I just wasn't running that image. I then reset it again and the gateway booted a working 1.1.0015 and forgot all my devices. After re-adding them everything is now fine and homebridge and coap is all happy.

davetaz commented Sep 10, 2017

@r41d managed to get my gateway working. It would seem that the gateway might hold two firmware images and each time you reset the gateway it boots either the factory default or the latest one it has. So I had my gateway running 1.1.0015 but it was corrupt, so I reset and the gateway booted 1.0.008 and it remembered the devices. Although the gateway was running 1.0.0008 the updates screen said the gateway was up to date. This is because it was, I just wasn't running that image. I then reset it again and the gateway booted a working 1.1.0015 and forgot all my devices. After re-adding them everything is now fine and homebridge and coap is all happy.

@r41d

This comment has been minimized.

Show comment
Hide comment
@r41d

r41d Sep 22, 2017

Seemingly, IKEA released the first update to the Tradfri Android App.
One can now choose some colors when tapping on a bulb and then on the three dots: https://imgur.com/a/0A7iq
These are many more than those colors which one can cycle through by using the physical remote

r41d commented Sep 22, 2017

Seemingly, IKEA released the first update to the Tradfri Android App.
One can now choose some colors when tapping on a bulb and then on the three dots: https://imgur.com/a/0A7iq
These are many more than those colors which one can cycle through by using the physical remote

@matemaciek

This comment has been minimized.

Show comment
Hide comment
@matemaciek

matemaciek Sep 22, 2017

I'm gonna get my RGB bulb finally today, I know that they're in my IKEA (-:

I'm gonna get my RGB bulb finally today, I know that they're in my IKEA (-:

@Hydro8

This comment has been minimized.

Show comment
Hide comment
@Hydro8

Hydro8 Sep 27, 2017

Someone know how to change color for an entire group ? I tried to change the mood but I didn't want to change my dimmer level.

Hydro8 commented Sep 27, 2017

Someone know how to change color for an entire group ? I tried to change the mood but I didn't want to change my dimmer level.

@pere5

This comment has been minimized.

Show comment
Hide comment
@pere5

pere5 Sep 29, 2017

@Hydro8 I'm also interested in how to change for an entire group

pere5 commented Sep 29, 2017

@Hydro8 I'm also interested in how to change for an entire group

@UserXYZ

This comment has been minimized.

Show comment
Hide comment
@UserXYZ

UserXYZ Sep 29, 2017

Hello guys, just wanna post my experience with development version of libcoap and some issues I have with it.
If you git clone libcoap and then checkout devel branch, you get v4.2.0alpha which is way forward of the latest stable in master (4.1.2) with a bunch of bug fixes etc.
Since I'm developing my own Tradfri coap-mqtt bridge in python2, I use coap-client extensively (no support for python yet and py3 version is incomplete) in polling mode, and I've noticed that it has more extensive output on stdout than before.
One line more, to be precise, where it writes additional info about data type it handles, so take care of that in your parsing programs.

But, one more thing that still fails, like in old version, is subscription, or observe.
It appears that you get Observe:0 option when using -s switch to coap-client which should emulate the usual mqtt subscribe method. Now, in coap-client it works for some time, but after some undetermined time it breaks and the client unsubscribes itself - or the server (Tradfri hub, in my case) kicks it out.
Playing with -s timeout doesn't really change anything, and I don't even understand what is exactly that timeout for.

So, my question - did somebody manage to effectively subscribe to an endpoint (topic) on coap server without this disconnecting behaviour?
If the problem is in coap-client, does anybody have and other cli coap client that actually works with tradfri?
I can't compile LibNyoci on multiple platforms, and FreeCOAP has no usable client and no DTLS, so...bummer.

UserXYZ commented Sep 29, 2017

Hello guys, just wanna post my experience with development version of libcoap and some issues I have with it.
If you git clone libcoap and then checkout devel branch, you get v4.2.0alpha which is way forward of the latest stable in master (4.1.2) with a bunch of bug fixes etc.
Since I'm developing my own Tradfri coap-mqtt bridge in python2, I use coap-client extensively (no support for python yet and py3 version is incomplete) in polling mode, and I've noticed that it has more extensive output on stdout than before.
One line more, to be precise, where it writes additional info about data type it handles, so take care of that in your parsing programs.

But, one more thing that still fails, like in old version, is subscription, or observe.
It appears that you get Observe:0 option when using -s switch to coap-client which should emulate the usual mqtt subscribe method. Now, in coap-client it works for some time, but after some undetermined time it breaks and the client unsubscribes itself - or the server (Tradfri hub, in my case) kicks it out.
Playing with -s timeout doesn't really change anything, and I don't even understand what is exactly that timeout for.

So, my question - did somebody manage to effectively subscribe to an endpoint (topic) on coap server without this disconnecting behaviour?
If the problem is in coap-client, does anybody have and other cli coap client that actually works with tradfri?
I can't compile LibNyoci on multiple platforms, and FreeCOAP has no usable client and no DTLS, so...bummer.

@lwis

This comment has been minimized.

Show comment
Hide comment
@lwis

lwis Sep 30, 2017

@UserXYZ I believe it's an issue with libcoap, as we don't experience the issue with aiocoap over at ggravlingen/pytradfri

lwis commented Sep 30, 2017

@UserXYZ I believe it's an issue with libcoap, as we don't experience the issue with aiocoap over at ggravlingen/pytradfri

@UserXYZ

This comment has been minimized.

Show comment
Hide comment
@UserXYZ

UserXYZ Sep 30, 2017

Well, I guess then that the developer of libcoap made a bug that needs to be fixed, or he chose such behavior of coap-client deliberately, since that is supposed to be a test tool...

What surprises me is that no other contributor decided to fix it, or at least make subscribe parameter with value of zero work as normal Observe:0 option, which would actually be a regular no-timeout subscription.

Since I can't use Python 3 (still being under much of development etc), aiocoap is not a solution atm...

So, anybody knows of another software that can be used instead of libcoap? Should be written in C/C++ (simplest to build), have dtls using tinydtls (gnutls is pain to include and I'm not sure if it works with keys besides certs) and pretty much everything else that libcoap has...?
Like a better version of libcoap...

UserXYZ commented Sep 30, 2017

Well, I guess then that the developer of libcoap made a bug that needs to be fixed, or he chose such behavior of coap-client deliberately, since that is supposed to be a test tool...

What surprises me is that no other contributor decided to fix it, or at least make subscribe parameter with value of zero work as normal Observe:0 option, which would actually be a regular no-timeout subscription.

Since I can't use Python 3 (still being under much of development etc), aiocoap is not a solution atm...

So, anybody knows of another software that can be used instead of libcoap? Should be written in C/C++ (simplest to build), have dtls using tinydtls (gnutls is pain to include and I'm not sure if it works with keys besides certs) and pretty much everything else that libcoap has...?
Like a better version of libcoap...

@obgm

This comment has been minimized.

Show comment
Hide comment
@obgm

obgm Sep 30, 2017

@UserXYZ You are always welcome to open issues on the libcoap bugtracker or discuss these on the libcoap mailing list. It is difficult to fix your issues if nobody knows about them.

You can adapt the amount of output produced by coap-client on stdout with the option '-v'.

Regarding the timeout: '-B' controls the time until coap-client terminates. By default, this is 90 seconds as documented in the manual page. The option -s controls the timeout until coap-client cancels the established observe relationship.

Regarding your question about alternatives to libcoap: There is Californium which has DTLS support, and AFAIK, there is a version of node-coap with DTLS support.

obgm commented Sep 30, 2017

@UserXYZ You are always welcome to open issues on the libcoap bugtracker or discuss these on the libcoap mailing list. It is difficult to fix your issues if nobody knows about them.

You can adapt the amount of output produced by coap-client on stdout with the option '-v'.

Regarding the timeout: '-B' controls the time until coap-client terminates. By default, this is 90 seconds as documented in the manual page. The option -s controls the timeout until coap-client cancels the established observe relationship.

Regarding your question about alternatives to libcoap: There is Californium which has DTLS support, and AFAIK, there is a version of node-coap with DTLS support.

@rodders99

This comment has been minimized.

Show comment
Hide comment
@rodders99

rodders99 Oct 1, 2017

I came a cross a similar problem : Getting something not supported by ha-bridge working with ha-bridge. (Denon Amplifier, Samsung TV, 433Mhz based HA kit and more.

Rather than delving into ha-bridge's code, I ended up writing my own php broker and ha-bridge just flings the http command at it and the broker sorts out the rest.

Alexa / Google => ha-bridge => My Broker => Insert Weird Gateway => Weird Kit here.

It appears from the above a similar approach is being attempted by some of you. The work carried out by Adreas Spiess may help : https://www.youtube.com/watch?v=wS8Vj0ba4ic.

I came a cross a similar problem : Getting something not supported by ha-bridge working with ha-bridge. (Denon Amplifier, Samsung TV, 433Mhz based HA kit and more.

Rather than delving into ha-bridge's code, I ended up writing my own php broker and ha-bridge just flings the http command at it and the broker sorts out the rest.

Alexa / Google => ha-bridge => My Broker => Insert Weird Gateway => Weird Kit here.

It appears from the above a similar approach is being attempted by some of you. The work carried out by Adreas Spiess may help : https://www.youtube.com/watch?v=wS8Vj0ba4ic.

@morberg morberg referenced this issue in ggravlingen/pytradfri Oct 8, 2017

Closed

tinydtls won't install on macOS without modifications #64

@skatsikeas

This comment has been minimized.

Show comment
Hide comment
@skatsikeas

skatsikeas Nov 1, 2017

@davetaz I have exactly the same problem, my gateway is stuck on 1.0.0008 and says there are no updates. I tried reseting with the hole button but it stays in the same version. How did you make it to boot to the other image?

@davetaz I have exactly the same problem, my gateway is stuck on 1.0.0008 and says there are no updates. I tried reseting with the hole button but it stays in the same version. How did you make it to boot to the other image?

@davetaz

This comment has been minimized.

Show comment
Hide comment
@davetaz

davetaz Nov 1, 2017

Here are some of the things I did.

  1. Keep trying the reset
  2. Each time you do, also reinstall the app on your phone
  3. Take the gateway back to IKEA (which is what I did in the end)

davetaz commented Nov 1, 2017

Here are some of the things I did.

  1. Keep trying the reset
  2. Each time you do, also reinstall the app on your phone
  3. Take the gateway back to IKEA (which is what I did in the end)
@UserXYZ

This comment has been minimized.

Show comment
Hide comment
@UserXYZ

UserXYZ Nov 1, 2017

@lwis can you tell me how do you use aiocoap with ggravlingen/pytradfri code? In asynchronous mode, I suppose, because in synchronous mode it is just calling coap-client in the background (saw that in my process list) which kinda defeats the purpose of aiocoap...

UserXYZ commented Nov 1, 2017

@lwis can you tell me how do you use aiocoap with ggravlingen/pytradfri code? In asynchronous mode, I suppose, because in synchronous mode it is just calling coap-client in the background (saw that in my process list) which kinda defeats the purpose of aiocoap...

@lwis

This comment has been minimized.

Show comment
Hide comment
@lwis

lwis Nov 1, 2017

@UserXYZ guts are all here buddy.

lwis commented Nov 1, 2017

@UserXYZ guts are all here buddy.

@UserXYZ

This comment has been minimized.

Show comment
Hide comment
@UserXYZ

UserXYZ Nov 1, 2017

@lwis Well, that didn't quite answer my question, but based on your link, I'd say async mode...
So, no problems with observation of resource, you can track it's state for as long as you like?
No need to poll, or at least disconnect and reconnect at some time to give the hub a chance to clean connections or something?

UserXYZ commented Nov 1, 2017

@lwis Well, that didn't quite answer my question, but based on your link, I'd say async mode...
So, no problems with observation of resource, you can track it's state for as long as you like?
No need to poll, or at least disconnect and reconnect at some time to give the hub a chance to clean connections or something?

@lwis

This comment has been minimized.

Show comment
Hide comment
@lwis

lwis Nov 1, 2017

@UserXYZ Oh, you mean observation? Yes, coap-client has issues with observation, but aiocoap does not. You can observe until the connection is stopped at either end.

lwis commented Nov 1, 2017

@UserXYZ Oh, you mean observation? Yes, coap-client has issues with observation, but aiocoap does not. You can observe until the connection is stopped at either end.

@UserXYZ

This comment has been minimized.

Show comment
Hide comment
@UserXYZ

UserXYZ Nov 1, 2017

@lwis Sweet, that's what I need...now just to figure out aiocoap's API to reimplement my code or switch totally to pytradfri as a base...oh, and learn Python3 alongside Python2...such fun...

UserXYZ commented Nov 1, 2017

@lwis Sweet, that's what I need...now just to figure out aiocoap's API to reimplement my code or switch totally to pytradfri as a base...oh, and learn Python3 alongside Python2...such fun...

@lwis

This comment has been minimized.

Show comment
Hide comment
@lwis

lwis Nov 1, 2017

@UserXYZ obviously I'd recommend using pytradfri 😉

lwis commented Nov 1, 2017

@UserXYZ obviously I'd recommend using pytradfri 😉

@UserXYZ

This comment has been minimized.

Show comment
Hide comment
@UserXYZ

UserXYZ Nov 1, 2017

@lwis Weeell, that would be easier way to do it, for sure, but again it's also adding another layer.
my code->pytradfri->aiocoap and I could do my code->aiocoap but with more effort on my part...
Meh, I'll try with pytradfri first and then see if I get the hang of aiocoap's API, make another branch/version then.

UserXYZ commented Nov 1, 2017

@lwis Weeell, that would be easier way to do it, for sure, but again it's also adding another layer.
my code->pytradfri->aiocoap and I could do my code->aiocoap but with more effort on my part...
Meh, I'll try with pytradfri first and then see if I get the hang of aiocoap's API, make another branch/version then.

@leifnel

This comment has been minimized.

Show comment
Hide comment
@leifnel

leifnel Nov 11, 2017

I found my GW, but it is not open on port 5684

The gateway is running version 1.2.42, claiming to be hue-compatible.

I'm currently scanning all ports; none seem to be open.

leifnel commented Nov 11, 2017

I found my GW, but it is not open on port 5684

The gateway is running version 1.2.42, claiming to be hue-compatible.

I'm currently scanning all ports; none seem to be open.

@greluc

This comment has been minimized.

Show comment
Hide comment
@greluc

greluc Nov 11, 2017

With 1.2.42 IKEA changed the authentication. See the following link: https://community.openhab.org/t/ikea-tradfri-gateway/26135/148?u=kai

greluc commented Nov 11, 2017

With 1.2.42 IKEA changed the authentication. See the following link: https://community.openhab.org/t/ikea-tradfri-gateway/26135/148?u=kai

@leifnel

This comment has been minimized.

Show comment
Hide comment
@leifnel

leifnel Nov 11, 2017

Where do you find the coap-client?

I got the one from libcoap-1-0-bin in debian.
It does not have the -u option.

`

root@mini:# coap-client -m post -u "Client_identity" -k "qwertyuiopå" -e '{"9090":"nodered"}' \
"coaps://192.168.1.86:5684/15011/9063" 

coap-client: invalid option -- 'u'
coap-client v4.1.2 -- a small CoAP implementation
   (c) 2010-2015 Olaf Bergmann <bergmann@tzi.org>

usage: coap-client [-A type...] [-t type] [-b [num,]size] [-B seconds] [-e text]
            [-m method] [-N] [-o file] [-P addr[:port]] [-p port]
            [-s duration] [-O num,text] [-T string] [-v num] [-a addr] [-U] URI

`

I'm trying to access the hub from node-red, and it will not authenticate.
node-red-contrib-tradfri 1.1.0

Registration did not work. Verify your settings and possibly try another identity. Note that an identity can only be used once and the response preshared key must be stored for usage with the identity

leifnel commented Nov 11, 2017

Where do you find the coap-client?

I got the one from libcoap-1-0-bin in debian.
It does not have the -u option.

`

root@mini:# coap-client -m post -u "Client_identity" -k "qwertyuiopå" -e '{"9090":"nodered"}' \
"coaps://192.168.1.86:5684/15011/9063" 

coap-client: invalid option -- 'u'
coap-client v4.1.2 -- a small CoAP implementation
   (c) 2010-2015 Olaf Bergmann <bergmann@tzi.org>

usage: coap-client [-A type...] [-t type] [-b [num,]size] [-B seconds] [-e text]
            [-m method] [-N] [-o file] [-P addr[:port]] [-p port]
            [-s duration] [-O num,text] [-T string] [-v num] [-a addr] [-U] URI

`

I'm trying to access the hub from node-red, and it will not authenticate.
node-red-contrib-tradfri 1.1.0

Registration did not work. Verify your settings and possibly try another identity. Note that an identity can only be used once and the response preshared key must be stored for usage with the identity

@greluc

This comment has been minimized.

Show comment
Hide comment
@greluc

greluc Nov 11, 2017

For testing of the gateway purpose i'm using the californium.tools (https://github.com/eclipse/californium.tools) and in my program i use the coap client implementation of the californium library.

greluc commented Nov 11, 2017

For testing of the gateway purpose i'm using the californium.tools (https://github.com/eclipse/californium.tools) and in my program i use the coap client implementation of the californium library.

@Pica4x6

This comment has been minimized.

Show comment
Hide comment
@Pica4x6

Pica4x6 Nov 20, 2017

Hi, I've been following this (nice) discussion from the very beginning. The thing is that I would be interested in running some (source) code directly (bypassing the gateway) on the bulbs. Do you think it would be possible? (a piece of software running continuously in the bulb... if the temperature of the bulb falls down, then change the color to blue)

Pica4x6 commented Nov 20, 2017

Hi, I've been following this (nice) discussion from the very beginning. The thing is that I would be interested in running some (source) code directly (bypassing the gateway) on the bulbs. Do you think it would be possible? (a piece of software running continuously in the bulb... if the temperature of the bulb falls down, then change the color to blue)

@ffleurey

This comment has been minimized.

Show comment
Hide comment
@ffleurey

ffleurey Jan 1, 2018

Hello! Tons of useful info and links in the thread, thanks! I have been playing with the new Trådfri Color bulb trying to figure out why it would not show the whole spectrum and found the answer by cracking one open. It does not have green LEDs. I have put some code, info and pictures here: https://github.com/ffleurey/ThingML-Tradfri so that you do not have to vut your own bulb :-) Cheers!

ffleurey commented Jan 1, 2018

Hello! Tons of useful info and links in the thread, thanks! I have been playing with the new Trådfri Color bulb trying to figure out why it would not show the whole spectrum and found the answer by cracking one open. It does not have green LEDs. I have put some code, info and pictures here: https://github.com/ffleurey/ThingML-Tradfri so that you do not have to vut your own bulb :-) Cheers!

@gabrielsson

This comment has been minimized.

Show comment
Hide comment
@gabrielsson

gabrielsson Jan 1, 2018

@ffleurey Really nice library. Great that you have put the effort in to make the UI, really fun and works great.

@ffleurey Really nice library. Great that you have put the effort in to make the UI, really fun and works great.

@bwssytems bwssytems added enhancement and removed question labels Mar 14, 2018

@obgm obgm referenced this issue in obgm/libcoap Jun 4, 2018

Closed

Does libcoap support server discovery? #196

@tzolov

This comment has been minimized.

Show comment
Hide comment
@tzolov

tzolov Jun 7, 2018

Very informative thread. I'm trying to generalize some of the findings above into a handy CoAP Shell (https://github.com/tzolov/coap-shell) with some initial Ikea gateway support as well.
https://www.youtube.com/watch?v=zhEGFfCJwTg&feature=youtu.be

tzolov commented Jun 7, 2018

Very informative thread. I'm trying to generalize some of the findings above into a handy CoAP Shell (https://github.com/tzolov/coap-shell) with some initial Ikea gateway support as well.
https://www.youtube.com/watch?v=zhEGFfCJwTg&feature=youtu.be

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