[OBSOLETE] Ikea Tradfri Wireless Dimmer Device Handler draft

Hello, did you use the device handler from the GitHub page? I updated the device recognition line it that version and it was detected automatically as the correct type of thing on my hub.
I may be wrong but it seems that it is important which device it is detected as so that the ZigBee registration happens properly when it is added to the hub.
Apart from this I’m not sure what to suggest, I’m assuming the hardware has not been updated since I bought my one. Can you post the device fingerprint from the log? It should appear as it is registered.
Kris

I also get no events. I am using the GitHub handler. Any ideas? Thanks!

Hello,
I just checked back through some of the posts above and someone posted a fingerprint containing the ZLL profile (C05E) instead of the HA profile (0104) that my dimmer reports.
I have added this new fingerprint to the device handler on Github, please give it a go and see if you now get any logs.
I can only guess that the updated version changes the profile data.
To try it out please delete your dimmer and add again with the updated handler. The dimmer should be detected as “Tradfri Dimmer v0.2” when you search for it in the mobile app, otherwise something is still wrong.
Link to the updated code:

I can’t tell if anything else has been updated, let me know what logs you get and we’ll see.
Thanks,
Kris.

1 Like

Hello All,
As I wrote the original handler a long time ago I have now reviewed it and simplified it quite a lot. The dimmer will now work in more or less the same way as when paired directly with an IKEA bulb.

  1. Quick turns clockwise/anticlockwise turn the level to 0 or 100 straight away
  2. Slow turns adjust the brightness gradually. The change in brightness happens after you stop turning the dimmer, just the way it has to work for now.

After I add this device handler SmartThings detects my dimmer every time and it works perfectly for me.

In the posts above some people have not been able to pair correctly for some reason, I would be useful if one of these people can try the new handler and report back if it now works for them, and if not I need to know what entries they get in the log during pairing. You should see a device fingerprint similar to this:

Raw Description 01 C05E 0810 02 06 0000 0001 0003 0009 0B05 1000 06 0003 0004 0006 0008 0019 1000

This is important because if SmartThings does not detect the dimmer as “IKEA Tradfri Dimmer” then it will not be configured to report turning events, even if you change the device handler later.

The device handler works by timing how long you turn the dimmer for, and this happens in the cloud, so if you have a very slow internet connection it may be a little flaky. If people do have trouble with this I can provide a different handler that doesn’t rely on timing and just jumps the brightness up or down by a fixed % when you turn the wheel, maybe 25% each time, so you could reach 100% brightness by turning 4 times. But first let’s make sure everyone can get it working.

So, on to the code! I have posted the new device handler here:

As with the previous handler you can use this together with the Smart Lighting app to control your lights, instructions are in the posts above and in the comments in the device handler.

Hopefully someone can try this out and report back how they get on,
Kris.

EDIT: I just added a new minor update, adding a “Configure” button to setup the dimmer to report turns. If the dimmer is not detected correctly when you add it to SmartThings you can change the device handler in the API then click this button to setup reporting of turn events. Hope it helps those with pairing issues!

4 Likes

Thanks for your efforts. I have added the DH and updated my two dimmers remotely. Will see what happens when I get home later.

I may be asking for the moon on a stick, but is there any stray data coming back that could be the battery level? I get annoyed, too much I think, when the battery runs out while I’m in bed trying to turn my reading lights off :slight_smile:

Hello Peter,
Unfortunately I can’t seem to get any battery data from the dimmer, I have tried every way I can find but I never get anything from it. I was hopeful a few days ago when I tried the exact same way someone has used on the Ikea remote button, but still no luck.
I don’t have the Ikea hub so I’m not sure if it reports the battery level that way, if it does then in theory it should be possible to get it in ST…
I guess it was designed to directly control a bulb with no display, so perhaps they didn’t bother with battery level?
Let me know if you have any trouble with the handler, I want to try to get it working well for everyone.
Thanks,
Kris,

1 Like

Well, the first surpise (and maybe this is because I still don’t get how all this works) is that adding the DH stopped the dimmer working directly on the paired bulb even after repairing. I initially thought it was, ironically given my above question, the battery.

I added a virtual link from dimmer to bulb(s) but this seems to use the cloud and is so very slow to react. I may pull the DH and just go back to no handler and just let the dimmer drive the paired bulb direct for now - this is just a simple bed side reading light after all. I can see the benefit of using the dimmer DH as a real driver for other stuff though.

Hi Peter, I think you may have a different use case to the one this handler is trying to address. The idea for this device handler is that the dimmer is paired with SmartThings directly and not also paired with a bulb. The idea is to allow control of multiple bulbs (or other devices) at the same time from SmartThings, for one bulb your setup with direct pairing is just as good, or better even.
To be honest I only made this to see if I could, if it can be of use to someone else then so much the better :grinning:
I suppose this is the benefit and problem with SmartThings, there are so many options!

1 Like

This is perfect, paired fine and now I can control my Fibaro lights with the cheap Tradfri dimmer.

One thing (that I imagine isn’t possible but thought I’d check), is if it’s possible to change the light brightness continuously as the dimmer rotates, rather than waiting until the rotation has ended and basing the dimming on the time it was rotating for. According to the Smarthings docs, device.currentValue("level") returns:

the most recent value the device has reported to SmartThings. It is not calculated by polling or otherwise directly communicating with the device.

Is there a way to poll the device directly and repeatedly whilst the dimmer is rotating?

Hi guys I hope you don’t mind me chiming in as I’m a relative newbie.
Ive just bought some ikea bulbs and got them paired with ST. However I’d like to be able to control them in the room as well as via ST/Alexa. e.g. to dim or turn off the light in the kids room as we exit the room.

Am I able to buy the ikea dimmer and pair it with the bulb in that room without pairing the dimmer itself to ST, or will this lose connection between the bulb and ST?

You have to pair the dimmer and the bulb to Smartthings, but you don’t have to use the device handler. If i remember correctly the sequence is:

1: Pair bulb to smartthings
2: Pair dimmer to smartthings
3: pair dimmer to bulb. DO NOT reset either the bulb or dimmer between pairing with smartthings and this step.

so, to add a dimmer to bulbs already paired with smartthings start at step 2.

Tanks of the reply… Ive bought some dimmers and I see there is some code above but as a newbie I’m struggling to understand some of the terminology needed.

Would anyone be kind enough to point me to the instructions on where to install the code to make a start in getting the things working?

Or is there a way to pair the dimmer to St without using the code?

TIA

You can pair them without the code. Assuming your bulbs are already paired with smartthings…

First, reset the dimmer:

Then pair it with your smartthings hub. I can’t remember exactly how to do this, you may or may not need to hold down the button on the dimmer while the hub is in discovery mode. When discovered the dimmer will show up as a “Thing”.

Next, turn on the bulb you want to pair with the dimmer and hold the dimmer right next to the bulb while holding down the button on the dimmer until the bulb does it’s thing to indicate it is paired. The dimmer should now be able yo control the bulb, and the bulb should still work with smartthings. No need for any code.

The code comes in if you want to control other devices with the dimmer I think.

I’ll have a think about it and see if I can find a way to start dimming when the turn starts. When paired with the IKEA bulb directly the dimmer just sends these 2 commands:

  • Start dimming at x rate
  • Stop dimming

the bulb just carries on dimming itself slowly until it receives a stop command. I’m not sure how to replicate this in SmartThings, so the way I have done it is to time how long the dimmer is turned then work out how much to change the brightness.

Perhaps I could make it send a command to dim by 5% every x milliseconds during turning… I’ll have a play around when I have some time.
Anyway, I’m glad at least one person is using it :slight_smile:

Kris.

Thanks but unfortunately following those steps it just isnt showing up as a thing. ST says searching for devices but doesn’t find the dimmer. I’ll keep trying!

That would probably be better. The tradfri dimmer is a bit of a cheat, it’s really just a switch rather than a rotary encoder but I guess it is only £8.

According to the smartthings docs, you can’t create new threads, or sleep the main thread, but presumably you can manually ‘sleep’ the thread with a while loop unless the runtime environment then kills the thread for using lots of CPU.

RE: making the dimmer work directly to the bulb without needing ST to do the interpretation

I’ve managed to make this work with the 5 button remote but the rotational dimmer just won’t play at all. @Cris_Lowis were you able to make this work?

So I had absolutely no success pairing the rotational dimmer directly to ST. The dimmer wouldnt even light up as if it was trying to pair. However I did use touchlink to pair it with hue that in turn did show in ST as a thing.The probelm was I could try it 5 - 10 times before it might show up.

In the end I gave up and went with the ikea hub and software and will control them via alexa.
I really wanted it to run through ST so I could use a single app (actiontimes) running on a tablet by the door.

For the time i’ve spent i wish i just paid the extra and got more Hue tbh

I I stumbled across this post and thought “I’ve got one of those!” so I decided to give it a go.
Starting at your first post I have tried quite a few of your iterations of the code and couldn’t get any to work. Finally I got to post 64 and I can confirm this works beautifully. Well done.
Could you put an update in the first post to point out the latest code to save some time?

Now I just need to work out how I want to use this thing!

Perhaps a bit out of topic here but, is anyone else having battery drain issues with these Tradfri dimmers? I have only one that is paired directly with the bulb, and not with ST, and each new battery lasts about 2 months or so, with very little use of the dimmer itself. I think the issue might be that the bulb is normally turned on and off with a normal (i.e. non-IOT) wall switch, and my theory is that while it’s off perhaps the dimmer uses more battery trying to communicate with the offline bulb… does that make any sense?

I basically want to keep using the wall switch for turning the bulb on and off when I enter or leave the room, and only occasionally use the dimmer to change the amount of light as needed. If there’s a better setup (e.g. both bulb and dimmer paired to ST) for this scenario then I’d like to know about it.