@Override protected Integer convert(DecimalType value) { return value != null ? value.intValue() : null; }
@Override public void handleCommand(ChannelUID channelUID, Command command) { if (channelUID.getId().equals("number")) { if (command instanceof DecimalType) { DecimalType cmd = (DecimalType) command; int cmdInt = cmd.intValue(); ThingStatus status = cmdInt > 0 ? ThingStatus.ONLINE : ThingStatus.OFFLINE; int waitTime = Math.abs(cmd.intValue()); scheduler.schedule(() -> updateStatus(status), waitTime, TimeUnit.SECONDS); } } } }
@Override public List<ZWaveCommandClassTransactionPayload> receiveCommand(ZWaveThingChannel channel, ZWaveNode node, Command command) { ZWaveThermostatModeCommandClass commandClass = (ZWaveThermostatModeCommandClass) node.resolveCommandClass( ZWaveCommandClass.CommandClass.COMMAND_CLASS_THERMOSTAT_MODE, channel.getEndpoint()); int value = ((DecimalType) command).intValue(); if (command instanceof OnOffType) { value = command == OnOffType.ON ? 0xff : 0x00; } ZWaveCommandClassTransactionPayload serialMessage = node.encapsulate(commandClass.setValueMessage(value), channel.getEndpoint()); if (serialMessage == null) { logger.warn("NODE {}: Generating message failed for command class = {}, endpoint = {}", node.getNodeId(), commandClass.getCommandClass(), channel.getEndpoint()); return null; } List<ZWaveCommandClassTransactionPayload> messages = new ArrayList<ZWaveCommandClassTransactionPayload>(); messages.add(serialMessage); return messages; }
@Override public List<ZWaveCommandClassTransactionPayload> receiveCommand(ZWaveThingChannel channel, ZWaveNode node, Command command) { ZWaveThermostatFanModeCommandClass commandClass = (ZWaveThermostatFanModeCommandClass) node.resolveCommandClass( ZWaveCommandClass.CommandClass.COMMAND_CLASS_THERMOSTAT_FAN_MODE, channel.getEndpoint()); int value = ((DecimalType) command).intValue(); ZWaveCommandClassTransactionPayload serialMessage = node.encapsulate(commandClass.setValueMessage(value), channel.getEndpoint()); logger.debug("NODE {}: receiveCommand sending message {} ", node.getNodeId(), serialMessage); if (serialMessage == null) { logger.warn("NODE {}: Generating message failed for command class = {}, endpoint = {}", node.getNodeId(), commandClass.getCommandClass(), channel.getEndpoint()); return null; } List<ZWaveCommandClassTransactionPayload> messages = new ArrayList<ZWaveCommandClassTransactionPayload>(); messages.add(serialMessage); return messages; } }
logger.debug("NODE {}: Local Protection command received for {}", node.getNodeId(), command.toString()); int value = ((DecimalType) command).intValue(); if (value >= 0 && value < LocalProtectionType.values().length) { serialMessage = node.encapsulate( logger.debug("NODE {}: rf Protection command received for {}", node.getNodeId(), command.toString()); int value = ((DecimalType) command).intValue(); if (value >= 0 && value < RfProtectionType.values().length) { serialMessage = node.encapsulate(
value = ((OnOffType) command) == OnOffType.ON ? 0xff : 0x00; } else if (command instanceof DecimalType) { value = ((DecimalType) command).intValue(); } else { logger.warn("NODE {}: Unknown INDICATOR command type {}", node.getNodeId(),