IKEA Trådfri Gateway

Thanks for your patience, everyone!
I have some good news to share: The latest distro build (#950) now contains the Tradfri binding :slight_smile:
Disclaimer: It is an initial version that imho already works quite well and has already gone through quite some iterations. Nonetheless, using CoAP is new to me and it seems that there are often unstable situations coming from the IKEA gateway, where a reboot often is the best solution.

Feel free to start using/testing it now and please report any issues in the ESH issue tracker - I have even already introduced a dedicated “Trådfri” Github label for it. Please also note that I personally won’t have the time to maintain it on the long run - so instead of entering issues and feature requests, it is even more welcome to directly receive pull requests with bug fixes for issues that you encounter. So please help making it a perfectly stable binding :sunglasses:.

6 Likes

I remember Norway to be expensive from when I lived there. Still shocked to see the FLOALT is abt 30% moreexpensive than in my country (netherlands). Anyway, may try this one as well

1 Like

Very nice, thank you for your work ! I updated to latest openhab snapshot.
I was also a little bit disappointed concerning textual configuration, but fixed now. So, for everybody looking for doc :

Note that it is also already available on the official openHAB documentation: http://docs.openhab.org/addons/bindings/tradfri/readme.html.

1 Like

Why not also mention in the doc that the intensity also accepts OFF/ON where ON restores the intensity level in effect prior to OFF?
This means that Tradfri items can be included seamlessly into Z-Wave item groups. :slight_smile:

It is also possible to define the Intensity as a switch for OFF/ON control.

Just want to add that the remote is actually not needed to add a bulb.

I just bought a gateway and two bulb’s, and when I tried to set it up in the app it kept asking for a remote.
I thought bummer! But when I was about to pack it all away I just saw the pairing button ON THE GATEWAY!
Pushing that for 10 secs close to a bulb seemed to do the trick, the zigbee link LED stopped flashing and turned solid.

The app still asked me to add a remote, but in OpenHAB I was able to see, and control, the bulb!

The IKEA app is still useless (asking to add a remote) but OpenHAB is fully functional, I can control both brightness and color temperature.

2 Likes

Hi, first time poster here :blush:
I’m having an issue with thing definitions in the Tradfri binding.I’m trying to use the Binding with a gateway and two flat 60x60 cm² LED panels.

  • TLDR: I get a warning, see log at the very bottom of this post.

Here’s my .things file: (The IDs are copied from PaperUI Inbox.)

Thing tradfri:gateway:gwb072b... "TradfriGateway" @ "Sodazimmer" [ host="192.168.2.124", code="..." ] {
0220:	panelWoZi			[ id=65537 ]
0220:	panelBuero			[ id=65539 ]
}

First odd thing here, I had to add colons after “0220”. Without the colons the log would show

2017-07-02 02:13:46.000 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model ‘tradfri.things’ has errors, therefore ignoring it: [3,7]: missing ‘:’ at ‘panelBuero’

So after fixing (?) that it seems that the binding can find the gateway:

2017-07-02 02:22:45.426 [ThingUpdatedEvent ] - Thing ‘tradfri:gateway:gwb072b…’ has been updated.
2017-07-02 02:22:45.433 [hingStatusInfoChangedEvent] - ‘tradfri:gateway:gwb072b…’ changed from ONLINE to UNKNOWN
2017-07-02 02:22:45.505 [hingStatusInfoChangedEvent] - ‘tradfri:gateway:gwb072b…’ changed from UNKNOWN to ONLINE

I then created this .items file:

// IKEA Tradfri flache LED-Panel
Dimmer 		panelBuero			"Bürolicht"		{ channel="tradfri:0220:gwb072b...:panelBuero:brightness" }
Dimmer 		panelWoZi			"WoZiLicht"		{ channel="tradfri:0220:gwb072b..:panelWoZi:brightness" }

and a .sitemap:

sitemap tradfri label="Tradfri Test"
{
	Frame label="Testframe" {
		Slider		item=panelBuero			label="Bürolicht [%.1f %%]"
		Slider		item=panelWoZi			label="WoZilicht [%.1f %%]"
	}
}

Using the slider results in no response from the panel and this log output:

2017-07-02 02:24:47.888 [WARN ] [ome.core.thing.internal.ThingManager] - Cannot delegate command '24' for item 'panelBuero' to handler for channel 'tradfri:0220:gwb072b...:panelBuero:brightness', because no thing with the UID 'tradfri:0220:gwb072b...:panelBuero' could be found.
2017-07-02 02:24:47.891 [ItemCommandEvent          ] - Item 'panelBuero' received command 24

What am I doing wrong?
Cheers
Ben

Hi Ben,

enjoy the community. Your first post is a very good one. Keep going on.

After a quick review of the posted configuration I would suggest first to change the syntax of the .things file to

Bridge tradfri:gateway:gwb072b... "TradfriGateway" @ "Sodazimmer" [ host="192.168.2.124", code="..." ] {
    Thing 0220 panelWoZi [ id=65537 ]
    Thing 0220 panelBuero [ id=65539 ]
}

The gateway should be a Bridge, the bulbs (or panels) are the Things. The keyword Thing is optional in the configuration - only for better readability.

I am not sure if the syntax of the items file is correct. If the step above doesn’t solve your problem try to change it to

Dimmer 		panelBuero			"Bürolicht"		{ channel="tradfri:0220:gwb072b...:65539:brightness" }
Dimmer 		panelWoZi			"WoZiLicht"		{ channel="tradfri:0220:gwb072b...:65537:brightness" }

In PaperUI the fourth value is identical to the bulb (or panel) id.

Hello Christoph,
changing Thing to Bridge solved it, thank you so much. I must have been blind, I misread the example .things file in the tradfri binding documentation multiple times :smile:
FIY, the .items file was correct in using the thing name in its channel, not the id.
Thank you!
Ben

Edit: I now also got the color temperature picker to work, a small correction in the documentation is necessary in chapter “Channels”: The channel is called color_temperature, not colorTemperature.

Nice, I am glad you got it running.

Thanks for the information. Will take care of the errors in the documentation.

EDIT: Addressed changes in README.md in PR #3784:

https://github.com/eclipse/smarthome/pull/3784

Hi all,

I have updated the Tradfri Gateway binding so that it also correctly identifies groups (IPSO: 15004) of lamps bound to a remote. With the update I made they appear in the OpenHab Inbox as new Things. You can bind these to a Switch item.

Now it is easy to switch all lamps within a group on or off. Also it is possible to make a rule that executes when you select On/Off in the remote.

The cool thing is that these Groups can be empty. With the Remote still controlling the Group ON/OFF status. As a result this is a work-around for not being able to directly read the status of the remote through the GW.

I bought a bunch of cheap Ikea remotes that I can now use to control my other OpenHab things like Hue lights, TV, etc. Which is great.

PS. Can someone tell me how I can officially contribute these code changes back to the community? Of course, if you’re interested?

Best regards,

Mario

3 Likes

This sounds very useful. Can you detect all five buttons separately or only on/off?

Unfortunately only On/Off. The dimmer and colour temperature commands are not send through the GW.

Are these commands sent when there is a lamp in the group? If yes, maybe a workaround would be to borrow a lamp from a friend, add it to the group and then bringing it out of reach of the GW? Maybe the GW would then try to contact the lamp and send the commands?

Hello guys, relative noobie here. I run my OH2.1 on a Raspberry Pi with no issues. I also use the Pi as an MQTT gateway and an nRF24L01+ gateway for my little Arudino test projects.

Is it possible to set up my RPi as a replacement to the Trådfri Gateway and do away with the IKEA one so that the RPi is communicating directly with the bulbs, remotes etc? If yes, are there any limitations?

PS. Can someone tell me how I can officially contribute these code changes back to the community? Of course, if you’re interested?

Create a PR at GitHub - eclipse-archived/smarthome: Eclipse SmartHome™ project

See also:

Thanks. I already found out how to do this and made PR.

2 Likes

Just discovered a little ‘snag’ when trying to set both the brightness and color temperature from within a rule.
A delay between the two commands makes it work.

sendCommand(TradfriP2Bright, 90)        			
Thread::sleep(600)
sendCommand(TradfriP2Temp, 50)        			

Without the delay, the first command is interrupted by the second, and the second one ‘wins’ leaving the brightness in its old state.

2 Likes

I just installed this version of the binding, but no groups are shown in my inbox:

openhab> bundle:list | grep -i trad
186 | Active   |  80 | 0.9.0.201707251303     | Tradfri Binding
openhab> 

What am I missing?

Hi Ole,

You placed the binding in the addons, probably with the Scandium and Californium Osgi jars as well, then did a bundle:start?

I am unsure if automatic discovery works when you install manually but it should work from that moment on. You can check this by doing a log set debug on this binding.

Anyway I did the following in my configuration:

Things

Bridge tradfri:gateway:gwa0cc2b6d6e7b [ host=“yourip", code=“yoursecuritycode" ] {
    0220 tradfri_light_attic [ id=65539 ]
    0220 tradfri_light_bedroom [ id=65537 ]
    group tradfri_group_livingroom [ id=140890 ]
    group tradfri_group_bedroom [ id=132922 ]
    group tradfri_group_attic [ id=147073 ]
}

Items:

Dimmer Tradfri_Attic (Lights) { channel=“tradfri:0220:gwa0cc2b6d6e7b:tradfri_light_attic:brightness” }
Dimmer Tradfri_Bedroom (Lights) { channel=“tradfri:0220:gwa0cc2b6d6e7b:tradfri_light_bedroom:brightness” }
Switch Tradfri_Remote_Livingroom { channel=“tradfri:group:gwa0cc2b6d6e7b:tradfri_group_livingroom:group_state” }
Switch Tradfri_Remote_Bedroom { channel=“tradfri:group:gwa0cc2b6d6e7b:tradfri_group_bedroom:group_state” }
Switch Tradfri_Remote_Attic { channel="tradfri:group:gwa0cc2b6d6e7b:tradfri_group_attic:group_state” }

Of course the ID’s are different in your case (check the log) but it should work after that.

Good luck!

Mario