/** {@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) { ZWaveBinarySensorCommandClass commandClass = (ZWaveBinarySensorCommandClass) node.resolveCommandClass( ZWaveCommandClass.CommandClass.SENSOR_BINARY, channel.getEndpoint()); if (commandClass == null) { return null; } logger.debug( "NODE {}: Generating poll message for {}, endpoint {}", node.getNodeId(), commandClass.getCommandClass().getLabel(), channel.getEndpoint()); SerialMessage serialMessage = node.encapsulate(commandClass.getValueMessage(), commandClass, channel.getEndpoint()); List<SerialMessage> response = new ArrayList<SerialMessage>(1); response.add(serialMessage); return response; }
/** {@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; }
/** {@inheritDoc} */ @Override public State handleEvent(ZWaveThingChannel channel, ZWaveCommandClassValueEvent event) { logger.debug("ZWaveBinarySensorValueEvent 1"); String sensorType = channel.getArguments().get("sensorType"); logger.debug("ZWaveBinarySensorValueEvent 2"); ZWaveBinarySensorValueEvent sensorEvent = (ZWaveBinarySensorValueEvent) event; logger.debug("ZWaveBinarySensorValueEvent 3"); // Don't trigger event if this item is bound to another alarm type if (sensorType != null && SensorType.valueOf(sensorType) != sensorEvent.getSensorType()) { logger.debug("ZWaveBinarySensorValueEvent 4"); return null; } logger.debug("ZWaveBinarySensorValueEvent 5"); return sensorEvent.getValue() == 0 ? OnOffType.OFF : OnOffType.ON; }