Search in sources :

Example 1 with ZWaveAssociationEvent

use of org.openhab.binding.zwave.internal.protocol.commandclass.ZWaveAssociationCommandClass.ZWaveAssociationEvent 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);
    }
}
Also used : ZWaveNodeSerializer(org.openhab.binding.zwave.internal.protocol.initialization.ZWaveNodeSerializer) ZWaveNode(org.openhab.binding.zwave.internal.protocol.ZWaveNode) ZWaveInclusionEvent(org.openhab.binding.zwave.internal.protocol.event.ZWaveInclusionEvent) ZWaveSwitchAllCommandClass(org.openhab.binding.zwave.internal.protocol.commandclass.ZWaveSwitchAllCommandClass) ZWaveConfigurationParameterEvent(org.openhab.binding.zwave.internal.protocol.commandclass.ZWaveConfigurationCommandClass.ZWaveConfigurationParameterEvent) ZWaveAssociationEvent(org.openhab.binding.zwave.internal.protocol.commandclass.ZWaveAssociationCommandClass.ZWaveAssociationEvent) ZWaveWakeUpCommandClass(org.openhab.binding.zwave.internal.protocol.commandclass.ZWaveWakeUpCommandClass)

Aggregations

ZWaveNode (org.openhab.binding.zwave.internal.protocol.ZWaveNode)1 ZWaveAssociationEvent (org.openhab.binding.zwave.internal.protocol.commandclass.ZWaveAssociationCommandClass.ZWaveAssociationEvent)1 ZWaveConfigurationParameterEvent (org.openhab.binding.zwave.internal.protocol.commandclass.ZWaveConfigurationCommandClass.ZWaveConfigurationParameterEvent)1 ZWaveSwitchAllCommandClass (org.openhab.binding.zwave.internal.protocol.commandclass.ZWaveSwitchAllCommandClass)1 ZWaveWakeUpCommandClass (org.openhab.binding.zwave.internal.protocol.commandclass.ZWaveWakeUpCommandClass)1 ZWaveInclusionEvent (org.openhab.binding.zwave.internal.protocol.event.ZWaveInclusionEvent)1 ZWaveNodeSerializer (org.openhab.binding.zwave.internal.protocol.initialization.ZWaveNodeSerializer)1