Association Control

Association groups are used to control other devices in the Z-Wave network. In this example we set up one additional Association Group — ZUNO_ASSOCIATION_GROUP_SET_VALUE, which will send On/Off commands to device added to the group. You can read more about Association groups here.
  • Z-Uno board
  • Breadboard
  • Z-Wave switch/relay/siren
        #define BTN_PIN 18       // button pin
#define LED_PIN 13       // LED pin

byte lastValue;

ZUNO_SETUP_ASSOCIATIONS(ZUNO_ASSOCIATION_GROUP_SET_VALUE); // this macro defines association groups in Z-Uno

void setup() {
  pinMode(BTN_PIN, INPUT_PULLUP); // setup pin as input with pullup
}

void loop() {
  byte currentValue = !digitalRead(BTN_PIN);
  if (currentValue != lastValue) {  // if state changes
    lastValue = currentValue;      // save new state

    if (lastValue) {
      zunoSendToGroupSetValueCommand(CTRL_GROUP_1, ZUNO_SWITCHED_ON);   // if button pressed - send switch ON command
      digitalWrite(LED_PIN, HIGH);    //  turn the LED on
    } else {
      zunoSendToGroupSetValueCommand(CTRL_GROUP_1, ZUNO_SWITCHED_OFF);  // if button released - send switch OFF command
      digitalWrite(LED_PIN, LOW);     // turn the LED off
    }
  }
}
To set association between Z-Uno and other deivces please follow these steps:
  1. Include Z-Uno in your Z-Wave network (if not done yet).
  2. Include the device what will be controlled by Z-Uno (if not yet in the network), for example it can be a binary switch.
  3. Go to the association setup window of your controller (in our example it's an Expert interface of the Razberry controller) and add the device to be controlled in the group #2 of Z-Uno.
  4. Control your device from Z-Uno
Second Page