Level Control ZigBee device help needed


(Jack) #1

Hi,
I am currently working on trying to get a device to respond to level control sent form the Smartthings app. However I am having difficulty understanding some concepts about this capability. So I wanted to know what the difference is between each of the following commands for this capability.

COMMAND_LEVEL_MOVE_TO_LEVEL
COMMAND_LEVEL_MOVE
COMMAND_LEVEL_STEP
COMMAND_LEVEL_STOP
COMMAND_LEVEL_MOVE_TO_LEVEL_WITH_ON_OFF
COMMAND_LEVEL_MOVE_WITH_ON_OFF
COMMAND_LEVEL_STEP_WITH_ON_OFF
COMMAND_LEVEL_STOP_WITH_ON_OFF


(Scott G) #2

For reference, this ZigBee cluster library doc covers the vast majority of the basic ZigBee spec, and it can be supplemented with the Home Automation and/or ZigBee Light Link docs depending on the device. (Level Cluster starts on page 125 and details each one of these including the payload format and components)

Let’s tackle these anyway…I’ll use a “dimmable light” as the example since it’s the most common.

Move_to_level - this command tells the light how bright you want it to be and how fast/slow you want it to get there by sending a level (00-fe) and a transitionTime (0000-fffe) (be careful as ZigBee is little endian IIRC). The light will go from its currentLevel to the new level over the time specified.

Move - this command simply tells the light to get brighter (Up direction 00) or dimmer (Down direction 01) and the rate you want it to transition (00-fe) in units per second.

Step - this command tells the light to get brighter/dimmer by a prescribed amount over a set time. Similar to move_to_level, but instead of denoting the end brightness, you tell it how much brighter/dimmer you want to go. This has 3 pieces: direction (00 for Up, 01 for Down) step size (how much to move level) and transitionTime (how long to take).

Stop - this command simply stops any move_to_level, move or step command currently in progress at whatever the currentLevel is.

The next four on/off variants are identical to the above except they also interact with the on/off cluster of the device, so if you choose level 00 (lowest brightness possible), the light will also turn “off” the attribute in the on/off cluster. Likewise it will turn “on” the attribute in the on/off cluster for any level command that increases currentLevel. The most common command in lights is the move_to_level_with_on_off. Move, step and stop are generally integrated into remotes.


(Jack) #3

Thanks for your reply. I also have another question which is the following.

When the ZigBee Dimmer template does zigbee.setLevel(value), which one of these commands does it use? Also what value(s) is this command sending to the ZigBee device as like in (zigbee.on is equivalent to zigbee.command(0x0006, 0x01 where 0x01 is the value being sent)?


#4

zigbee.setLevel uses the COMMAND_LEVEL_MOVE_TO_LEVEL_WITH_ON_OFF command. If you want to use something else, you’ll have to use the zigbee.command manually.

I think they send this command where myLevel is between 0 and 100.

private getCLUSTER_LEVEL() { 0x0008 }
private getLEVEL_CMD_MOVE_TO_LEVEL_ON_OFF() { 0x04 }

def setLevel(myLevel) {
     myLevel = ( myLevel < 100 ) ? myLevel * 2.55 : 254
     return zigbee.command(CLUSTER_LEVEL, LEVEL_CMD_MOVE_TO_LEVEL_ON_OFF, zigbee.convertToHexString(myLevel,2) + "ffff")
}

The additional ffff means to transition based on the default set transition time. GE ZigBee Dimmers for example do not allow that setting so the ramp is instant, where Sylvania (OSRAM) have a value set.