OSRAM RGBW Bulbs Group & Virtual Control

Okay, so I am getting started with SmartThings after just playing around and poking at them. Let me first say that I’m a software developer by trade (funny enough I use Java and Groovy all day long) and so far I really enjoy what I have seen in SmartThings.

However, that said. I’m running into some stumbling blocks. Let me begin with the overall concept and then offer up the current working versions of my Device Type Handler and SmartApp. I’m stumbling over controlling the color of the bulbs.

Overall, what I am looking to do, is to control multiple OSRAM RGBW 5/6 Bulbs with a single device. I figured the best way to approach this would be to create a Virtual device type handler and a SmartApp that relays the events to the bulbs.

The first part, the virtual device type handler is based on the existing ZigBee RGBW device type handler. I’ve basically gutted it and wired it to sendEvents. The first thing that I’ve struggled with was “setColor” and initial state of the device, then later about what data to pass along. Take a look at the comments in the code to see what I attempted and what I’ve ended up doing (hint: just passing along hex value and nothing else).

The second part, the SmartApp, is very simple and straight forward. Everything works fine, minus setting the color. I somehow thing this is related to the fact I was only able to pass along the hex value from the device type handler. It really seems like I’m having to do a lot more work than I should have to (converting hex to HSB and such). Again, the comments in the code show the evolution of what I’ve tried.

Anyone out there familiar with setColor and the OSRAM RGBW bulbs willing to give me some pointers or tips?

The lack of accurate documentation, fragmented code all over GitHub and untold number of versions posted in the community forum really makes the process of getting accurate information confusing and frustrating. I suspect this is my main problem, and lack of experience with SmartThings.

Here is the code in question:

Device Type Handler
https://gist.github.com/joshua-moore/ddcd97d6bffc336e9263

SmartApp
https://gist.github.com/joshua-moore/92d686da0a75554e9f0a

Great job paring down the devicetype…Part of the ‘event’ object is a Map called data that you could use to pass the extra setColor() parameters as part of your ‘color’ event.

So in your virtual device you could have:

setColor(value) {
sendEvent( name: “color”, value: value.hex, data: value)
}

Then in the SmartApp your color handler can just pass the data map via

slaves.setColor(evt.data)

I think that’s all you would need. Haven’t tested it myself though.

You can’t pass the whole color map in the value parameter because it’s only expecting a string for the color attribute. The color attribute is typically only used to define the position of the cursor in the color picker, which is probably why the app crashed when you passed the whole map. Hue and saturation are usually used to actually set the color in the bulb, particularly for zigbee.

It looked like you also noticed that the color map always passes level: 100. That’s a quirk of using the color picker. Most devicetypes will ignore that key completely or overwrite it with the current value of the level for the device. That’s how you get current attribute states: device.currentValue(“level”) not currentState.

BTW, it’s all open source and we all borrow code and learn from each other, but attribution comments are pretty standard.

2 Likes

Thank you for the kind words. I plan on attributing all the fantastic authors that I’ve borrowed from if I could keep track of where it all came from. In the end, when I do make this public I will make sure to give credit where credit is due (here’s looking at you kid!)

I’ll give this a try when I figure out why publishing smart apps doesn’t seem to be working for me.

Thank you again! Really excited to start helping out with as much as I can around here :smile:

1 Like

Good to have you onboard, especially having the groovy background!

The API documentation is getting better, but there’s still a lot incomplete. The community does a pretty good job filling those gaps.

1 Like

@JoshuaMoore any updates for this? I would love to use this with my Osrams too!

Yeah, I’ll get it posted up to Github / Gist later tonight and you can use it too.

@lanek99 Here are the virtual device and smart app that I have been using without any issues:

3 Likes

Going to check it out now. Really appreciate the work you put into creating this. I will let you know how it goes!

@JoshuaMoore The smartapp and virtual device are working great. I’ve only setup one group in my basement which consists of a A19 RGBW bulb and a flex strip. I still have 3 other groups to setup in the house, but don’t think there will be any issues. Thanks again for this!

@lanek99 No worries. Glad it’s working for you too!

I was looking at using this for my new OSRAM flex RGBW Indoor/Outdoor Strips in my kitchen but couldnt make it work fully. If I used the default handler it would pair and run all sets via the smartapp just on and off though no color/temp/brightness settings.

If I add the device handler and assign it then it doesn’t work at all. I used the handler on all 3 bulbs. Is that correct or should I be doing something different?

Nevermind, figured it out.

  1. Add the virtual Device code under “My Device Handlers” and publish it.
  2. Add the smartapp code under smartapps and publish it.
  3. Add a new device under “My Devices” that uses the virtual device handler. Just make up a network ID and name etc…

4… Add the smartapp under “Marketplace” -> “Smartapps” -> “My Apps”

Configure the smartapp by Assigning the virtual device as the master, and the real light strips as slaves.

Control all 3 from the fake device that uses the virtual handler.

One thing I note is when I set a color the light level is always dimmed.

2nd thing, when I use it in a smartapp like smartlights it doesnt turn off…

I was hoping to use the virtual device and smart app for grouping Osram Tunable White bulbs, but my tunable white bulbs don’t appear as options when selecting the slave devices. I’m not very experienced with code so I’m wondering if there is a simple adjustment I can make in the code to allow for selection and control over the Tunable White bulbs instead of the RGBW bulbs? Any help would be great! Thanks!

The tunable white bulbs won’t be detected because they lack the Color Control capability:

http://docs.smartthings.com/en/latest/capabilities-reference.html#color-control

You can remove that part from the virtual bulb definition and then change the slaves section of the bulb grouper definition to have the the Color Temperature capability instead. I just tested that on a pair of tunable white bulbs. The other attributes (brightness/temperature) can be controlled this way.

Following that approach, I think it would be possible to write a hybrid group definition to handle both types of bulbs from the same virtual master device. You’d have to write a dummy function so the hue and saturation would simply have no effect on the tunable white bulbs in that case. Kludgy, but it would allow for a global brightness/temperature control.

Now I’m wishing I had just spent the extra money on RGBW bulbs for that one room…

I’m using this grouping smartapp with the default Zigbee RGBW bulb. However, I can set everything except for the colour of the lights.

Any thoughts?

I don’t recall if I had used this app at the time but I did find an app that allowed you to make one bulb a “Master” and the rest slaves. I think it was two device handlers and an app. What you did was set the color of the master bulb and the slaves followed suit. I don’t set color that often and I didn’t like the interface of the app so I am not doing that now.

I used CoRE to achieve this for my Osram Gardenspot Minis. Here is a link to the Piston I used :

Thanks for the link. From what I see you are automating your lights to change colour randomly. I love it… but that’s not what I’m trying to do. I want to pick a mood (let’s say a blue light) and have both lights change at the same time.

That doesn’t seem to be what your code would do. If I’m understanding it correctly.

I want to sync level, hue, saturation and colour temp.

I might be able to do 4 different CoRE pistons to make this work, but that’s pretty tedious.

I assume you mean a smartApp? Yes, that’s basically what this is, but it doesn’t seem to be working for me. The colours don’t sync right.

If you could remember what smartapp you were using that would be great!

I believe this was it:

I posted at 19 and 20 about how I used it. Not positive this was it, I tried 2 but I found them both here.

The suck part is I searched for my name on the forum and these didnt even turn up so no shock I can’t find both

What I remember is one bulb was designated the master and the reset were slaves to is to they followed suit when the master was set to whatever.