Tradfri LED RGB bulb

Wise choice!

@mike.maxwell

Any progress to native Tradfri RGB support?

I found this comment here on the import line:

Change is to com.hubitat.zigbee.DataType

I'm not sure exactly where to put that. If I make it: import com.hubitat.zigbee.DataType, I get an error
"Expression [MethodCallExpression] is not allowed: com.hubitat.zigbee.DataType.isVariableLength(attrType)"

Taking out the "import" line makes the driver save, but the bulb doesn't appear to change color. Perhaps somebody with actual coding knowledge knows what's wrong here?

It's safe to take that line out. The reason the bulbs don't change color is the HE drivers are not compatible with the CIE XY color space the IKEA Trådfri bulbs use. There needs to be a mapping between HSL and XY that isn't there right now.

You can use them with Hue Bridge. They support the mapping, but the Hubitat Hue Integration driver unfortunately needs the same change, so the color can only be changed by the Hue bridge. I'm controlling color from Hubitat by using Google Assistant Relay to sending color names silently to the Hue bridge. It's hacky, but works.

I thought the whole purpose of the driver is to do the CIE XY color mapping. Is that not what it's doing?

That’s not how the other bulbs work. Trådfri are different.

What driver are you talking about? The one you posted above is for an Iris fob, and has nothing to do with lightbulbs as far as I know

Ah, I see. Some miscommunication here. Let me clarify.

aaron posted a link to a ST DTH driver for the RGBW bulbs. This driver looks to translate CIE XY to hue/satuarion. The problem when he tried to use that driver was the import line on the ZigBee info. This line: import physicalgraph.zigbee.zcl.DataType

I searched for that line and found the thread on the Iris smart button, where it was mentioned that instead of import physicalgraph.zigbee.zcl.DataType one needs to instead use com.hubitat.zigbee.DataType. When I tried to use that, it gave me the error I mentioned above. I'm hoping somebody with more knowledge on all these things can figure out what the problem is, because it seems to be really close.

I have the same error with another driver, have you been able to sort it out?

try import hubitat.zigbee.zcl.DataType again. Previously it was giving an error, but I used it yesterday when installing a ST driver and thought I would leave it in just to see what happened. I didn't get an error this time. Maybe a change to the HE platform was made to accept that now.

1 Like

With import hubitat.zigbee.zcl.DataType I have the message unable to resolve class hubitat.zigbee.zcl.DataType

With import com.hubitat.zigbee.DataType I have Expression [MethodCallExpression] is not allowed: com.hubitat.zigbee.DataType.pack

Oops. sorry. I just looked and it was different (a contact driver) and it was using import hubitat.zigbee.clusters.iaszone.ZoneStatus

Different animal. Ignore me.

I bought the 403.652.67 400 lumen E12 bulb, and also the 204.115.62 600 lumen E26 bulb.

Both paired with no issues, and using generic zigbee drivers I was able to get both to perform on/off/dimming.

The E12 bulb is really bright for a E12 bulb!

The E26, no matter what driver I did, I could not get RGB functionality. I didnt see this post until after I bought them, but its a bummer that they dont have any out of the box RGB functionality. I returned them today, but can confirm they both work! Minus rgb on the E26.

1 Like

I wasn't, unfortunately.

Has anyone had any luck getting the color function to work yet? These bulbs looked slick when I was picking up a Tradfri repeater.

The CIEXY color space isn't supported at this time. They only work with a Hue Bridge, but the color cannot be controlled via the Hue Integration because that driver also doesn't support that color space. I have one and change color from HE in a very round about way. Randomly.
I have a rule that has all the possible colors in the speech dialogue and randomized. They're prefixed with [CC] so my Google Assistant Relay integration tells the Hue Bridge to change to a random color. The same thing is possible with a single color of course.

Any possibility of that color issue resolving itself in the future?

By the way, the Ikea Tradfri bulb is now $9.99 (Can):
https://www.ikea.com/ca/en/p/tradfri-led-bulb-gu10-400-lumen-wireless-dimmable-warm-white-60365266/

Ive not tried all the IKEA bulbs, however the full color ones I have tried aren't capable of rendering anything close to a decent green, so due to this and also not providing commands for hue, saturation and color temperature, they are at the bottom of the list to deal with.
It's obvious that the inexpensive price of these is associated with the lack of a typical color control command set...

There's no free lunch to be found here...

Yes, the 400 lm GU10 and E12 have always been this price I believe. The 1000 lm E26 at $13.99 CAD is not a bad deal. I just ordered a Sengled A19 for $12.99. Not at bright but not needed for the closet I'm putting the bulb in.

However, it's Zigbee HA and it just occurred to me about an hour ago that the Lutron Connected Bulb Remote I was planning to use with it is Zigbee LL, so it's probably going back and I'll pickup the Trådfri E26 instead.

QC also spotty. I have had to return a few with radios that were DOA.

TL;DR
I hacked puzzle-star handler/driver I got something to work. Modified driver can be found @ Hubitat IKEA Tradfri RGB bulb driver · GitHub

I took puzzle-star's ST handler/driver, changed the import to import com.hubitat.zigbee.DataType and I managed to successfully save the driver.

When using the device I can turn it on and off and change the brightness - so far so good. However when I try to make a color action, let's say onBlue nothing happens. In the logs I get the following line

error java.lang.NullPointerException: Cannot invoke method div() on null object on line 521 (onBlue)

What's weird is that nowhere in the source I see a call to div() and onBlue is on line 494 and looks like this:

def onBlue() {
  def rgb = getCurrentRGB()
  if(state.lastBlue) setColor(rgb.red, rgb.green, state.lastBlue)
}

Can I get the whole exception stack somewhere?

Edit:
Even when I use other commands, I see the exact same error description, e.g.
error java.lang.NullPointerException: Cannot invoke method div() on null object on line 521 (offRed)
error java.lang.NullPointerException: Cannot invoke method div() on null object on line 521 (onRed)

So I guess that div() call on line 521 is a reference to some place in Hubitat's source code.

Edit2:
I tried testing setting the color from the color wheel, and I got the following error

error java.lang.NullPointerException: Cannot invoke method rgbToHex() on null object on line 415 (setColor)

I imported import hubitat.helper.ColorUtils and changed colorUtil.rgbToHex and colorUtil.hexToRgb to ColorUtils.rgbToHEX and ColorUtils.hexToRGB and made some progress. Now the error I get is:

groovy.lang.MissingMethodException: No signature of method: static com.hubitat.zigbee.DataType.pack() is applicable for argument types: (java.lang.Integer, java.lang.Integer, java.lang.Integer) values: [24455, 33, 1]

Edit 3:
I looked a bit around the docs and found zigbee.convertToHexString method. I manually swapped the bytes to encode and replaced usages of DataType.pack() with zigbee.convertToHexString() and it's working!

Well, different actions like onBlue, offBlue, setBlue are still failing because div() is called somewhere on a null object, but setColor is working and bulb is changing color. There is a message received after color is set, and there is a warning:

warn DID NOT PARSE MESSAGE for description : catchall: 0104 0300 01 01 0040 00 7FDC 00 00 0000 0B 01 0700

So it's hacky and dirty, but hey, it's somewhat working. Code is @ Hubitat IKEA Tradfri RGB bulb driver · GitHub

2 Likes