Search in sources :

Example 6 with ZWaveCommandClassValueEvent

use of org.openhab.binding.zwave.internal.protocol.event.ZWaveCommandClassValueEvent in project openhab1-addons by openhab.

the class ZWaveNodeNamingCommandClass method processLocationReport.

/**
     * Processes a LOCATION_REPORT / LOCATION_SET message.
     *
     * @param serialMessage the incoming message to process.
     * @param offset the offset position from which to start message processing.
     * @param endpoint the endpoint or instance number this message is meant for.
     */
protected void processLocationReport(SerialMessage serialMessage, int offset, int endpoint) {
    String location = getString(serialMessage, offset);
    if (name == null) {
        return;
    }
    this.location = location;
    logger.debug("NODE {}: Node location: {}", this.getNode().getNodeId(), location);
    ZWaveCommandClassValueEvent zEvent = new ZWaveCommandClassValueEvent(this.getNode().getNodeId(), endpoint, this.getCommandClass(), location);
    this.getController().notifyEventListeners(zEvent);
}
Also used : ZWaveCommandClassValueEvent(org.openhab.binding.zwave.internal.protocol.event.ZWaveCommandClassValueEvent)

Example 7 with ZWaveCommandClassValueEvent

use of org.openhab.binding.zwave.internal.protocol.event.ZWaveCommandClassValueEvent in project openhab1-addons by openhab.

the class ZWaveProtectionCommandClass method handleApplicationCommandRequest.

/**
     * {@inheritDoc}
     */
@Override
public void handleApplicationCommandRequest(SerialMessage serialMessage, int offset, int endpoint) {
    logger.trace("Handle Message Switch Binary Request");
    logger.debug(String.format("Received Switch Binary Request for Node ID = %d", this.getNode().getNodeId()));
    int command = serialMessage.getMessagePayloadByte(offset);
    switch(command) {
        case PROTECTION_GET:
            logger.warn("Command {} not implemented.", command);
            return;
        case PROTECTION_REPORT:
            logger.trace("Process Protection Report");
            int value = serialMessage.getMessagePayloadByte(offset + 1);
            ProtectionStateType protectionType = ProtectionStateType.getProtectionStateType(value);
            logger.debug(String.format("NODE %d: Protection report, value = %s", this.getNode().getNodeId(), protectionType.label));
            ZWaveCommandClassValueEvent zEvent = new ZWaveCommandClassValueEvent(this.getNode().getNodeId(), endpoint, this.getCommandClass(), value);
            this.getController().notifyEventListeners(zEvent);
            dynamicDone = true;
            break;
        case PROTECTION_SET:
        default:
            logger.warn(String.format("Unsupported Command 0x%02X for command class %s (0x%02X).", command, this.getCommandClass().getLabel(), this.getCommandClass().getKey()));
    }
}
Also used : ZWaveCommandClassValueEvent(org.openhab.binding.zwave.internal.protocol.event.ZWaveCommandClassValueEvent) ZWaveEndpoint(org.openhab.binding.zwave.internal.protocol.ZWaveEndpoint)

Example 8 with ZWaveCommandClassValueEvent

use of org.openhab.binding.zwave.internal.protocol.event.ZWaveCommandClassValueEvent in project openhab1-addons by openhab.

the class ZWaveBarrierOperatorCommandClass method handleApplicationCommandRequest.

@Override
public void handleApplicationCommandRequest(SerialMessage serialMessage, int offset, int endpoint) {
    logger.debug("NODE {}: Received Barrier Operator Request", this.getNode().getNodeId());
    int command = serialMessage.getMessagePayloadByte(offset);
    switch(command) {
        case BARRIER_OPERATOR_GET:
        case BARRIER_OPERATOR_SET:
        case BARRIER_OPERATOR_SIGNAL_GET:
        case BARRIER_OPERATOR_SIGNAL_SET:
        case BARRIER_OPERATOR_SIGNAL_REPORT:
        case BARRIER_OPERATOR_SIGNAL_SUPPORTED_GET:
        case BARRIER_OPERATOR_SIGNAL_SUPPORTED_REPORT:
            logger.warn("Command {} not implemented.", command);
            return;
        case BARRIER_OPERATOR_REPORT:
            logger.trace("Process Barrier Operator Report");
            int value = serialMessage.getMessagePayloadByte(offset + 1);
            logger.debug("NODE {}: Barrier Operator report, value = {}", this.getNode().getNodeId(), value);
            ZWaveCommandClassValueEvent zEvent = new ZWaveBarrierOperatorValueEvent(this.getNode().getNodeId(), endpoint, this.getCommandClass(), value, BarrierOperatorStateType.getBarrierOperatorStateType(value));
            this.getController().notifyEventListeners(zEvent);
            break;
        default:
            logger.warn(String.format("Unsupported Command 0x%02X for command class %s (0x%02X).", command, this.getCommandClass().getLabel(), this.getCommandClass().getKey()));
    }
}
Also used : ZWaveCommandClassValueEvent(org.openhab.binding.zwave.internal.protocol.event.ZWaveCommandClassValueEvent) ZWaveEndpoint(org.openhab.binding.zwave.internal.protocol.ZWaveEndpoint)

Example 9 with ZWaveCommandClassValueEvent

use of org.openhab.binding.zwave.internal.protocol.event.ZWaveCommandClassValueEvent in project openhab1-addons by openhab.

the class ZWaveBasicCommandClass method processBasicReport.

/**
     * Processes a BASIC_REPORT / BASIC_SET message.
     *
     * @param serialMessage the incoming message to process.
     * @param offset the offset position from which to start message processing.
     * @param endpoint the endpoint or instance number this message is meant for.
     */
protected void processBasicReport(SerialMessage serialMessage, int offset, int endpoint) {
    int value = serialMessage.getMessagePayloadByte(offset + 1);
    logger.debug(String.format("NODE %d: Basic report, value = 0x%02X", this.getNode().getNodeId(), value));
    ZWaveCommandClassValueEvent zEvent = new ZWaveCommandClassValueEvent(this.getNode().getNodeId(), endpoint, this.getCommandClass(), value);
    this.getController().notifyEventListeners(zEvent);
}
Also used : ZWaveCommandClassValueEvent(org.openhab.binding.zwave.internal.protocol.event.ZWaveCommandClassValueEvent) ZWaveEndpoint(org.openhab.binding.zwave.internal.protocol.ZWaveEndpoint)

Example 10 with ZWaveCommandClassValueEvent

use of org.openhab.binding.zwave.internal.protocol.event.ZWaveCommandClassValueEvent in project openhab1-addons by openhab.

the class ZWaveBinarySwitchCommandClass method processSwitchBinaryReport.

/**
     * Processes a SWITCH_BINARY_REPORT / SWITCH_BINARY_SET message.
     *
     * @param serialMessage the incoming message to process.
     * @param offset the offset position from which to start message processing.
     * @param endpoint the endpoint or instance number this message is meant for.
     */
protected void processSwitchBinaryReport(SerialMessage serialMessage, int offset, int endpoint) {
    int value = serialMessage.getMessagePayloadByte(offset + 1);
    logger.debug(String.format("NODE %d: Switch Binary report, value = 0x%02X", this.getNode().getNodeId(), value));
    ZWaveCommandClassValueEvent zEvent = new ZWaveCommandClassValueEvent(this.getNode().getNodeId(), endpoint, this.getCommandClass(), value);
    this.getController().notifyEventListeners(zEvent);
}
Also used : ZWaveCommandClassValueEvent(org.openhab.binding.zwave.internal.protocol.event.ZWaveCommandClassValueEvent) ZWaveEndpoint(org.openhab.binding.zwave.internal.protocol.ZWaveEndpoint)

Aggregations

ZWaveCommandClassValueEvent (org.openhab.binding.zwave.internal.protocol.event.ZWaveCommandClassValueEvent)15 ZWaveEndpoint (org.openhab.binding.zwave.internal.protocol.ZWaveEndpoint)13 BigDecimal (java.math.BigDecimal)1 DateFormatSymbols (java.text.DateFormatSymbols)1 Calendar (java.util.Calendar)1 Date (java.util.Date)1 Properties (java.util.Properties)1