[OBSOLETE] Enhanced Zigbee Hue Bulb - Direct Connect to ST

I’ve been playing with the other features of the Hue bulb, and I’ve updated the deviceType in a new branch on GitHub (enhanced features branch) adding a bunch of stuff that zigbee does natively in ZLL and providing greater flexibility. The additional custom commands can be called from custom SmartApps. I plan to create enhanced versions of other zigbee bulbs and a set of SmartApps to take advantage of the new features, so please let me know what you want to see.

BIG NOTE: This devicetype is intended for and tested only with directly connected Hue brand color bulbs. Some or all of the features should work with other directly connected zigbee RGB(W) lights. Hue Lightstrips should work well; but colors may be inconsistent due to color gamut differences. Everything except color temperature for white should also work with most non-traditional Hue lights like Bloom. Feel free to test other bulbs/lights and let me know what works or doesn’t work.

What’s new?
New features:
Color loop - bulb starts looping continuously through its hue values based on selected parameters. Reverts to previous color when stopped. Optional parameters can be sent in a Map to control the loop. Accepted parameters are: direction - Up or Down string is direction to loop through hue values (defaults to current loopDirection attribute or Down if not set), time - number in seconds for a full loop to occur (defaults to current loopTime attribute or 2 if not set), hue - starting hue value for loop (defaults to current hue value).
Note: bulb uses current saturation. Higher saturation gives greater appearance of diversity in loop. If the bulb is set to white, it may not appear to be changing much.

Alerts - predefined bulb actions that can be used to alert/notify

Enhanced features:
Timed on - on() command now accepts an optional parameter for onTime, which is the number of seconds before the bulb will automatically turn off. For instance, on(300) would turn the bulb on for 5 minutes then turn off without any other action. Useful for delayed off commands triggered by events without complex SmartApps.

More flexible transition times - Made duration (in tenths of a second) an optional parameter in every color, hue, level set command with defaults that reflect the commonly used values. For instance setLevel(99, 18000) would transition to level 99 from current level over 30 minutes (18000 tenths of a second = 60 * 30 * 10). Useful for gradual dim up/down at hardware level or slow transitions between colors for effects. Gentle Wake Up now takes one command and can be cancelled easily by turning the bulb off.

New UI controls:
Added controls for color loop functionality. Button to start/stop loop and shows Active or Inactive status of loop. Slider to control the loopTime attribute from 1 - 60 seconds for a full loop. Longer times are acceptable, but 60 is a very slow transition and keeps slider manageable. Button for loopDirection to flip looping direction. Changing time slider or direction while loop is active will instantly update that parameter in loop, otherwise it just sets the value for the next loop.

New command details:
toggle() - simple command to toggle the light state using the basic toggle zigbee command

alert(action) - causes the bulb to trigger alert effect based on action string. Acceptable actions are: Blink - single dim down/up then return to current state, Breathe - constant blinking for approx 15 seconds, Okay - bulb turns green for 1 second then return to current state, Stop - ends any current alert action (mainly used for breathe)

startLoop(Map params) - starts the loop using current attribute values or the passed parameters. params contains keys direction, time and hue to set the color loop parameters. Actuating from tile button will use current attributes for parameters. Note: turns bulb on() in case it’s off, but does not change hue/sat. Color loop experience is best with a high saturation non-White color as the starting point.

stopLoop() - stops the loop and refreshes the device to update the tiles

setDirection() - toggles the loopDirection attribute between Up and Down. If the color loop is active, it immediately updates this parameter causing loop to reverse direction.

setLoopTime(value) - sets the loopTime attribute to value in seconds. If the color loop is active, it immediately updates this parameter causing loop to slow down or speed up depending on time value passed. Updated via slider in UI.

Here’s the code (please note the branch for this device is not master):

13 Likes

I think you’re going to convince me to completely ditch the Hue Bridge…

Will this work with the Osram Lightify RGBW bulbs?

All of the basic functionality should work with the Lightify bulbs, but they don’t sell them in the US yet, so I can’t test the new features. Out of the box, I expect all of the transition time stuff to work.

There was an issue with the color loop feature in the Gardenspot lights where it will only do one loop then stop. That can be fixed via firmware update by the Lightify gateway, so I would say color loop won’t work out of the box. It may work if the bulbs are firmware updated with the Lightify gateway and then re-paired to ST.

The alert options and timedOn() are wild cards. Both are part of the ZLL spec, but I believe they are optional.

Menards has then for sale, some stores are even showing some in stock for 40 bucks a piece. Amazon shows out of stock

Thanks! Osram told me early 2016, and I was keeping tabs on Amazon.

No Problem, I was surprised when I got the email blast from them.

This works fine with Lightify RGBW, Installed and tested your software today, I’m in the UK…Colour loop works but as stated only goes through once, i’m getting a gateway so i can update firmware, just thought i’d let you know it works with Lightify…

Hi

Working with my Hue Light Strips direct connected. I haven’t used it in a scene or anything yet but the direct controls work well. The circle under the K temp is blank.

Thanks

Which tile? Below K temp is Refresh, then a tile for the color loop direction (Up or Down). The loop direction tile may be blank until it’s pressed.

It must be the refresh tile. It has no text. Just a gray circle. I have noticed I can’t get it to respond in smart apps like rule machine. I understand this is just a test device but should it work?

Thanks

Absolutely it should work. Refresh is a pretty basic ST tile. It polls the bulb for its status.

Are you US or UK? Android or iOS? Thanks for reporting!

Hi

US… Android…5.0.2. Same on two different devices. Everything else seems to be the same except the colors are wrong. And the refresh button works, I was asking more about smart apps. For example, in rule machine I can set some basic colors but it doesn’t seem to respond .

Thanks

It should work with Rule Machine color setting. I’ll try to test it soon myself. If you get a chance to capture live logs when Rule Machine tries to set the color, I’d appreciate seeing if an error is thrown.

Thanks again!

I hope this is what you wanted… Let me know what else I can do to help.

Thanks

b2a2ef8f-cc6b-4c55-894e-2c2f5613cf14 6:16:14 PM: info Livingroom Lighting With Motion (Music) is False
b2a2ef8f-cc6b-4c55-894e-2c2f5613cf14 6:16:13 PM: info Livingroom Lighting With Motion (Music): Motion Sensor Couch motion inactive
9cbf5099-7a51-4b55-b692-43c2252ccfb0 6:16:14 PM: error groovy.lang.MissingMethodException: No signature of method: script1451179694329552837350.zigbeeSetLevel() is applicable for argument types: (java.lang.String) values: [ff] @ line 464
9cbf5099-7a51-4b55-b692-43c2252ccfb0 6:16:14 PM: debug color name is : Han Purple
9cbf5099-7a51-4b55-b692-43c2252ccfb0 6:16:14 PM: debug hue value is 252
9cbf5099-7a51-4b55-b692-43c2252ccfb0 6:16:14 PM: trace setColor([hue:70, saturation:100, level:100])
b7b97dd8-6f28-447a-97b5-d6b1f5d21684 6:16:13 PM: error java.lang.StringIndexOutOfBoundsException: String index out of range: 184 @ line 273
1600ca54-ff05-4699-a8a5-e01c6d90ebde 6:16:13 PM: info Livingroom Light With Motion (Cable): Motion Sensor Couch motion inactive
b7b97dd8-6f28-447a-97b5-d6b1f5d21684 6:16:06 PM: error java.lang.StringIndexOutOfBoundsException: String index out of range: 184 @ line 273
b7b97dd8-6f28-447a-97b5-d6b1f5d21684 6:16:05 PM: error java.lang.StringIndexOutOfBoundsException: String index out of range: 184 @ line 273
b2a2ef8f-cc6b-4c55-894e-2c2f5613cf14 6:16:00 PM: info Livingroom Lighting With Motion (Music) is True
b2a2ef8f-cc6b-4c55-894e-2c2f5613cf14 6:15:59 PM: info Livingroom Lighting With Motion (Music): Motion Sensor Couch motion active
9cbf5099-7a51-4b55-b692-43c2252ccfb0 6:16:00 PM: error groovy.lang.MissingMethodException: No signature of method: script1451179851329552837350.zigbeeSetLevel() is applicable for argument types: (java.lang.String) values: [ff] @ line 464
9cbf5099-7a51-4b55-b692-43c2252ccfb0 6:16:00 PM: debug color name is : Red
9cbf5099-7a51-4b55-b692-43c2252ccfb0 6:16:00 PM: debug hue value is 360
9cbf5099-7a51-4b55-b692-43c2252ccfb0 6:16:00 PM: trace setColor([hue:100, saturation:100, level:100])
b7b97dd8-6f28-447a-97b5-d6b1f5d21684 6:16:00 PM: error java.lang.StringIndexOutOfBoundsException: String index out of range: 184 @ line 273
28f96c1c-35f8-44fd-8750-5e4b275f1f37 6:15:59 PM: trace triggeredRecently(7cccfc65-cd18-4ac2-8170-a08bafe847d5): false, lastTrigger: 1451343426860
28f96c1c-35f8-44fd-8750-5e4b275f1f37 6:15:59 PM: trace intrusionHandler(motion: active) - away

1 Like

Thanks Paul! This was a bug in the setColor() command when a level value is passed. Fixed and updated at the link in first post. Please let me know that it is indeed fixed for you as well.

Yep… seems to be working better. Thanks! And I think the refresh icon issue is with my tablet because it shows fine on my phone. Both Samsung (go figure?) Any way to add the cycle on/off function to smart apps? It would be cool to start that when music is playing.

Thanks

Expert features portion of Rule Machine should be able to call any of these custom commands thanks to @Mike_Maxwell.

I’ll be putting together a SmartApp in the next couple weeks specifically for these extra features as well.

Looks like I need to update. Looking forward to your app. Thanks

I keep getting this error in the logs when I press the refresh or any other buttons.

groovy.lang.GroovyRuntimeException: Ambiguous method overloading for method java.math.BigInteger#.
Cannot resolve which method to invoke for [null, class java.lang.Integer] due to overlapping prototypes between:
[class [I, int]
[class [B, int]
[class java.lang.String, int] @ line 503