use of org.openhab.binding.zwave.internal.protocol.commandclass.ZWaveConfigurationCommandClass.ZWaveConfigurationParameterEvent in project openhab1-addons by openhab.
the class ZWaveConfigurationConverter method handleEvent.
/**
* {@inheritDoc}
*/
@Override
public void handleEvent(ZWaveCommandClassValueEvent event, Item item, Map<String, String> arguments) {
String parmNumber = arguments.get("parameter");
ZWaveConfigurationParameterEvent cfgEvent = (ZWaveConfigurationParameterEvent) event;
// Make sure this is for the parameter we want
if (cfgEvent.getParameter() != null && cfgEvent.getParameter().getIndex() != Integer.parseInt(parmNumber)) {
return;
}
ZWaveStateConverter<?, ?> converter = this.getStateConverter(item, cfgEvent.getParameter().getValue());
if (converter == null) {
logger.warn("NODE {}: No converter found for item = {}({}), endpoint = {}, ignoring event.", event.getNodeId(), item.getName(), item.getClass().getSimpleName(), event.getEndpoint());
return;
}
State state = converter.convertFromValueToState(cfgEvent.getParameter().getValue());
this.getEventPublisher().postUpdate(item.getName(), state);
}
use of org.openhab.binding.zwave.internal.protocol.commandclass.ZWaveConfigurationCommandClass.ZWaveConfigurationParameterEvent in project openhab1-addons by openhab.
the class ZWaveConfiguration method ZWaveIncomingEvent.
/**
* Event handler method for incoming Z-Wave events.
*
* @param event
* the incoming Z-Wave event.
*/
@Override
public void ZWaveIncomingEvent(ZWaveEvent event) {
if (event instanceof ZWaveConfigurationParameterEvent) {
// Write the node to disk
ZWaveNodeSerializer nodeSerializer = new ZWaveNodeSerializer();
nodeSerializer.SerializeNode(zController.getNode(event.getNodeId()));
// We've received an updated configuration parameter
// See if this is something in our 'pending' list and remove it
PendingCfg.Remove(ZWaveCommandClass.CommandClass.CONFIGURATION.getKey(), event.getNodeId(), ((ZWaveConfigurationParameterEvent) event).getParameter().getIndex());
return;
}
if (event instanceof ZWaveAssociationEvent) {
// Write the node to disk
ZWaveNodeSerializer nodeSerializer = new ZWaveNodeSerializer();
nodeSerializer.SerializeNode(zController.getNode(event.getNodeId()));
// See if this is something in our 'pending' list and remove it
for (ZWaveNode node : zController.getNodes()) {
PendingCfg.Remove(ZWaveCommandClass.CommandClass.ASSOCIATION.getKey(), event.getNodeId(), ((ZWaveAssociationEvent) event).getGroup(), node.getNodeId());
}
return;
}
if (event instanceof ZWaveWakeUpCommandClass.ZWaveWakeUpEvent) {
// We only care about the wake-up report
if (((ZWaveWakeUpCommandClass.ZWaveWakeUpEvent) event).getEvent() != ZWaveWakeUpCommandClass.WAKE_UP_INTERVAL_REPORT) {
return;
}
// Write the node to disk
ZWaveNodeSerializer nodeSerializer = new ZWaveNodeSerializer();
nodeSerializer.SerializeNode(zController.getNode(event.getNodeId()));
// Remove this node from the pending list
PendingCfg.Remove(ZWaveCommandClass.CommandClass.WAKE_UP.getKey(), event.getNodeId());
return;
}
if (event instanceof ZWaveSwitchAllCommandClass.ZWaveSwitchAllModeEvent) {
ZWaveSwitchAllCommandClass.ZWaveSwitchAllModeEvent e = (ZWaveSwitchAllCommandClass.ZWaveSwitchAllModeEvent) event;
// Write the node to disk
ZWaveNodeSerializer nodeSerializer = new ZWaveNodeSerializer();
nodeSerializer.SerializeNode(zController.getNode(event.getNodeId()));
// Remove this node from the pending list
PendingCfg.Remove(ZWaveCommandClass.CommandClass.SWITCH_ALL.getKey(), e.getNodeId());
return;
}
if (event instanceof ZWaveInclusionEvent) {
handleInclusionEvent((ZWaveInclusionEvent) event);
}
}
Aggregations