[OBSOLETE] IKEA Trådfri Bulb Device Type

Stupid vocabulary on my way out from work.
I meant you just need to make sure that the GitHub structure (folders and filenames) is correct.

I didn’t have any problem with the temperature updates on the bulbs when sending 6500K. They fall back to 4000K. The issue I raised was only with the app. It displays the temperature as 6500K eventhough it was set to 4000K. Clicking refresh displays 4000K.
Thanks for publishing the new version. I updated to the new version. Will test it tomorrow when the colour temperature piston executes :slight_smile:.

Might just be me remembering incorrectly

This is a question not necessarily aimed at your DTH at all, but as a bit of a learning thing I’m trying to extend the functionality of the DTH. I’d like to be able to get the “colorName” value using a function, but I don’t want to pass it through as it’s something I want to trigger from CoRe.

As I said, this is me experimenting, I will share the code once done but probably not even an ideal way of doing it.

EDIT: I hate it when that happens - spent an hour on working it out; then found the “state” variable. Does exactly what I need.

I can confirm the new update works exactly as I expected. Thanks very much for the fix.

@Edvald, I think there is some problem with the device handler working with the brightness slider. I have posted in the other Tradfri thread, but since then I tried with the stock “Zigbee colour temperature bulb” and don’t see the problem with this DTH. The problem is described in the below link.

Great DH, I Love the self adjusting temperature. I also noticed the temperature issue. When i have the bulbs turned on as a switch via some other smart app or the ST mobile app, the temperature always gets set to 2200K. It seems like it needs the setlevel command to change the temp aswell.

If i understand Sapstar, My problem is the opposite. My problem is when turning on ad a switch. And Sapstars is when turning on with the slider?

@Arnqvist Which one of the below represents your problem?

  1. You turn on using a switch and set colour temperature 4000K for example, then you see it falls back to 2200K?
    or
  2. You had it set to 4000K before, you just turned it on as a switch and expect it to be 4000K, but it is now 2200K.

If your issue is same as Number 2, this is something I have called out in my post in the last line. The colour temperature seems to fall back to 2200K after the light is turned off (sometimes). I don’t see this happening with the Zigbee DTH.

I don’t usually see the problem turning on as a switch because, I have a CoRE piston which sets the bulb to a specific temperature depending on time of the day. My problem is that depending on how I turn it on, this colour temperature value sometimes sticks and some times falls back.

My problem is like number 2, but only if i dim it down to zero then turn it on as a switch. If i switch it off then on (as a switch), it remembers temp and dim level. Im guessing this DH sets the temp to 2200K when below certain dim value. And dim to 0 then sets the temp to 2200? And switch.on does not tell it to change temp?

Yes this is correct, the dim level and color temp is connected(you can disable that) and dimming it down to 0 will result in it setting the color temp to 2200k and if you just switch it on it should stay there, the level should also be like 1% or something but the level part is done by the bulb not by the DTH

It might actually make sense not to touch the color temp when level is set to 0 but either way since turning on something that was at 0% will result in it being set to 1% that will still cause the color temp to be set to something like 2203K or similar

Hmm, i just did some additional testing and it seems as though turning off the bulb by setting the level to 0% and then pressing the On switch in the app will set it to the level that it was previously but the color temp still being the 0% equivalent(might be that the 1% thing was a fluke) so I’m going to change the code and if i get to work better i will update in github

Trying to understand what the issue is.
Given that you have level and color temp linked in the preferences, if you set the level to 100% it will result in the color temp being set to 2700K and it should stay there. Is the issue that it doesn’t stay at 2700K or that it’s set to 2700K?

You mentioned that when turning off the light the color temp sometimes get set to 2200K, are you turning it off with the On/Off switch in the app or with a real light switch i.e. cutting the power or by setting the level to 0%?

On/Off switch in the app should not do anything to the color temp or the level unless you had the level at 0% and in that case the bulb will turn on and set it self to 1% which makes sense since you wont know it’s on if it stays at 0%

Setting the level to 0% will result in the color being set to 2200K right now(i might change this)

Yes thats exactly my problem, looking forward to a fix though i can live with the current version.

Really sorry. This may be a non issue. I didn’t realise that there is a link between level and colour temperature in preferences. I will see disabling this now.

Just retested by disabling the link in preferences and still behaves the same. I have taken some screenshots earlier to demonstrate the issue. This is still valid.

Works:
Below are some screenshots:
Turned on light using the on button in ST app at 8:19PM
webCoRE set colour temperature to 2700K
Turned off using the button in ST app
This works fine.

Doesn’t Work:
Turned on light using the brightness slider in ST app at 8:22PM to set brightness to 7%.
webCoRE set colour temperature to 2700K
Brightness changed to 2237K automatically.
This doesn’t work.

Manually increased brightness to 4000K when light is on.
Turned off bulb by setting the brightness slider to 0%.
Colour temperature changed to 2203K.

I changed all of my routines on one of my IKEA bulbs to turn on and off instead of increasing and decreasing the brightness. I see no problems with this setup now. I have the second one set to different brightness levels at different times. So still having issues.

Im guessing that we are talking milliseconds between these events and it makes sense if you have level and color temp linked, if you turn the slide to 7% the bulb will dim to that level and that might take 200 milliseconds or something and after that it will change the color temperature to the temperature that it calculated based on the level. If your CoRE changed the color temperature right after it detected a level change then the DTH will still run it’s color change and that might occur after CoRE did it’s thing.


This is how it’s coded at the moment but i have a local version that doesn’t touch the color temperature when level is set to 0% and when i have tested it a bit more i will publish the changes.

I have tried the following.

  1. I disabled the link between colour temperature and brightness in preferences. Still it behaves as if they are linked. No change from before.
  2. I changed the code line 48 to modify default value to “false”. This didn’t make any difference.
  3. I commented line 48, 151-158 and 161. The colour temperature and brightness are no more linked. The colour temperature values now remain set to what CoRE has sent and also when I turn it off.

seems like ST will delete the linkLevelAndColor if it’s set to false and i DTH hasn’t defined it as required, i just did a quick test and changing “required: false” to “required: true” at the end of line 48 seems to solve it, i used to have it like that but changed it and i don’t remember why =/

Just tried with required: true, but still doesn’t work for me. Only way it worked was by commenting a few lines as I posted in my previous post.

Sorry, also change line 151 from

if(linkLevelAndColor ?: true){

to

if(linkLevelAndColor ?: false){