use of org.openhab.binding.zwave.internal.protocol.SerialMessage in project openhab1-addons by openhab.
the class ZWaveBinarySensorCommandClass method getValueMessage.
/**
* Gets a SerialMessage with the SENSOR_BINARY_GET command
*
* @return the serial message
*/
@Override
public SerialMessage getValueMessage() {
if (isGetSupported == false) {
logger.debug("NODE {}: Node doesn't support get requests", this.getNode().getNodeId());
return null;
}
logger.debug("NODE {}: Creating new message for application command SENSOR_BINARY_GET", this.getNode().getNodeId());
SerialMessage result = new SerialMessage(this.getNode().getNodeId(), SerialMessageClass.SendData, SerialMessageType.Request, SerialMessageClass.ApplicationCommandHandler, SerialMessagePriority.Get);
byte[] newPayload = { (byte) this.getNode().getNodeId(), 2, (byte) getCommandClass().getKey(), (byte) SENSOR_BINARY_GET };
// Should there be another byte here to specify the sensor type?
// Looking at the RaZberry doc, it talks about requesting the sensor type
// and using FF for the first sensor.
// Maybe this is a V2 feature - need to find some docs on V2!
result.setMessagePayload(newPayload);
return result;
}
use of org.openhab.binding.zwave.internal.protocol.SerialMessage in project openhab1-addons by openhab.
the class ZWaveBinarySwitchCommandClass method setValueMessage.
/**
* Gets a SerialMessage with the SWITCH_BINARY_SET command
*
* @param the level to set. 0 is mapped to off, > 0 is mapped to on.
* @return the serial message
*/
@Override
public SerialMessage setValueMessage(int level) {
if (isGetSupported == false) {
logger.debug("NODE {}: Node doesn't support get requests", this.getNode().getNodeId());
return null;
}
logger.debug("NODE {}: Creating new message for application command SWITCH_BINARY_SET", this.getNode().getNodeId());
SerialMessage result = new SerialMessage(this.getNode().getNodeId(), SerialMessageClass.SendData, SerialMessageType.Request, SerialMessageClass.SendData, SerialMessagePriority.Set);
byte[] newPayload = { (byte) this.getNode().getNodeId(), 3, (byte) getCommandClass().getKey(), (byte) SWITCH_BINARY_SET, (byte) (level > 0 ? 0xFF : 0x00) };
result.setMessagePayload(newPayload);
return result;
}
use of org.openhab.binding.zwave.internal.protocol.SerialMessage in project openhab1-addons by openhab.
the class ZWaveBinarySwitchCommandClass method getValueMessage.
/**
* Gets a SerialMessage with the SWITCH_BINARY_GET command
*
* @return the serial message
*/
@Override
public SerialMessage getValueMessage() {
logger.debug("NODE {}: Creating new message for application command SWITCH_BINARY_GET", this.getNode().getNodeId());
SerialMessage result = new SerialMessage(this.getNode().getNodeId(), SerialMessageClass.SendData, SerialMessageType.Request, SerialMessageClass.ApplicationCommandHandler, SerialMessagePriority.Get);
byte[] newPayload = { (byte) this.getNode().getNodeId(), 2, (byte) getCommandClass().getKey(), (byte) SWITCH_BINARY_GET };
result.setMessagePayload(newPayload);
return result;
}
use of org.openhab.binding.zwave.internal.protocol.SerialMessage in project openhab1-addons by openhab.
the class ZWaveThermostatModeCommandClass method setValueMessage.
/**
* {@inheritDoc}
*/
@Override
public SerialMessage setValueMessage(int value) {
logger.debug("NODE {}: setValueMessage {}, modeType empty {}", this.getNode().getNodeId(), value, modeTypes.isEmpty());
// if we do not have any mode types yet, get them
if (modeTypes.isEmpty()) {
logger.warn("NODE {}: requesting mode types, set request ignored (try again later)", this.getNode().getNodeId());
return this.getSupportedMessage();
}
if (!modeTypes.contains(ModeType.getModeType(value))) {
logger.error("NODE {}: Unsupported mode type {}", this.getNode().getNodeId(), value);
return null;
}
logger.debug("NODE {}: Creating new message for application command THERMOSTAT_MODE_SET", this.getNode().getNodeId());
SerialMessage result = new SerialMessage(this.getNode().getNodeId(), SerialMessageClass.SendData, SerialMessageType.Request, SerialMessageClass.SendData, SerialMessagePriority.Set);
byte[] newPayload = { (byte) this.getNode().getNodeId(), 3, (byte) getCommandClass().getKey(), THERMOSTAT_MODE_SET, (byte) value };
result.setMessagePayload(newPayload);
return result;
}
use of org.openhab.binding.zwave.internal.protocol.SerialMessage in project openhab1-addons by openhab.
the class ZWaveThermostatModeCommandClass method getSupportedMessage.
/**
* Gets a SerialMessage with the THERMOSTAT_MODE_SUPPORTED_GET command
*
* @return the serial message, or null if the supported command is not supported.
*/
public SerialMessage getSupportedMessage() {
logger.debug("NODE {}: Creating new message for application command THERMOSTAT_MODE_SUPPORTED_GET", this.getNode().getNodeId());
SerialMessage result = new SerialMessage(this.getNode().getNodeId(), SerialMessageClass.SendData, SerialMessageType.Request, SerialMessageClass.ApplicationCommandHandler, SerialMessagePriority.Config);
byte[] newPayload = { (byte) this.getNode().getNodeId(), 2, (byte) getCommandClass().getKey(), THERMOSTAT_MODE_SUPPORTED_GET };
result.setMessagePayload(newPayload);
return result;
}
Aggregations