Zwave association is actually very simple.
The trigger device is given permission by the hub to send “basic” commands directly to a specific target device without having to tell the hub about it or go through the hub.
“Basic“ has a very specific meaning in zwave. We can discuss what it is if you want, but it’s not important to know the details. But just think of the most basic function of a device class. For an on/off switch, that’s turn on if you are off, turn off if you are on. For a multilevel switch like a dimmer, there will be a level value sent along with the basic command to tell it what level to go to.
A trigger device will be given permission to send the basic command to up to five target devices.
The target device actually won’t know anything at all about the fact that the association was set up. It just gets a command over the network and then it acts on that command.
The trigger device will just keep a list of the device IDs of the target devices that it has been given permission to send a basic command to.
Use Cases
The classic use case for Z wave direct Association is having a motion sensor turn on a light. usually you want this to be super quick, so with z wave association as soon as the sensor detects motion it can send the basic command straight to the light switch without having to go through the hub.
This is a fairly primitive action. There’s no if/then filters that you can put on it, no time of day, no additional conditions. It’s just detect motion, send the basic command.
Another popular use case is for the auxiliary switch in a two-way set up (called a three-way set up in the US). In this situation the auxiliary switch is the trigger device and the master switch is the target device. Turn on the auxiliary, it sends a basic command directly to the master so it also turns on. Turn off the auxiliary, the master turns off.
Association Groups
A trigger device will be allowed to have multiple “association groups“ so it can send out a different basic command under different conditions. It’s just up to the manufacturer, they might only have one association group, they might have a dozen.
For example, the Aeotec multisensor seven has 11 association groups.
Product Association Capabilities
They use association group 2 to hold the list of device IDs for the targets that will get a command when motion is detected.
They use association group 3 to hold the list of device IDs for the targets that will get a command when the temperature is higher than a parameter set by the device owner.
They use group 7 to hold the list of device IDs for the targets that will get a command when The measured light level is higher than a parameter set by the device owner. And so on.
But note again that the target devices have no idea they are even in this group. And the only thing the trigger device is keeping is the list of IDs by association group. it’s a really simple structure.
And it’s up to each device manufacturer to decide how many association groups their device will use and what they will use each group for.
Lifeline group
Beginning with zwave plus, Z wave alliance changed the specifications and now every Z wave plus device must support association and it must use association group one as the “lifeline group“ to send messages to the hub. Older devices don’t have to do that.
queries
When you query a Z wave device it will tell you if it has any association groups set up and what target device IDs it has in each of those groups. That’s really all there is to it. You’ll get the list of groups and the list of IDs already stored in each group.
You’ll be able to send an association group set command if you want to change which target device IDs are stored. When you set up an association, you literally just send the list of target device IDs that this particular trigger device is allowed to use for a specific association group.
And remember that those association groups are decided by that manufacturer for that model. Association group 3 might be used for a completely different purpose in a Fibaro device than it is in an Aeotec device. And a target device can be in totally different association groups for different trigger devices and, again, the target device has no idea it’s even in an association group at all.
Endpoints
Some Z wave devices have only one network device ID, but have multiple endpoints. A power strip is a classic example.
To address these endpoints, you typically use a comma. So if the device ID of the power strip is 03A, The endpoints would be 03A,1 etc.
It might be that you only want to set up an association with the third socket, for example. So you would set the target as 03A,3
Execution
Once the trigger device has the list of IDs it is associated with, that’s all you have to do. You don’t have to write a routine, you don’t have to do anything with the Target device. The firmware in the trigger device will automatically Send out the “basic” command to the target devices when the trigger condition is met. So literally the only thing the device owner has to do to make association actions happen is set the list of target device IDs in the trigger device. Everything after that is handled by the trigger device.
OK, those are the essentials, if there’s anything else you need, just let me know.