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):