use of org.openhab.binding.zwave.internal.protocol.SerialMessage in project openhab1-addons by openhab.
the class ZWaveSwitchAllCommandClass method setValueMessage.
/**
* Create a new SwitchAll set message
*
* @param mode
* as (0x00 - Exclude, 0x01 Only All On, 0x02 Only All Off, 0xFF
* Both All on and All off)
* @return SerialMessage
*/
public SerialMessage setValueMessage(int m) {
mode = SwitchAllMode.fromInteger(m);
if (mode != null) {
logger.debug("NODE {}: Switch All report, {}.", this.getNode().getNodeId(), mode.getDescription());
} else {
logger.debug("NODE {}: Switch All unsupported mode.", this.getNode().getNodeId());
return null;
}
SerialMessage result = new SerialMessage(this.getNode().getNodeId(), SerialMessage.SerialMessageClass.SendData, SerialMessage.SerialMessageType.Request, SerialMessage.SerialMessageClass.SendData, SerialMessage.SerialMessagePriority.Set);
byte[] newPayload = { (byte) this.getNode().getNodeId(), 3, (byte) this.getCommandClass().getKey(), (byte) SWITCH_ALL_SET, (byte) m };
result.setMessagePayload(newPayload);
return result;
}
use of org.openhab.binding.zwave.internal.protocol.SerialMessage in project openhab1-addons by openhab.
the class ZWaveThermostatFanModeCommandClass method getSupportedMessage.
/**
* Gets a SerialMessage with the THERMOSTAT_FAN_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_FAN_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_FAN_MODE_SUPPORTED_GET };
result.setMessagePayload(newPayload);
return result;
}
use of org.openhab.binding.zwave.internal.protocol.SerialMessage in project openhab1-addons by openhab.
the class ZWaveThermostatFanModeCommandClass method setValueMessage.
/**
* {@inheritDoc}
*/
@Override
public SerialMessage setValueMessage(int value) {
if (fanModeTypes.isEmpty()) {
logger.warn("NODE {}: requesting fan mode types, set request ignored (try again later)", this.getNode().getNodeId());
return this.getSupportedMessage();
}
if (!fanModeTypes.contains(FanModeType.getFanModeType(value))) {
logger.error("NODE {}: Unsupported fanMode type {}", value, this.getNode().getNodeId());
return null;
}
logger.debug("NODE {}: Creating new message for application command THERMOSTAT_FAN_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_FAN_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 ZWaveAlarmCommandClass method getMessage.
/**
* Gets a SerialMessage with the ALARM_GET command
*
* @return the serial message
*/
public SerialMessage getMessage(AlarmType alarmType) {
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 ALARM_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(), 3, (byte) getCommandClass().getKey(), (byte) ALARM_GET, (byte) alarmType.getKey() };
result.setMessagePayload(newPayload);
return result;
}
use of org.openhab.binding.zwave.internal.protocol.SerialMessage in project openhab1-addons by openhab.
the class ZWaveAssociationCommandClass method setAssociationMessage.
/**
* Gets a SerialMessage with the ASSOCIATIONCMD_SET command
*
* @param group
* the association group
* @param node
* the node to add to the specified group
* @return the serial message
*/
public SerialMessage setAssociationMessage(int group, int node) {
logger.debug("NODE {}: Creating new message for application command ASSOCIATIONCMD_SET", this.getNode().getNodeId());
SerialMessage result = new SerialMessage(this.getNode().getNodeId(), SerialMessageClass.SendData, SerialMessageType.Request, SerialMessageClass.SendData, SerialMessagePriority.Config);
byte[] newPayload = { (byte) this.getNode().getNodeId(), 4, (byte) getCommandClass().getKey(), (byte) ASSOCIATIONCMD_SET, (byte) (group & 0xff), (byte) (node & 0xff) };
result.setMessagePayload(newPayload);
return result;
}
Aggregations