/** {@inheritDoc} */
  @Override
  public State handleEvent(ZWaveThingChannel channel, ZWaveCommandClassValueEvent event) {
    String alarmType = channel.getArguments().get("type");
    ZWaveAlarmSensorValueEvent alarmEvent = (ZWaveAlarmSensorValueEvent) event;

    // Don't trigger event if this item is bound to another alarm type
    if (alarmType != null && AlarmType.valueOf(alarmType) != alarmEvent.getAlarmType()) {
      return null;
    }

    return alarmEvent.getValue() == 0 ? OnOffType.OFF : OnOffType.ON;
  }
  /** {@inheritDoc} */
  @Override
  public List<SerialMessage> executeRefresh(ZWaveThingChannel channel, ZWaveNode node) {
    ZWaveAlarmSensorCommandClass commandClass =
        (ZWaveAlarmSensorCommandClass)
            node.resolveCommandClass(
                ZWaveCommandClass.CommandClass.SENSOR_ALARM, channel.getEndpoint());
    if (commandClass == null) {
      return null;
    }

    String alarmType = channel.getArguments().get("alarmType");
    logger.debug(
        "NODE {}: Generating poll message for {}, endpoint {}, alarm {}",
        node.getNodeId(),
        commandClass.getCommandClass().getLabel(),
        channel.getEndpoint(),
        alarmType);

    SerialMessage serialMessage;
    if (alarmType != null) {
      serialMessage =
          node.encapsulate(
              commandClass.getMessage(AlarmType.valueOf(alarmType)),
              commandClass,
              channel.getEndpoint());
    } else {
      serialMessage =
          node.encapsulate(commandClass.getValueMessage(), commandClass, channel.getEndpoint());
    }

    if (serialMessage == null) {
      return null;
    }

    List<SerialMessage> response = new ArrayList<SerialMessage>();
    response.add(serialMessage);
    return response;
  }